Ensure only a minimal set of external dependencies vendored for building a hello-world binary
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
#### C++ hello-world
Using C++ binary as an example.
To build a C++ hello-world binary offline
```
cc_binary(
name = "bin",
srcs = ["main.cc"],
)
```
we'll have to vendor the following repositories with Bazel built at 96b90baf08172bb55844c2366111a0c39b6f9e14 or later.
- bazel_features
- bazel_skylib
- platforms
- rules_cc
- rules_java
- rules_python
While, the first four as acceptable, rules_java and rules_python should not be required by default for building a simple C++ hello world program.
The same can be apply to building hello-world program of other languages.
#### Java hello-world
- bazel_features~
- bazel_skylib~
- platforms
- rules_cc~
- rules_java~
- rules_java~~toolchains~remote_java_tools
- rules_java~~toolchains~remote_java_tools_darwin_arm64
- rules_java~~toolchains~remotejdk11_macos_aarch64
- rules_java~~toolchains~remotejdk21_macos_aarch64
- rules_proto~
- rules_python~
### Suggested solution
- Add test to prevent additional dependencies are added
- Cut off unwanted dependencies.
### Which category does this issue belong to?
_No response_
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
https://github.com/meteorcloudy/minimal_vendor_test/tree/main
### Which operating system are you running Bazel on?
macOS, Linux, Windows
### What is the output of `bazel info release`?
96b90baf08172bb55844c2366111a0c39b6f9e14 or later
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start with the linked minimal_vendor_test reproduction and compare the external repositories pulled in for the C++ and Java hello-world builds. Trace Bazel's default dependency declarations and add a regression test that detects newly required repositories. Done means offline builds vendor only the minimal dependencies needed for each language.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100