diff --git a/.gazelcfg.json b/.kazelcfg.json similarity index 100% rename from .gazelcfg.json rename to .kazelcfg.json diff --git a/.travis.yml b/.travis.yml index e115503f..8c2f3849 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ install: - go install ./... script: - - verify/verify-boilerplate.sh --rootdir="${TRAVIS_BUILD_DIR}" -v - - verify/verify-go-src.sh --rootdir "${TRAVIS_BUILD_DIR}" -v + - verify/verify-boilerplate.sh --rootdir="$GOPATH/src/k8s.io/repo-infra" -v + - verify/verify-go-src.sh --rootdir "$GOPATH/src/k8s.io/repo-infra" -v - buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f) - - gazel --print-diff --validate + - kazel --print-diff --validate - bazel build //... diff --git a/gazel/BUILD b/kazel/BUILD similarity index 93% rename from gazel/BUILD rename to kazel/BUILD index fb0f584f..5e0bb5dc 100644 --- a/gazel/BUILD +++ b/kazel/BUILD @@ -9,7 +9,7 @@ load( ) go_binary( - name = "gazel", + name = "kazel", library = ":go_default_library", tags = ["automanaged"], ) @@ -19,8 +19,8 @@ go_library( srcs = [ "config.go", "diff.go", - "gazel.go", "generator.go", + "kazel.go", "sourcerer.go", ], tags = ["automanaged"], diff --git a/gazel/README.rst b/kazel/README.rst similarity index 64% rename from gazel/README.rst rename to kazel/README.rst index 5a2ee11a..2cc96aee 100644 --- a/gazel/README.rst +++ b/kazel/README.rst @@ -1,11 +1,11 @@ -gazel - a BUILD file generator for go and bazel +kazel - a BUILD file generator for go and bazel =============================================== Requirements: ############# * Your project must be somewhat compatible with go tool because - gazel uses go tool to parse your import tree. + kazel uses go tool to parse your import tree. * You must have a **GOPATH** and **GOROOT** setup and your project must be in the correct location in your **GOPATH**. * Your ``./vendor`` directory may not contain ``BUILD`` files. @@ -13,55 +13,55 @@ Requirements: Usage: ###### -1. Get gazel by running ``go get k8s.io/repo-infra/gazel``. +1. Get kazel by running ``go get k8s.io/repo-infra/kazel``. -2. Create a ``.gazelcfg.json`` in the root of the repository. For the - gazel repository, the ``.gazelcfg.json`` would look like: +2. Create a ``.kazelcfg.json`` in the root of the repository. For the + kazel repository, the ``.kazelcfg.json`` would look like: .. code-block:: json { "GoPrefix": "k8s.io/repo-infra", "SrcDirs": [ - "./gazel" + "./kazel" ], "SkippedPaths": [ ".*foobar(baz)?.*$" ] } -3. Run gazel: +3. Run kazel: .. code-block:: bash - $ gazel -root=$GOPATH/src/k8s.io/repo-infra + $ kazel -root=$GOPATH/src/k8s.io/repo-infra Defaults: ######### -* **SrcDirs** in ``.gazelcfg.json`` defaults to ``["./"]`` +* **SrcDirs** in ``.kazelcfg.json`` defaults to ``["./"]`` * ``-root`` option defaults to the current working directory Automanagement: ############### -gazel reconciles rules that have the "**automanaged**" tag. If -you no longer want gazel to manage a rule, you can remove the -**automanaged** tag and gazel will no longer manage that rule. +kazel reconciles rules that have the "**automanaged**" tag. If +you no longer want kazel to manage a rule, you can remove the +**automanaged** tag and kazel will no longer manage that rule. -gazel only manages srcs, deps, and library attributes of a +kazel only manages srcs, deps, and library attributes of a rule after initial creation so you can add and managed other -attributes like data and copts and gazel will respect your +attributes like data and copts and kazel will respect your changes. -gazel automatically formats all ``BUILD`` files in your repository +kazel automatically formats all ``BUILD`` files in your repository except for those matching **SkippedPaths**. Adding "sources" rules: ####################### -If you set "**AddSourcesRules**": ``true`` in your ``.gazelcfg.json``, -gazel will create "**package-srcs**" and "**all-srcs**" rules in every +If you set "**AddSourcesRules**": ``true`` in your ``.kazelcfg.json``, +kazel will create "**package-srcs**" and "**all-srcs**" rules in every package. The "**package-srcs**" rule is a glob matching all files in the @@ -85,6 +85,6 @@ automanaged. Validating BUILD files in CI: ############################# -If you run gazel with ``--validate``, it will not update any ``BUILD`` files, but it +If you run kazel with ``--validate``, it will not update any ``BUILD`` files, but it will exit nonzero if any ``BUILD`` files are out-of-date. You can add ``--print-diff`` to print out the changes needed. diff --git a/gazel/config.go b/kazel/config.go similarity index 100% rename from gazel/config.go rename to kazel/config.go diff --git a/gazel/diff.go b/kazel/diff.go similarity index 100% rename from gazel/diff.go rename to kazel/diff.go diff --git a/gazel/generator.go b/kazel/generator.go similarity index 100% rename from gazel/generator.go rename to kazel/generator.go diff --git a/gazel/gazel.go b/kazel/kazel.go similarity index 99% rename from gazel/gazel.go rename to kazel/kazel.go index 848582c6..4f3252c5 100644 --- a/gazel/gazel.go +++ b/kazel/kazel.go @@ -30,7 +30,7 @@ var ( dryRun = flag.Bool("dry-run", false, "run in dry mode") printDiff = flag.Bool("print-diff", false, "print diff to stdout") validate = flag.Bool("validate", false, "run in dry mode and exit nonzero if any BUILD files need to be updated") - cfgPath = flag.String("cfg-path", ".gazelcfg.json", "path to gazel config (relative paths interpreted relative to -repo.") + cfgPath = flag.String("cfg-path", ".kazelcfg.json", "path to kazel config (relative paths interpreted relative to -repo.") ) func main() { diff --git a/gazel/sourcerer.go b/kazel/sourcerer.go similarity index 97% rename from gazel/sourcerer.go rename to kazel/sourcerer.go index d8e33c06..3140cf1c 100644 --- a/gazel/sourcerer.go +++ b/kazel/sourcerer.go @@ -16,7 +16,7 @@ const ( // walkSource walks the source tree recursively from pkgPath, adding // any BUILD files to v.newRules to be formatted. // -// If AddSourcesRules is enabled in the Gazel config, then we additionally add +// If AddSourcesRules is enabled in the kazel config, then we additionally add // package-sources and recursive all-srcs filegroups rules to every BUILD file. // // Returns the list of children all-srcs targets that should be added to the