Skip to content

Commit

Permalink
[DRAFT] use plus
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyverald committed Jul 29, 2024
1 parent 9fbf427 commit 0e9c0a5
Show file tree
Hide file tree
Showing 86 changed files with 1,002 additions and 1,107 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ pkg_tar(
srcs = ["@maven//:srcs"] + ["MAVEN_CANONICAL_REPO_NAME"],
package_dir = "derived/maven",
remap_paths = {
"external/" + get_canonical_repo_name("@maven") + "/": "",
"../" + get_canonical_repo_name("@maven") + "/": "",
"external/" + get_canonical_repo_name("@maven").replace("+", "~") + "/": "",
"../" + get_canonical_repo_name("@maven").replace("+", "~") + "/": "",
},
strip_prefix = ".",
visibility = ["//:__subpackages__"],
Expand Down
18 changes: 9 additions & 9 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ DIST_ARCHIVE_REPOS = [get_canonical_repo_name(repo) for repo in [
"zstd-jni",
]] + [(get_canonical_repo_name("com_github_grpc_grpc") + suffix) for suffix in [
# Extra grpc dependencies introduced via its module extension
"~grpc_repo_deps_ext~bazel_gazelle", # TODO: Should be a bazel_dep
"~grpc_repo_deps_ext~bazel_skylib", # TODO: Should be removed
"~grpc_repo_deps_ext~com_envoyproxy_protoc_gen_validate",
"~grpc_repo_deps_ext~com_github_cncf_udpa",
"~grpc_repo_deps_ext~com_google_googleapis",
"~grpc_repo_deps_ext~envoy_api",
"~grpc_repo_deps_ext~rules_cc", # TODO: Should be removed
"+grpc_repo_deps_ext+bazel_gazelle", # TODO: Should be a bazel_dep
"+grpc_repo_deps_ext+bazel_skylib", # TODO: Should be removed
"+grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate",
"+grpc_repo_deps_ext+com_github_cncf_udpa",
"+grpc_repo_deps_ext+com_google_googleapis",
"+grpc_repo_deps_ext+envoy_api",
"+grpc_repo_deps_ext+rules_cc", # TODO: Should be removed
]] + [
# TODO(pcloudy): Remove after https://github.com/bazelbuild/rules_kotlin/issues/1106 is fixed
get_canonical_repo_name("rules_kotlin") + "~rules_kotlin_extensions~com_github_jetbrains_kotlin",
] + ["bazel_features~"]
get_canonical_repo_name("rules_kotlin") + "+rules_kotlin_extensions+com_github_jetbrains_kotlin",
] + ["bazel_features+"]

##################################################################################
#
Expand Down
26 changes: 13 additions & 13 deletions scripts/bazel_lockfile_merge_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function test_synthetic_merge() {
"envVariables": {},
"generatedRepoSpecs": {
"rbe_ubuntu2004": {
"bzlFile": "@@_main~bazel_test_deps~bazelci_rules//:rbe_repo.bzl",
"bzlFile": "@@+bazel_test_deps+bazelci_rules//:rbe_repo.bzl",
"ruleClassName": "rbe_preconfig",
"attributes": {
"toolchain": "ubuntu2004"
Expand All @@ -77,12 +77,12 @@ function test_synthetic_merge() {
[
"",
"bazelci_rules",
"_main~bazel_test_deps~bazelci_rules"
"+bazel_test_deps+bazelci_rules"
]
]
}
},
"@@rules_python~//python/extensions:python.bzl%python": {
"@@rules_python+//python/extensions:python.bzl%python": {
"general": {
"repo1": "old_args"
}
Expand All @@ -102,12 +102,12 @@ EOF
"[email protected]": "also dubious"
},
"moduleExtensions": {
"@@rules_python~//python/extensions:python.bzl%python": {
"@@rules_python+//python/extensions:python.bzl%python": {
"general": {
"repo1": "new_args"
}
},
"@@rules_python~//python/extensions/private:internal_deps.bzl%internal_deps": {
"@@rules_python+//python/extensions/private:internal_deps.bzl%internal_deps": {
"os:linux,arch:aarch64": {
"repo2": "aarch64_args"
}
Expand Down Expand Up @@ -135,7 +135,7 @@ EOF
"envVariables": {},
"generatedRepoSpecs": {
"rbe_ubuntu2004": {
"bzlFile": "@@_main~bazel_test_deps~bazelci_rules//:rbe_repo.bzl",
"bzlFile": "@@+bazel_test_deps+bazelci_rules//:rbe_repo.bzl",
"ruleClassName": "rbe_preconfig",
"attributes": {
"toolchain": "ubuntu2004"
Expand All @@ -146,17 +146,17 @@ EOF
[
"",
"bazelci_rules",
"_main~bazel_test_deps~bazelci_rules"
"+bazel_test_deps+bazelci_rules"
]
]
}
},
"@@rules_python~//python/extensions:python.bzl%python": {
"@@rules_python+//python/extensions:python.bzl%python": {
"general": {
"repo1": "old_args"
}
},
"@@rules_python~//python/extensions/private:internal_deps.bzl%internal_deps": {
"@@rules_python+//python/extensions/private:internal_deps.bzl%internal_deps": {
"os:linux,arch:amd64": {
"repo2": "amd64_args"
}
Expand Down Expand Up @@ -186,7 +186,7 @@ EOF
"envVariables": {},
"generatedRepoSpecs": {
"rbe_ubuntu2004": {
"bzlFile": "@@_main~bazel_test_deps~bazelci_rules//:rbe_repo.bzl",
"bzlFile": "@@+bazel_test_deps+bazelci_rules//:rbe_repo.bzl",
"ruleClassName": "rbe_preconfig",
"attributes": {
"toolchain": "ubuntu2004"
Expand All @@ -197,17 +197,17 @@ EOF
[
"",
"bazelci_rules",
"_main~bazel_test_deps~bazelci_rules"
"+bazel_test_deps+bazelci_rules"
]
]
}
},
"@@rules_python~//python/extensions:python.bzl%python": {
"@@rules_python+//python/extensions:python.bzl%python": {
"general": {
"repo1": "new_args"
}
},
"@@rules_python~//python/extensions/private:internal_deps.bzl%internal_deps": {
"@@rules_python+//python/extensions/private:internal_deps.bzl%internal_deps": {
"os:linux,arch:aarch64": {
"repo2": "aarch64_args"
},
Expand Down
4 changes: 0 additions & 4 deletions scripts/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ _BAZEL_ARGS="--spawn_strategy=standalone \

cp scripts/bootstrap/BUILD.bootstrap scripts/bootstrap/BUILD

# Remove lines containing 'install_deps' to avoid loading @bazel_pip_dev_deps,
# which requires fetching the python toolchain.
sed -i.bak '/install_deps/d' WORKSPACE && rm WORKSPACE.bak

if [ -z "${BAZEL-}" ]; then
function _run_bootstrapping_bazel() {
local command=$1
Expand Down
2 changes: 1 addition & 1 deletion site/en/concepts/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ the workspace. Labels with canonical repo names unambiguously identify a target
no matter which context they appear in.

Often the canonical repo name is an arcane string that looks like
`@@rules_java~7.1.0~toolchains~local_jdk`. What is much more commonly seen is
`@@rules_java++toolchains+local_jdk`. What is much more commonly seen is
labels with an [*apparent* repo name](/external/overview#apparent-repo-name),
which looks like:

Expand Down
8 changes: 3 additions & 5 deletions site/en/external/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ module extension from one single `.bzl` file.
## Repository names and visibility

Repos generated by extensions have canonical names in the form of `{{ "<var>"
}}module_repo_canonical_name{{ "</var>" }}~{{ "<var>" }}extension_name{{
"</var>" }}~{{ "<var>" }}repo_name{{ "</var>" }}`. For extensions hosted in the
root module, the `{{ "<var>" }}module_repo_canonical_name{{ "</var>" }}` part is
replaced with the string `_main`. Note that the canonical name format is not an
API you should depend on — it's subject to change at any time.
}}module_repo_canonical_name{{ "</var>" }}+{{ "<var>" }}extension_name{{
"</var>" }}+{{ "<var>" }}repo_name{{ "</var>" }}`. Note that the canonical name
format is not an API you should depend on — it's subject to change at any time.

This naming policy means that each extension has its own "repo namespace"; two
distinct extensions can each define a repo with the same name without risking
Expand Down
8 changes: 4 additions & 4 deletions site/en/external/mod-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ use_repo(toolchains, my_jdk="remotejdk17_linux")
## [email protected]:
# <builtin>
http_archive(
name = "rules_cc~",
name = "rules_cc+",
urls = ["https://bcr.bazel.build/test-mirror/github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz", "https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz"],
integrity = "sha256-Tcy/0iwN7xZMj0dFi9UODHFI89kgAs20WcKpamhJgkE=",
strip_prefix = "",
Expand All @@ -408,7 +408,7 @@ use_repo(toolchains, my_jdk="remotejdk17_linux")
## stardoc:
# <builtin>
http_archive(
name = "stardoc~",
name = "stardoc+",
urls = ["https://bcr.bazel.build/test-mirror/github.com/bazelbuild/stardoc/releases/download/0.5.0/stardoc-0.5.0.tar.gz", "https://github.com/bazelbuild/stardoc/releases/download/0.5.0/stardoc-0.5.0.tar.gz"],
integrity = "sha256-yXlNzIAmow/2fPfPkeviRcopSyCwcYRdEsGSr+JDrXI=",
strip_prefix = "",
Expand Down Expand Up @@ -443,7 +443,7 @@ use_repo(toolchains, my_jdk="remotejdk17_linux")
imported from some specific extension as part of the dependency graph.
```sh
bazel mod show_extension @@rules_java~5.0.0//java:extensions.bzl%toolchains
bazel mod show_extension @@rules_java+5.0.0//java:extensions.bzl%toolchains
```
```none
Expand Down Expand Up @@ -538,7 +538,7 @@ use_repo(toolchains, my_jdk="remotejdk17_linux")
## @remote_java_tools:
# <builtin>
http_archive(
name = "rules_java~~toolchains~remote_java_tools",
name = "rules_java++toolchains+remote_java_tools",
urls = ["https://mirror.bazel.build/bazel_java_tools/releases/java/v11.5/java_tools-v11.5.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.5/java_tools-v11.5.zip"],
sha256 = "b763ee80e5754e593fd6d5be6d7343f905bc8b73d661d36d842b024ca11b6793",
)
Expand Down
6 changes: 3 additions & 3 deletions site/en/external/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ dependencies. This helps prevent accidental breakages due to changes in
transitive dependencies.

The [canonical name](/external/overview#canonical-repo-name) of a repo backing a
module is either `{{ "<var>" }}module_name{{ "</var>" }}~{{ "<var>" }}version{{
"</var>" }}` (for example, `bazel_skylib~1.0.3`) or `{{ "<var>" }}module_name{{
"</var>" }}~` (for example, `bazel_features~`), depending on whether there are
module is either `{{ "<var>" }}module_name{{ "</var>" }}+{{ "<var>" }}version{{
"</var>" }}` (for example, `bazel_skylib+1.0.3`) or `{{ "<var>" }}module_name{{
"</var>" }}+` (for example, `bazel_features+`), depending on whether there are
multiple versions of the module in the entire dependency graph (see
[`multiple_version_override`](/rules/lib/globals/module#multiple_version_override)).
Note that **the canonical name format** is not an API you should depend on and
Expand Down
12 changes: 6 additions & 6 deletions site/en/external/vendor.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ bazel vendor --vendor_dir=vendor_src --repo=@rules_cc
or

```none
bazel vendor --vendor_dir=vendor_src --repo=@@rules_cc~
bazel vendor --vendor_dir=vendor_src --repo=@@rules_cc+
```

will both get rules_cc to be vendored under
`<workspace root>/vendor_src/rules_cc~`.
`<workspace root>/vendor_src/rules_cc+`.

## Vendor external dependencies for given targets {:#vendor-target-dependencies}

Expand Down Expand Up @@ -121,8 +121,8 @@ There are two directives available, both accepting a list of
For example

```python
ignore("@@rules_cc~")
pin("@@bazel_skylib~")
ignore("@@rules_cc+")
pin("@@bazel_skylib+")
```

With this configuration
Expand Down Expand Up @@ -186,13 +186,13 @@ strategy to rewrite symlinks in the vendored source:
For example, if the original symlink is

```none
<vendor_dir>/repo_foo~/link => $(bazel info output_base)/external/repo_bar~/file
<vendor_dir>/repo_foo+/link => $(bazel info output_base)/external/repo_bar+/file
```

It will be rewritten to

```none
<vendor_dir>/repo_foo~/link => ../../bazel-external/repo_bar~/file
<vendor_dir>/repo_foo+/link => ../../bazel-external/repo_bar+/file
```

where
Expand Down
2 changes: 1 addition & 1 deletion site/en/tutorials/ccp-toolchain-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Set up your build environment as follows:
```bash
bazel build //main:hello-world --toolchain_resolution_debug='@bazel_tools//tools/cpp:toolchain_type'

INFO: ToolchainResolution: Target platform @@local_config_platform//:host: Selected execution platform @@local_config_platform//:host, type @@bazel_tools//tools/cpp:toolchain_type -> toolchain @@bazel_tools~cc_configure_extension~local_config_cc//:cc-compiler-k8
INFO: ToolchainResolution: Target platform @@local_config_platform//:host: Selected execution platform @@local_config_platform//:host, type @@bazel_tools//tools/cpp:toolchain_type -> toolchain @@bazel_tools+cc_configure_extension+local_config_cc//:cc-compiler-k8
```

Without specifying `--platforms`, Bazel builds the target for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ java_library(
],
deps = [
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/packages/semantics",
"//src/main/java/net/starlark/java/eval",
"//third_party:auto_value",
"//third_party:gson",
Expand Down
Loading

0 comments on commit 0e9c0a5

Please sign in to comment.