{"id":13450802,"url":"https://github.com/bazelbuild/BUILD_file_generator","last_synced_at":"2025-03-23T16:32:18.701Z","repository":{"id":66251025,"uuid":"103604931","full_name":"bazelbuild/BUILD_file_generator","owner":"bazelbuild","description":"Generate BUILD files for your Java files","archived":true,"fork":false,"pushed_at":"2019-06-04T11:54:51.000Z","size":156,"stargazers_count":39,"open_issues_count":16,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-07-31T07:15:47.754Z","etag":null,"topics":["bazel","build-tool","dependencies","java","migration-tool"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazelbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null}},"created_at":"2017-09-15T02:32:15.000Z","updated_at":"2023-07-29T01:02:10.000Z","dependencies_parsed_at":"2023-12-16T19:15:11.627Z","dependency_job_id":null,"html_url":"https://github.com/bazelbuild/BUILD_file_generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2FBUILD_file_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2FBUILD_file_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2FBUILD_file_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2FBUILD_file_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelbuild","download_url":"https://codeload.github.com/bazelbuild/BUILD_file_generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221856456,"owners_count":16892443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","build-tool","dependencies","java","migration-tool"],"created_at":"2024-07-31T07:00:38.705Z","updated_at":"2024-10-28T16:31:54.707Z","avatar_url":"https://github.com/bazelbuild.png","language":"Java","funding_links":[],"categories":["Tooling"],"sub_categories":["Project generators"],"readme":"[![Build status](https://badge.buildkite.com/dc74310b2f9cdc853c66d97edf96cbc5e455963daddc603a48.svg)](https://buildkite.com/bazel/build-file-generator-postsubmit)\n\n**NOTE: This project is deprecated and no longer maintained.**\n\n# BUILD File Generator\n\nBUILD File Generator generates Bazel BUILD files for Java code.\n\n1. It reads all `.java` files, and extracts the class dependency graph.\n2. Computes the strongly connected components of the graph.\n3. For each component, creates a `java_library` rule.\n\n### Why is it useful?\n\nHaving all sources in a single BUILD rule doesn't allow Bazel to parallelize and\ncache builds. In order to fully benefit from Bazel, one must write multiple\nBUILD rules and connect them.\n\nThis project automates writing granular BUILD rules that allow Bazel to\nparallelize and cache builds.\n\nIt's useful to quickly try out Bazel on your project as well as to periodically\noptimize your build graph.\n\nBFG is composed of two general components\n\n1. Language specific parsers\n2. The BFG binary\n\nThe parsers read your source code and generate a class dependency graph in the\nform of a protobuf. To generate your BUILD files, you pass the generated\nprotobuf into the BFG binary.\n\n### Step 1: Using parsers to generate dependency graphs\n\nSuppose your project's Java code is in `core/src/main/java/` and\n`core/src/test/java/`.\n\n```bash\nbazel run //lang/java/src/main/java/com/google/devtools/build/bfg:JavaSourceFileParserCli -- --roots=core/src/main/java,core/src/test/java $(find core/src/main/java/ core/src/test/java/ -name \\*.java) \u003e bfg.bin\n```\n\nThe output is a serialized [ParserOutput] (https://github.com/bazelbuild/BUILD_file_generator/blob/672c5572499e96f6a89bfaa5d7baaf92184c6d7c/src/main/java/com/google/devtools/build/bfg/bfg.proto#L9) proto\n\n### Step 2: Generating BUILD files using BFG binary\n\nTODO(bazel-devel): add explanation and valid example arguments.\n\n```bash\nbazel run //src/main/java/com/google/devtools/build/bfg -- --buildozer=$BUILDOZER --whitelist=$YOUR_JAVA_PACKAGE \u003c bfg.bin\n```\n\n### Supported Languages\n\nWe currently support Java projects. The next language on our roadmap is Scala.\n\n## Development\n\n## Third-party Maven dependencies\n\nWe use a [bazel-deps](https://github.com/johnynek/bazel-deps)\nto manage Maven jar dependencies. All of our dependencies are listed in\n[`maven_deps.yaml`](maven_deps.yaml). `bazel-deps` provides tools to manage\ndependencies in that file and generates the Bazel build files for them in\n`thirdparty/jvm/`.\n\nTo use `bazel-deps`, use the wrapper scripts in `dev-scripts/dependencies/`.\nDon't edit the files under `thirdparty/jvm/` by hand.\n\nTo add or update a dependency, run\n`./dev-scripts/dependencies/add-dep.sh MAVEN_COORD`, where `MAVEN_COORD` is the\nMaven coordinate of the dependency, such as `com.google.guava:guava:23.0`.\nAdd the `--scala` option if it is a Scala dependency.\n\nAfter running this, you'll see changes to `maven_deps.yaml` and one or more\nfiles under `thirdparty/jvm`. Add and commit all of those changes. Similarly,\nif you run `add-dep.sh` with a new version of an existing dependency, it will be\nupdated in `maven_deps.yaml` and any changed indirect dependencies will be\nreflected in the generated files.\n\nYou can also edit `maven_deps.yaml` manually. You will need to do this to\nremove a dependency, or to add exclusions to a dependency's dependencies. After\nmaking changes, run `./dev-scripts/dependencies/generate.sh` to rebuild the\ngenerated files, and commit the changes to the generated files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2FBUILD_file_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelbuild%2FBUILD_file_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2FBUILD_file_generator/lists"}