Description of the problem / feature request:
Hello, I am currently working on a Bazel module to store platforms used by our project. I import these using
bazel_dep(name = "myplatforms", version = "1.0.0-alpha.1")
And in my example binary I have something like:
cc_binary(
name = "hello-world",
srcs = ["hello-world.cc"],
local_defines = select({
"@myplatforms//<specific constraint>": ["<some define>=1"],
"//conditions:default": [],
})
)
✅ I can build all targets in the platform module:
bazelisk build @myplatforms//...
(14:11:51) INFO: Build completed successfully, 1 total action
✅ I can also build all targets in the project:
bazelisk build //...
(14:17:43) INFO: Build completed successfully, 6 total actions
⚠️ But when I try to specify a platform things get a little weird:
bazelisk build //... --platforms @myplatforms//platform:<myplatform>
(14:19:59) ERROR: <path>/bazel-cpp-example/BUILD:1:10: While resolving toolchains for target //:srcs: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@myplatforms//platform': The repository '@myplatforms' could not be resolved: Repository '@myplatforms' is not defined
✅ So it seems I need to pass in the exact module name with version:
bazelisk build //... --platforms @myplatforms.1.0.0-alpha.1//platform:<myplatform>
(14:21:00) INFO: Build completed successfully, 1 total action
It would be a nice quality of life feature if it wasn't needed to specify the full . string for the platforms module since it is already declared in MODULE.bazel.
Bazel SHA: eeec121
Also tried with 5.0.0
Feature requests: what underlying problem are you trying to solve with this feature?
Automatically resolve repositories for external platforms.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
To reproduce you will need to self host a registry with a module containing the platform you would like to use. Then declare that module in your project and try to pass it to the build as shown in the description above.
What operating system are you running Bazel on?
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
What's the output of bazel info release?
If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.
NA
Have you found anything relevant by searching the web?
I have not managed to find examples of builds using platforms from modules. Maybe that would be a useful addition.
Description of the problem / feature request:
Hello, I am currently working on a Bazel module to store platforms used by our project. I import these using
And in my example binary I have something like:
✅ I can build all targets in the platform module:
✅ I can also build all targets in the project:
✅ So it seems I need to pass in the exact module name with version:
It would be a nice quality of life feature if it wasn't needed to specify the full . string for the platforms module since it is already declared in MODULE.bazel.
Bazel SHA: eeec121
Also tried with 5.0.0
Feature requests: what underlying problem are you trying to solve with this feature?
Automatically resolve repositories for external platforms.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
To reproduce you will need to self host a registry with a module containing the platform you would like to use. Then declare that module in your project and try to pass it to the build as shown in the description above.
What operating system are you running Bazel on?
What's the output of
bazel info release?If
bazel info releasereturns "development version" or "(@Non-Git)", tell us how you built Bazel.NA
Have you found anything relevant by searching the web?
I have not managed to find examples of builds using platforms from modules. Maybe that would be a useful addition.