Skip to content

Ensure only a minimal set of external dependencies vendored for building a hello-world binary #22684

Description

@meteorcloudy

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 96b90ba 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?

96b90ba 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.team-Rules-CPPIssues for C++ rulesteam-Rules-JavaIssues for Java rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions