Giter Site home page Giter Site logo

bazel_subtree_github_export's Introduction

Export bazel subtree to GitHub

This package contains a utility for exporting a subset of my phd repo as a standalone git repository. Give one or more bazel targets, it determines the required dependencies and filters through the git history, exporting only the commits that are needed to reproduce the files, and rewriting the commits so that only the necessary files are modified.

Usage

To export the targets //package/to/export/... and //another/package to a GitHub repo called github_export:

$ bazel run //tools/source_tree:export_git_history -- \
        --targets=//package/to/export/...,//another/package \
        --mv_files=package/to/export/README.md:README.md \
        --github_repo=github_export

Additionally, the --mv_files argument permits moving a file's location in the exported repository, which is useful for exporting things like readme and license files to the package root.

The utility can also be called from a python script. The script equivalent to the previous command is:

from tools.source_tree import export_source_tree
export_source_tree.EXPORT(
    github_repo='git_bazel_subtree_filter',
    targets=[
        '//package/to/export/...',
        '//another/package',
    ],
    move_file_mapping={
        'package/to/export/README.md': 'README.md',
    },
)

And the BUILD target for it:

py_binary(
    name = "EXPORT",
    srcs = ["EXPORT.py"],
    deps = ["//tools/source_tree:export_source_tree"],
)

bazel_subtree_github_export's People

Contributors

chriscummins avatar grahamlopez avatar jsmeredith avatar rothpc avatar vlvrd avatar

Watchers

 avatar  avatar

bazel_subtree_github_export's Issues

Add a `exports_repo()` bazel rule.

Implement a custom skylark rule that replaces the ad-hoc EXPORT.py scripts with the equivalent logic in a BUILD file.

Example BUILD file usage:

exports_repo(
    name='labm8',
    targets=['//labm8:all'],
    move_file_mapping={
        'labm8/README.md': 'README.md',
        'labm8/LICENSE': 'LICENSE',
        'labm8/travis.yml': '.travis.yml',
    }
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.