moduleFilePaths =
Stream.concat(
@@ -554,17 +552,14 @@ private record GetModuleFileResult(
@Nullable
private GetModuleFileResult getModuleFile(
- ModuleKey key,
- @Nullable ModuleOverride override,
- StarlarkSemantics starlarkSemantics,
- Environment env)
+ ModuleKey key, @Nullable ModuleOverride override, Environment env)
throws ModuleFileFunctionException, InterruptedException {
// If there is a non-registry override for this module, we need to fetch the corresponding repo
// first and read the module file from there.
if (override instanceof NonRegistryOverride) {
// A module with a non-registry override always has a unique version across the entire dep
// graph.
- RepositoryName canonicalRepoName = key.getCanonicalRepoNameWithoutVersion(starlarkSemantics);
+ RepositoryName canonicalRepoName = key.getCanonicalRepoNameWithoutVersion();
RepositoryDirectoryValue repoDir =
(RepositoryDirectoryValue) env.getValue(RepositoryDirectoryValue.key(canonicalRepoName));
if (repoDir == null) {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleKey.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleKey.java
index c0ad725ffb67aa..681d9e3faae983 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleKey.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleKey.java
@@ -16,15 +16,12 @@
package com.google.devtools.build.lib.bazel.bzlmod;
import com.google.auto.value.AutoValue;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.cmdline.RepositoryName;
-import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions;
import java.util.Comparator;
import java.util.List;
-import net.starlark.java.eval.StarlarkSemantics;
/** A module name, version pair that identifies a module in the external dependency graph. */
@AutoValue
@@ -82,13 +79,8 @@ public final String toString() {
*
* This method must not be called if the module has a {@link NonRegistryOverride}.
*/
- public RepositoryName getCanonicalRepoNameWithVersion(StarlarkSemantics semantics) {
- return getCanonicalRepoName(/* includeVersion= */ true, semantics);
- }
-
- @VisibleForTesting
- public RepositoryName getCanonicalRepoNameWithVersionForTesting() {
- return getCanonicalRepoNameWithVersion(StarlarkSemantics.DEFAULT);
+ public RepositoryName getCanonicalRepoNameWithVersion() {
+ return getCanonicalRepoName(/* includeVersion= */ true);
}
/**
@@ -96,41 +88,32 @@ public RepositoryName getCanonicalRepoNameWithVersionForTesting() {
* only guaranteed to be unique when there is a single version of the module in the entire dep
* graph.
*/
- public RepositoryName getCanonicalRepoNameWithoutVersion(StarlarkSemantics semantics) {
- return getCanonicalRepoName(/* includeVersion= */ false, semantics);
- }
-
- @VisibleForTesting
- public RepositoryName getCanonicalRepoNameWithoutVersionForTesting() {
- return getCanonicalRepoNameWithoutVersion(StarlarkSemantics.DEFAULT);
+ public RepositoryName getCanonicalRepoNameWithoutVersion() {
+ return getCanonicalRepoName(/* includeVersion= */ false);
}
- private RepositoryName getCanonicalRepoName(boolean includeVersion, StarlarkSemantics semantics) {
+ private RepositoryName getCanonicalRepoName(boolean includeVersion) {
if (WELL_KNOWN_MODULES.containsKey(getName())) {
return WELL_KNOWN_MODULES.get(getName());
}
if (ROOT.equals(this)) {
return RepositoryName.MAIN;
}
- boolean usePlus = semantics.getBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES);
String suffix;
if (includeVersion) {
// getVersion().isEmpty() is true only for modules with non-registry overrides, which enforce
// that there is a single version of the module in the dep graph.
Preconditions.checkState(!getVersion().isEmpty());
- // When using `~` as the separator, prepend "v" to prevent canonical repo names, which form
- // segments of file paths, from looking like a Windows short path. Such paths segments would
- // incur additional file IO during analysis (see WindowsShortPath).
- suffix = usePlus ? getVersion().toString() : "v" + getVersion().toString();
+ suffix = getVersion().toString();
} else {
- // This results in canonical repository names such as `rules_foo~` for the module `rules_foo`.
+ // This results in canonical repository names such as `rules_foo+` for the module `rules_foo`.
// This particular format is chosen since:
- // * The tilde ensures that canonical and apparent repository names can be distinguished even
+ // * The plus ensures that canonical and apparent repository names can be distinguished even
// in contexts where users don't rely on `@` vs. `@@` to distinguish between them. For
// example, this means that the repo mapping as applied by runfiles libraries is idempotent.
- // * Appending a tilde even in the case of a unique version means that module repository
- // names always contain the same number of tilde-separated components, which improves
- // compatibility with existing logic based on the `rules_foo~1.2.3` format.
+ // * Appending a plus even in the case of a unique version means that module repository
+ // names always contain the same number of plus-separated components, which improves
+ // compatibility with existing logic based on the `rules_foo+1.2.3` format.
// * By making it so that the module name and the canonical repository name of a module are
// never identical, even when using an override, we introduce "grease" that intentionally
// tickles bugs in code that doesn't properly distinguish between the two, e.g., by not
@@ -139,8 +122,7 @@ private RepositoryName getCanonicalRepoName(boolean includeVersion, StarlarkSema
// rarely used.
suffix = "";
}
- return RepositoryName.createUnvalidated(
- String.format("%s%c%s", getName(), usePlus ? '+' : '~', suffix));
+ return RepositoryName.createUnvalidated(String.format("%s+%s", getName(), suffix));
}
public static ModuleKey fromString(String s) throws Version.ParseException {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
index 48fa81a9dd2f93..42498f523fa0fe 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java
@@ -44,7 +44,6 @@
import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.RuleFactory.InvalidRuleException;
-import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
import com.google.devtools.build.lib.profiler.SilentCloseable;
@@ -178,7 +177,6 @@ public SkyValue compute(SkyKey skyKey, Environment env)
extension,
usagesValue,
extension.getEvalFactors(),
- starlarkSemantics,
lockedExtension);
if (singleExtensionValue != null) {
return singleExtensionValue;
@@ -262,13 +260,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
lockFileInfo = Optional.empty();
}
return createSingleExtensionValue(
- generatedRepoSpecs,
- moduleExtensionMetadata,
- extensionId,
- usagesValue,
- lockFileInfo,
- starlarkSemantics,
- env);
+ generatedRepoSpecs, moduleExtensionMetadata, extensionId, usagesValue, lockFileInfo, env);
}
/**
@@ -285,7 +277,6 @@ private SingleExtensionValue tryGettingValueFromLockFile(
RunnableExtension extension,
SingleExtensionUsagesValue usagesValue,
ModuleExtensionEvalFactors evalFactors,
- StarlarkSemantics starlarkSemantics,
LockFileModuleExtension lockedExtension)
throws SingleExtensionEvalFunctionException,
InterruptedException,
@@ -346,7 +337,6 @@ private SingleExtensionValue tryGettingValueFromLockFile(
extensionId,
usagesValue,
Optional.of(new LockFileModuleExtension.WithFactors(evalFactors, lockedExtension)),
- starlarkSemantics,
env);
}
if (lockfileMode.equals(LockfileMode.ERROR)) {
@@ -461,7 +451,6 @@ private SingleExtensionValue createSingleExtensionValue(
ModuleExtensionId extensionId,
SingleExtensionUsagesValue usagesValue,
Optional lockFileInfo,
- StarlarkSemantics starlarkSemantics,
Environment env)
throws SingleExtensionEvalFunctionException {
Optional fixup = Optional.empty();
@@ -489,11 +478,6 @@ private SingleExtensionValue createSingleExtensionValue(
}
}
- char separator =
- starlarkSemantics.getBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES)
- ? '+'
- : '~';
-
return SingleExtensionValue.create(
generatedRepoSpecs,
generatedRepoSpecs.keySet().stream()
@@ -501,7 +485,7 @@ private SingleExtensionValue createSingleExtensionValue(
toImmutableBiMap(
e ->
RepositoryName.createUnvalidated(
- usagesValue.getExtensionUniqueName() + separator + e),
+ usagesValue.getExtensionUniqueName() + "+" + e),
Function.identity())),
lockFileInfo,
fixup);
@@ -759,11 +743,7 @@ public RunModuleExtensionResult run(
Dict kwargs = repo.tag().getAttributeValues().attributes();
// This cast should be safe since it should have been verified at tag creation time.
String name = (String) kwargs.get("name");
- char separator =
- starlarkSemantics.getBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES)
- ? '+'
- : '~';
- String prefixedName = usagesValue.getExtensionUniqueName() + separator + name;
+ String prefixedName = usagesValue.getExtensionUniqueName() + "+" + name;
Rule ruleInstance;
AttributeValues attributesValue;
try {
@@ -902,13 +882,9 @@ public RunModuleExtensionResult run(
ModuleExtensionId extensionId,
RepositoryMapping mainRepositoryMapping)
throws InterruptedException, SingleExtensionEvalFunctionException {
- char separator =
- starlarkSemantics.getBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES)
- ? '+'
- : '~';
ModuleExtensionEvalStarlarkThreadContext threadContext =
new ModuleExtensionEvalStarlarkThreadContext(
- usagesValue.getExtensionUniqueName() + separator,
+ usagesValue.getExtensionUniqueName() + "+",
extensionId.getBzlFileLabel().getPackageIdentifier(),
BazelModuleContext.of(bzlLoadValue.getModule()).repoMapping(),
mainRepositoryMapping,
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/Version.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/Version.java
index 42d44025679e40..fa9bb75e9c8c36 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/Version.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/Version.java
@@ -193,8 +193,7 @@ public final String toString() {
@Override
public final boolean equals(Object o) {
- return this == o
- || (o instanceof Version && ((Version) o).getNormalized().equals(getNormalized()));
+ return this == o || (o instanceof Version v && v.getNormalized().equals(getNormalized()));
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
index ff362b07b0e2f2..7529fc952e9239 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
@@ -577,6 +577,14 @@ public static final class AllCommandGraveyardOptions extends OptionsBase {
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
help = "No-op.")
public boolean incompatibleDepsetForJavaOutputSourceJars;
+
+ @Option(
+ name = "incompatible_use_plus_in_repo_names",
+ defaultValue = "true",
+ documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
+ effectTags = OptionEffectTag.LOADING_AND_ANALYSIS,
+ help = "No-op.")
+ public boolean incompatibleUsePlusInRepoNames;
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
index b126af928bdfb5..279c028f47b231 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
@@ -696,7 +696,7 @@ public void str(Printer printer, StarlarkSemantics semantics) {
if (semantics.getBool(BuildLanguageOptions.ENABLE_BZLMOD)) {
// If Bzlmod is enabled, we use canonical label literal syntax here and prepend an extra '@'.
- // So the result looks like "@@//foo:bar" for the main repo and "@@foo~1.0//bar:quux" for
+ // So the result looks like "@@//foo:bar" for the main repo and "@@foo+//bar:quux" for
// other repos.
printer.append(getUnambiguousCanonicalForm());
return;
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
index a10149c5b97384..af37200bff3387 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
@@ -224,7 +224,7 @@ public String getUnambiguousCanonicalForm() {
* @protobuf//some/pkg
* if this package lives in a repository with "protobuf" as name
of a
* repository in WORKSPACE or as apparent name of a Bzlmod dependency of the main module
- * @@protobuf~3.19.2//some/pkg
+ * @@protobuf+//some/pkg
* only with Bzlmod if the current package belongs to a repository that is not visible
* from the main module
*/
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
index 622e14179ba1e8..f4ae967ffd28fe 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
@@ -48,10 +48,7 @@ public final class RepositoryName {
@SerializationConstant public static final RepositoryName MAIN = new RepositoryName("");
- // Repository names must not start with a tilde as shells treat unescaped paths starting with them
- // specially.
- // https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html
- private static final Pattern VALID_REPO_NAME = Pattern.compile("|[\\w\\-.+][\\w\\-.~+]*");
+ private static final Pattern VALID_REPO_NAME = Pattern.compile("[\\w\\-.+]*");
// Must start with a letter. Can contain ASCII letters and digits, underscore, dash, and dot.
private static final Pattern VALID_USER_PROVIDED_NAME = Pattern.compile("[a-zA-Z][-.\\w]*$");
@@ -169,14 +166,14 @@ static void validate(String name) throws LabelSyntaxException {
if (!VALID_REPO_NAME.matcher(name).matches()) {
throw LabelParser.syntaxErrorf(
"invalid repository name '%s': repo names may contain only A-Z, a-z, 0-9, '-', '_', '.'"
- + " and '~' and must not start with '~'",
+ + " and '+'",
StringUtilities.sanitizeControlChars(name));
}
}
/**
* Validates a repo name provided by the user. Such names have tighter restrictions; for example,
- * they can only start with a letter, and cannot contain a tilde (~).
+ * they can only start with a letter, and cannot contain a plus (+).
*/
public static void validateUserProvidedRepoName(String name) throws EvalException {
if (!VALID_USER_PROVIDED_NAME.matcher(name).matches()) {
@@ -228,12 +225,11 @@ public String getOwnerModuleDisplayString() {
if (ownerRepoIfNotVisible.isMain()) {
return "root module";
} else {
- boolean hasTilde = ownerRepoIfNotVisible.getName().contains("~");
return String.format(
"module '%s'",
ownerRepoIfNotVisible
.getName()
- .substring(0, ownerRepoIfNotVisible.getName().indexOf(hasTilde ? '~' : '+')));
+ .substring(0, ownerRepoIfNotVisible.getName().indexOf('+')));
}
}
@@ -278,7 +274,7 @@ public String getCanonicalForm() {
* if this repository is a WORKSPACE dependency and its name
is "protobuf",
* or if this repository is a Bzlmod dependency of the main module and its apparent name
* is "protobuf" (in both cases only if mainRepositoryMapping is not null)
- * @@protobuf~3.19.2
+ * @@protobuf+
* only with Bzlmod, if this a repository that is not visible from the main module
*/
public String getDisplayForm(@Nullable RepositoryMapping mainRepositoryMapping) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java b/src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java
index aeca3326c75164..b2042a6bd95cd8 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java
@@ -216,17 +216,6 @@ public final class BuildLanguageOptions extends OptionsBase {
+ " https://bazel.build/external/overview for more information.")
public boolean enableWorkspace;
- @Option(
- name = "incompatible_use_plus_in_repo_names",
- defaultValue = "false",
- documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
- effectTags = OptionEffectTag.LOADING_AND_ANALYSIS,
- help =
- "If true, uses the plus sign (+) as the separator in canonical repo names, instead of the"
- + " tilde (~). This is to address severe performance issues on Windows; see"
- + " https://github.com/bazelbuild/bazel/issues/22865 for more information.")
- public boolean incompatibleUsePlusInRepoNames;
-
@Option(
name = "experimental_isolated_extension_usages",
defaultValue = "false",
@@ -759,7 +748,6 @@ public StarlarkSemantics toStarlarkSemantics() {
.setBool(EXPERIMENTAL_ENABLE_SCL_DIALECT, experimentalEnableSclDialect)
.setBool(ENABLE_BZLMOD, enableBzlmod)
.setBool(ENABLE_WORKSPACE, enableWorkspace)
- .setBool(INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES, incompatibleUsePlusInRepoNames)
.setBool(EXPERIMENTAL_ISOLATED_EXTENSION_USAGES, experimentalIsolatedExtensionUsages)
.setBool(
INCOMPATIBLE_EXISTING_RULES_IMMUTABLE_VIEW, incompatibleExistingRulesImmutableView)
@@ -868,8 +856,6 @@ public StarlarkSemantics toStarlarkSemantics() {
public static final String EXPERIMENTAL_ENABLE_SCL_DIALECT = "-experimental_enable_scl_dialect";
public static final String ENABLE_BZLMOD = "+enable_bzlmod";
public static final String ENABLE_WORKSPACE = "+enable_workspace";
- public static final String INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES =
- "-incompatible_use_plus_in_repo_names";
public static final String EXPERIMENTAL_ISOLATED_EXTENSION_USAGES =
"-experimental_isolated_extension_usages";
public static final String INCOMPATIBLE_EXISTING_RULES_IMMUTABLE_VIEW =
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java
index 4b2d97b1303e0a..235bb3c8898d27 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java
@@ -39,7 +39,6 @@
import com.google.devtools.build.lib.packages.RuleClassProvider;
import com.google.devtools.build.lib.packages.RuleFactory.InvalidRuleException;
import com.google.devtools.build.lib.packages.RuleFunction;
-import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions;
import com.google.devtools.build.lib.server.FailureDetails.PackageLoading;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.skyframe.SkyFunction;
@@ -114,13 +113,9 @@ public SkyValue compute(SkyKey skyKey, Environment env)
}
// Step 3: look for the repo from module extension evaluation results.
- char separator =
- starlarkSemantics.getBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES)
- ? '+'
- : '~';
Optional extensionId =
bazelDepGraphValue.getExtensionUniqueNames().entrySet().stream()
- .filter(e -> repositoryName.getName().startsWith(e.getValue() + separator))
+ .filter(e -> repositoryName.getName().startsWith(e.getValue() + "+"))
.map(Entry::getKey)
.findFirst();
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunction.java
index 2cfd3319b7ee34..cfb051c8d15829 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunction.java
@@ -233,11 +233,7 @@ private RepositoryMappingValue computeFromWorkspace(
private static Optional maybeGetModuleExtensionForRepo(
RepositoryName repositoryName, BazelDepGraphValue bazelDepGraphValue) {
return bazelDepGraphValue.getExtensionUniqueNames().entrySet().stream()
- .filter(
- e ->
- repositoryName
- .getName()
- .startsWith(e.getValue() + bazelDepGraphValue.getRepoNameSeparator()))
+ .filter(e -> repositoryName.getName().startsWith(e.getValue() + "+"))
.map(Entry::getKey)
.findFirst();
}
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/CommandLineArgsApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/CommandLineArgsApi.java
index b46b8e89ae3cfa..54dcb25c8b66e4 100644
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/CommandLineArgsApi.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/CommandLineArgsApi.java
@@ -73,7 +73,7 @@
+ " makes this representation suited for use in BUILD files. While the exact form of"
+ " the representation is not guaranteed, typical examples are"
+ " //foo:bar
, @repo//foo:bar
and"
- + " @@canonical_name~//foo:bar.bzl
."
+ + " @@canonical_name+//foo:bar.bzl
."
+ "All other types are turned into strings in an unspecified manner. For "
+ " this reason, you should avoid passing values that are not of string or "
+ " File
type to add()
, and if you pass them to "
diff --git a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test
index 62a4f27cc503f0..e4e9ee1bc729de 100644
--- a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test
+++ b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test
@@ -559,7 +559,7 @@ exports_test(
target = "external_export_so",
bazel_only = True,
targets_that_should_be_claimed_to_be_exported = [
- "@@test_repo~//:bar",
+ "@@test_repo+//:bar",
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:external_export",
],
)
diff --git a/src/package-bazel.sh b/src/package-bazel.sh
index 5b1441fa880d45..32b762f6985244 100755
--- a/src/package-bazel.sh
+++ b/src/package-bazel.sh
@@ -76,18 +76,18 @@ fi
(
cd $PACKAGE_DIR
tar -xf $WORKDIR/$PLATFORMS_ARCHIVE -C .
- # Rename "platforms~" to "platforms" in case of Bzlmod is enabled.
- if [[ $(find . -maxdepth 1 -type d -name "platforms~*" | wc -l) -eq 1 ]]; then
- mv platforms~* platforms
- fi
+ # "platforms" is a well-known module, so no need to tamper with anything here.
)
(
cd $PACKAGE_DIR
tar -xf $WORKDIR/$RULES_JAVA_ARCHIVE -C .
- # Rename "rules_java~" to "rules_java" in case of Bzlmod is enabled.
- if [[ $(find . -maxdepth 1 -type d -name "rules_java~*" | wc -l) -eq 1 ]]; then
- mv rules_java~* rules_java
+ # Rename "rules_java~" or "rules_java+" to "rules_java".
+ if [[ -d rules_java~ ]]; then
+ mv rules_java~ rules_java
+ fi
+ if [[ -d rules_java+ ]]; then
+ mv rules_java+ rules_java
fi
)
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesRepoMappingManifestTest.java b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesRepoMappingManifestTest.java
index bea52725f0e25a..79697cf34487f6 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesRepoMappingManifestTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesRepoMappingManifestTest.java
@@ -54,9 +54,9 @@ protected SkyframeExecutorRepositoryHelpersHolder getRepositoryHelpersHolder() {
public void setupBareBinaryRule() throws Exception {
registry.addModule(
createModuleKey("bare_rule", "1.0"), "module(name='bare_rule',version='1.0')");
- scratch.overwriteFile(moduleRoot.getRelative("bare_rule~v1.0/WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("bare_rule+1.0/WORKSPACE").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("bare_rule~v1.0/defs.bzl").getPathString(),
+ moduleRoot.getRelative("bare_rule+1.0/defs.bzl").getPathString(),
"def _bare_binary_impl(ctx):",
" exe = ctx.actions.declare_file(ctx.label.name)",
" ctx.actions.write(exe, 'i got nothing', True)",
@@ -70,7 +70,7 @@ public void setupBareBinaryRule() throws Exception {
" executable=True,",
")");
scratch.overwriteFile(
- moduleRoot.getRelative("bare_rule~v1.0/BUILD").getPathString(),
+ moduleRoot.getRelative("bare_rule+1.0/BUILD").getPathString(),
"load('//:defs.bzl', 'bare_binary')",
"bare_binary(name='bare_binary')");
}
@@ -131,10 +131,10 @@ public void diamond() throws Exception {
"bare_binary(name='aaa',data=['@bbb'])");
ImmutableMap buildFiles =
ImmutableMap.of(
- "bbb~v1.0", "bare_binary(name='bbb',data=['@ddd'])",
- "ccc~v2.0", "bare_binary(name='ccc',data=['@ddd'])",
- "ddd~v1.0", "bare_binary(name='ddd')",
- "ddd~v2.0", "bare_binary(name='ddd')");
+ "bbb+1.0", "bare_binary(name='bbb',data=['@ddd'])",
+ "ccc+2.0", "bare_binary(name='ccc',data=['@ddd'])",
+ "ddd+1.0", "bare_binary(name='ddd')",
+ "ddd+2.0", "bare_binary(name='ddd')");
for (Entry entry : buildFiles.entrySet()) {
scratch.overwriteFile(
moduleRoot.getRelative(entry.getKey()).getRelative("WORKSPACE").getPathString());
@@ -151,13 +151,13 @@ public void diamond() throws Exception {
.containsExactly(
",aaa," + getRuleClassProvider().getRunfilesPrefix(),
",aaa_ws," + getRuleClassProvider().getRunfilesPrefix(),
- ",bbb,bbb~",
- "bbb~,bbb,bbb~",
- "bbb~,ddd,ddd~",
- "ddd~,ddd,ddd~")
+ ",bbb,bbb+",
+ "bbb+,bbb,bbb+",
+ "bbb+,ddd,ddd+",
+ "ddd+,ddd,ddd+")
.inOrder();
- assertThat(getRepoMappingManifestForTarget("@@ccc~//:ccc"))
- .containsExactly("ccc~,ccc,ccc~", "ccc~,ddd,ddd~", "ddd~,ddd,ddd~")
+ assertThat(getRepoMappingManifestForTarget("@@ccc+//:ccc"))
+ .containsExactly("ccc+,ccc,ccc+", "ccc+,ddd,ddd+", "ddd+,ddd,ddd+")
.inOrder();
}
@@ -173,9 +173,9 @@ public void runfilesFromToolchain() throws Exception {
"module(name='tooled_rule',version='1.0')",
"bazel_dep(name='bare_rule',version='1.0')",
"register_toolchains('//:all')");
- scratch.overwriteFile(moduleRoot.getRelative("tooled_rule~v1.0/WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("tooled_rule+1.0/WORKSPACE").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("tooled_rule~v1.0/defs.bzl").getPathString(),
+ moduleRoot.getRelative("tooled_rule+1.0/defs.bzl").getPathString(),
"def _tooled_binary_impl(ctx):",
" exe = ctx.actions.declare_file(ctx.label.name)",
" ctx.actions.write(exe, 'i got something', True)",
@@ -204,7 +204,7 @@ public void runfilesFromToolchain() throws Exception {
" toolchain_type=Label('//:toolchain_type'),",
" )");
scratch.overwriteFile(
- moduleRoot.getRelative("tooled_rule~v1.0/BUILD").getPathString(),
+ moduleRoot.getRelative("tooled_rule+1.0/BUILD").getPathString(),
"load('//:defs.bzl', 'tooled_toolchain')",
"toolchain_type(name='toolchain_type')",
"tooled_toolchain(name='tooled_toolchain', backing_binary='@bare_rule//:bare_binary')");
@@ -220,8 +220,8 @@ public void runfilesFromToolchain() throws Exception {
assertThat(getRepoMappingManifestForTarget("//:tooled"))
.containsExactly(
",main," + getRuleClassProvider().getRunfilesPrefix(),
- "bare_rule~,bare_rule,bare_rule~",
- "tooled_rule~,bare_rule,bare_rule~")
+ "bare_rule+,bare_rule,bare_rule+",
+ "tooled_rule+,bare_rule,bare_rule+")
.inOrder();
}
@@ -283,10 +283,10 @@ public void actionRerunsOnRepoMappingChange_newEntry() throws Exception {
"module(name='bbb',version='1.0')",
"bazel_dep(name='bare_rule',version='1.0')");
scratch.overwriteFile(
- moduleRoot.getRelative("bbb~v1.0").getRelative("WORKSPACE").getPathString());
- scratch.overwriteFile(moduleRoot.getRelative("bbb~v1.0").getRelative("BUILD").getPathString());
+ moduleRoot.getRelative("bbb+1.0").getRelative("WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("bbb+1.0").getRelative("BUILD").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("bbb~v1.0").getRelative("def.bzl").getPathString(), "BBB = '1'");
+ moduleRoot.getRelative("bbb+1.0").getRelative("def.bzl").getPathString(), "BBB = '1'");
invalidatePackages();
RepoMappingManifestAction actionBeforeChange = getRepoMappingManifestActionForTarget("//:aaa");
@@ -321,9 +321,9 @@ public void hasMappingForSymlinks() throws Exception {
"bazel_dep(name='my_module',version='1.0')",
"bazel_dep(name='bare_rule',version='1.0')",
"bazel_dep(name='symlinks',version='1.0')");
- scratch.overwriteFile(moduleRoot.getRelative("aaa~v1.0/WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("aaa+1.0/WORKSPACE").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("aaa~v1.0/BUILD").getPathString(),
+ moduleRoot.getRelative("aaa+1.0/BUILD").getPathString(),
"load('@bare_rule//:defs.bzl', 'bare_binary')",
"bare_binary(name='aaa',data=['@symlinks'])");
@@ -331,9 +331,9 @@ public void hasMappingForSymlinks() throws Exception {
createModuleKey("symlinks", "1.0"),
"module(name='symlinks',version='1.0')",
"bazel_dep(name='ddd',version='1.0')");
- scratch.overwriteFile(moduleRoot.getRelative("symlinks~v1.0/WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("symlinks+1.0/WORKSPACE").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("symlinks~v1.0/defs.bzl").getPathString(),
+ moduleRoot.getRelative("symlinks+1.0/defs.bzl").getPathString(),
"def _symlinks_impl(ctx):",
" runfiles = ctx.runfiles(",
" symlinks = {'path/to/pkg/symlink': ctx.file.data},",
@@ -346,7 +346,7 @@ public void hasMappingForSymlinks() throws Exception {
" attrs={'data':attr.label(allow_single_file=True)},",
")");
scratch.overwriteFile(
- moduleRoot.getRelative("symlinks~v1.0/BUILD").getPathString(),
+ moduleRoot.getRelative("symlinks+1.0/BUILD").getPathString(),
"load('//:defs.bzl', 'symlinks')",
"symlinks(name='symlinks',data='@ddd')");
@@ -354,14 +354,14 @@ public void hasMappingForSymlinks() throws Exception {
createModuleKey("ddd", "1.0"),
"module(name='ddd',version='1.0')",
"bazel_dep(name='bare_rule',version='1.0')");
- scratch.overwriteFile(moduleRoot.getRelative("ddd~v1.0/WORKSPACE").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("ddd+1.0/WORKSPACE").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("ddd~v1.0/BUILD").getPathString(),
+ moduleRoot.getRelative("ddd+1.0/BUILD").getPathString(),
"load('@bare_rule//:defs.bzl', 'bare_binary')",
"bare_binary(name='ddd')");
invalidatePackages();
- RunfilesSupport runfilesSupport = getRunfilesSupport("@aaa~//:aaa");
+ RunfilesSupport runfilesSupport = getRunfilesSupport("@aaa+//:aaa");
ImmutableList runfilesPaths =
runfilesSupport
.getRunfiles()
@@ -372,21 +372,21 @@ public void hasMappingForSymlinks() throws Exception {
.collect(toImmutableList());
assertThat(runfilesPaths)
.containsAtLeast(
- "aaa~/aaa",
+ "aaa+/aaa",
getRuleClassProvider().getRunfilesPrefix() + "/path/to/pkg/symlink",
- "symlinks~/path/to/pkg/root_symlink",
+ "symlinks+/path/to/pkg/root_symlink",
"_repo_mapping");
- assertThat(getRepoMappingManifestForTarget("@aaa~//:aaa"))
+ assertThat(getRepoMappingManifestForTarget("@aaa+//:aaa"))
.containsExactly(
- // @aaa~ contributes the top-level executable to runfiles.
- "aaa~,aaa,aaa~",
+ // @aaa+ contributes the top-level executable to runfiles.
+ "aaa+,aaa,aaa+",
// The symlink is staged under the main repository's runfiles directory and aaa has a
// repo mapping entry for it.
- "aaa~,my_module," + getRuleClassProvider().getRunfilesPrefix(),
- // @symlinks~ appears as the first segment of a root symlink.
- "aaa~,symlinks,symlinks~",
- "symlinks~,symlinks,symlinks~")
+ "aaa+,my_module," + getRuleClassProvider().getRunfilesPrefix(),
+ // @symlinks+ appears as the first segment of a root symlink.
+ "aaa+,symlinks,symlinks+",
+ "symlinks+,symlinks,symlinks+")
.inOrder();
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleTransitionProviderTest.java b/src/test/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleTransitionProviderTest.java
index 23be369d351599..f6b083c41a33a0 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleTransitionProviderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleTransitionProviderTest.java
@@ -1534,10 +1534,10 @@ public void successfulTypeConversionOfNativeListOption_unambiguousLabels() throw
scratch.overwriteFile("MODULE.bazel", "bazel_dep(name='rules_x',version='1.0')");
registry.addModule(createModuleKey("rules_x", "1.0"), "module(name='rules_x', version='1.0')");
- scratch.file("modules/rules_x~v1.0/WORKSPACE");
- scratch.file("modules/rules_x~v1.0/BUILD");
+ scratch.file("modules/rules_x+1.0/WORKSPACE");
+ scratch.file("modules/rules_x+1.0/BUILD");
scratch.file(
- "modules/rules_x~v1.0/defs.bzl",
+ "modules/rules_x+1.0/defs.bzl",
"""
def _tr_impl(settings, attr):
return {"//command_line_option:platforms": [Label("@@//test:my_platform")]}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelDepGraphFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelDepGraphFunctionTest.java
index b1ff500c1c4906..1a7079b293a48c 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelDepGraphFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelDepGraphFunctionTest.java
@@ -197,13 +197,13 @@ public void createValue_basic() throws Exception {
.containsExactly(
RepositoryName.MAIN,
ModuleKey.ROOT,
- RepositoryName.create("dep~v1.0"),
+ RepositoryName.create("dep+1.0"),
createModuleKey("dep", "1.0"),
- RepositoryName.create("dep~v2.0"),
+ RepositoryName.create("dep+2.0"),
createModuleKey("dep", "2.0"),
- RepositoryName.create("rules_cc~"),
+ RepositoryName.create("rules_cc+"),
createModuleKey("rules_cc", "1.0"),
- RepositoryName.create("rules_java~"),
+ RepositoryName.create("rules_java+"),
createModuleKey("rules_java", ""));
assertThat(value.getAbridgedModules())
.containsExactlyElementsIn(
@@ -270,16 +270,16 @@ public void createValue_moduleExtensions() throws Exception {
ModuleExtensionId maven =
ModuleExtensionId.create(
- Label.parseCanonical("@@rules_jvm_external~//:defs.bzl"), "maven", Optional.empty());
+ Label.parseCanonical("@@rules_jvm_external+//:defs.bzl"), "maven", Optional.empty());
ModuleExtensionId pip =
ModuleExtensionId.create(
- Label.parseCanonical("@@rules_python~//:defs.bzl"), "pip", Optional.empty());
+ Label.parseCanonical("@@rules_python+//:defs.bzl"), "pip", Optional.empty());
ModuleExtensionId myext =
ModuleExtensionId.create(
- Label.parseCanonical("@@dep~//:defs.bzl"), "myext", Optional.empty());
+ Label.parseCanonical("@@dep+//:defs.bzl"), "myext", Optional.empty());
ModuleExtensionId myext2 =
ModuleExtensionId.create(
- Label.parseCanonical("@@dep~//incredible:conflict.bzl"), "myext", Optional.empty());
+ Label.parseCanonical("@@dep+//incredible:conflict.bzl"), "myext", Optional.empty());
resolutionFunctionMock.setDepGraph(depGraph);
EvaluationResult result =
@@ -303,10 +303,10 @@ public void createValue_moduleExtensions() throws Exception {
assertThat(value.getExtensionUniqueNames())
.containsExactly(
- maven, "rules_jvm_external~~maven",
- pip, "rules_python~~pip",
- myext, "dep~~myext",
- myext2, "dep~~myext2");
+ maven, "rules_jvm_external++maven",
+ pip, "rules_python++pip",
+ myext, "dep++myext",
+ myext2, "dep++myext2");
assertThat(value.getFullRepoMapping(ModuleKey.ROOT))
.isEqualTo(
@@ -317,27 +317,27 @@ public void createValue_moduleExtensions() throws Exception {
"root",
"",
"rje",
- "rules_jvm_external~",
+ "rules_jvm_external+",
"rpy",
- "rules_python~",
+ "rules_python+",
"av",
- "rules_jvm_external~~maven~autovalue",
+ "rules_jvm_external++maven+autovalue",
"numpy",
- "rules_python~~pip~numpy"));
+ "rules_python++pip+numpy"));
assertThat(value.getFullRepoMapping(depKey))
.isEqualTo(
createRepositoryMapping(
depKey,
"dep",
- "dep~",
+ "dep+",
"rules_python",
- "rules_python~",
+ "rules_python+",
"np",
- "rules_python~~pip~numpy",
+ "rules_python++pip+numpy",
"oneext",
- "dep~~myext~myext",
+ "dep++myext+myext",
"twoext",
- "dep~~myext2~myext"));
+ "dep++myext2+myext"));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
index ab04bb4c29cf10..1724097f80abdd 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionFunctionTest.java
@@ -381,13 +381,13 @@ public void testYankedVersionCheckIgnoredBySpecific() throws Exception {
@Test
public void testBadYankedVersionFormat() throws Exception {
setupModulesForYankedVersion();
- YankedVersionsUtil.ALLOWED_YANKED_VERSIONS.set(differencer, ImmutableList.of("b~1.0"));
+ YankedVersionsUtil.ALLOWED_YANKED_VERSIONS.set(differencer, ImmutableList.of("b+1.0"));
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(BazelModuleResolutionValue.KEY), evaluationContext);
assertThat(result.hasError()).isTrue();
assertThat(result.getError().toString())
.contains(
- "Parsing command line flag --allow_yanked_versions=b~1.0 failed, module versions must"
+ "Parsing command line flag --allow_yanked_versions=b+1.0 failed, module versions must"
+ " be of the form '@'");
}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
index 763eeec7b74044..01b8e604f76fc8 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodRepoRuleFunctionTest.java
@@ -178,7 +178,7 @@ public void testRepoSpec_bazelModule() throws Exception {
.addModule(createModuleKey("ccc", "2.0"), "module(name='ccc', version='2.0')");
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of(registry.getUrl()));
- RepositoryName repo = RepositoryName.create("ccc~");
+ RepositoryName repo = RepositoryName.create("ccc+");
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(BzlmodRepoRuleValue.key(repo)), evaluationContext);
if (result.hasError()) {
@@ -189,8 +189,8 @@ public void testRepoSpec_bazelModule() throws Exception {
assertThat(repoRule.getRuleClassObject().isStarlark()).isFalse();
assertThat(repoRule.getRuleClass()).isEqualTo("local_repository");
- assertThat(repoRule.getName()).isEqualTo("ccc~");
- assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ccc~v2.0");
+ assertThat(repoRule.getName()).isEqualTo("ccc+");
+ assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ccc+2.0");
}
@Test
@@ -209,7 +209,7 @@ public void testRepoSpec_nonRegistryOverride() throws Exception {
.addModule(createModuleKey("ccc", "2.0"), "module(name='ccc', version='2.0')");
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of(registry.getUrl()));
- RepositoryName repo = RepositoryName.create("ccc~");
+ RepositoryName repo = RepositoryName.create("ccc+");
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(BzlmodRepoRuleValue.key(repo)), evaluationContext);
if (result.hasError()) {
@@ -220,7 +220,7 @@ public void testRepoSpec_nonRegistryOverride() throws Exception {
assertThat(repoRule.getRuleClassObject().isStarlark()).isFalse();
assertThat(repoRule.getRuleClass()).isEqualTo("local_repository");
- assertThat(repoRule.getName()).isEqualTo("ccc~");
+ assertThat(repoRule.getName()).isEqualTo("ccc+");
assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/foo/bar/C");
}
@@ -242,7 +242,7 @@ public void testRepoSpec_singleVersionOverride() throws Exception {
.addModule(createModuleKey("ccc", "3.0"), "module(name='ccc', version='3.0')");
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of(registry.getUrl()));
- RepositoryName repo = RepositoryName.create("ccc~");
+ RepositoryName repo = RepositoryName.create("ccc+");
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(BzlmodRepoRuleValue.key(repo)), evaluationContext);
if (result.hasError()) {
@@ -253,8 +253,8 @@ public void testRepoSpec_singleVersionOverride() throws Exception {
assertThat(repoRule.getRuleClassObject().isStarlark()).isFalse();
assertThat(repoRule.getRuleClass()).isEqualTo("local_repository");
- assertThat(repoRule.getName()).isEqualTo("ccc~");
- assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ccc~v3.0");
+ assertThat(repoRule.getName()).isEqualTo("ccc+");
+ assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ccc+3.0");
}
@Test
@@ -278,7 +278,7 @@ public void testRepoSpec_multipleVersionOverride() throws Exception {
.addModule(createModuleKey("ddd", "2.0"), "module(name='ddd', version='2.0')");
ModuleFileFunction.REGISTRIES.set(differencer, ImmutableSet.of(registry.getUrl()));
- RepositoryName repo = RepositoryName.create("ddd~v2.0");
+ RepositoryName repo = RepositoryName.create("ddd+2.0");
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(BzlmodRepoRuleValue.key(repo)), evaluationContext);
if (result.hasError()) {
@@ -289,8 +289,8 @@ public void testRepoSpec_multipleVersionOverride() throws Exception {
assertThat(repoRule.getRuleClassObject().isStarlark()).isFalse();
assertThat(repoRule.getRuleClass()).isEqualTo("local_repository");
- assertThat(repoRule.getName()).isEqualTo("ddd~v2.0");
- assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ddd~v2.0");
+ assertThat(repoRule.getName()).isEqualTo("ddd+2.0");
+ assertThat(repoRule.getAttr("path", Type.STRING)).isEqualTo("/usr/local/modules/ddd+2.0");
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodTestUtil.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodTestUtil.java
index 6783f21937dc5b..d27f684d94a216 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodTestUtil.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodTestUtil.java
@@ -307,7 +307,7 @@ public static RepositoryMapping createRepositoryMapping(ModuleKey key, String...
mappingBuilder.put(names[i], RepositoryName.createUnvalidated(names[i + 1]));
}
return RepositoryMapping.create(
- mappingBuilder.buildOrThrow(), key.getCanonicalRepoNameWithoutVersionForTesting());
+ mappingBuilder.buildOrThrow(), key.getCanonicalRepoNameWithoutVersion());
}
public static TagClass createTagClass(Attribute... attrs) {
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/FakeRegistry.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/FakeRegistry.java
index a46aeed5ab77c7..0b9b5be3c23e0d 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/FakeRegistry.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/FakeRegistry.java
@@ -81,10 +81,7 @@ public RepoSpec getRepoSpec(ModuleKey key, ExtendedEventHandler eventHandler) {
.setAttributes(
AttributeValues.create(
ImmutableMap.of(
- "path",
- rootPath
- + "/"
- + key.getCanonicalRepoNameWithVersionForTesting().getName())))
+ "path", rootPath + "/" + key.getCanonicalRepoNameWithVersion().getName())))
.build();
eventHandler.post(
RegistryFileDownloadEvent.create(
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
index 307666464c44a0..90d8e9cd242aef 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
@@ -287,10 +287,10 @@ public void setup() throws Exception {
// Set up a simple repo rule.
registry.addModule(
createModuleKey("data_repo", "1.0"), "module(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("data_repo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("data_repo~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("data_repo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("data_repo+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("data_repo~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("data_repo+1.0/defs.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('WORKSPACE')",
" ctx.file('BUILD')",
@@ -519,10 +519,10 @@ public void multipleModules() throws Exception {
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_str = ''",
@@ -579,10 +579,10 @@ public void multipleModules_devDependency() throws Exception {
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_str = 'modules:'",
@@ -631,10 +631,10 @@ public void multipleModules_ignoreDevDependency() throws Exception {
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_str = 'modules:'",
@@ -648,7 +648,7 @@ public void multipleModules_ignoreDevDependency() throws Exception {
ModuleFileFunction.IGNORE_DEV_DEPS.set(differencer, true);
SkyKey skyKey =
- BzlLoadValue.keyForBuild(Label.parseCanonical("@@ext~~ext~ext_repo//:data.bzl"));
+ BzlLoadValue.keyForBuild(Label.parseCanonical("@@ext++ext+ext_repo//:data.bzl"));
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
if (result.hasError()) {
@@ -701,10 +701,10 @@ public void multipleModules_isolatedUsages() throws Exception {
"ext = use_extension('@ext//:defs.bzl','ext')",
"ext.tag(data='foo@1.0',expect_isolated=False)",
"use_repo(ext,'ext_repo')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("foo~v1.0/data.bzl").getPathString(),
+ modulesRoot.getRelative("foo+1.0/data.bzl").getPathString(),
"load('@ext_repo//:data.bzl', ext_data='data')",
"load('@isolated_ext_repo//:data.bzl', isolated_ext_data='data')",
"data=ext_data",
@@ -714,10 +714,10 @@ public void multipleModules_isolatedUsages() throws Exception {
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_str = ''",
@@ -745,7 +745,7 @@ public void multipleModules_isolatedUsages() throws Exception {
assertThat(result.get(skyKey).getModule().getGlobal("isolated_dev_data"))
.isEqualTo("root@1.0 (root): root_isolated_dev\n");
- skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("@foo~//:data.bzl"));
+ skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("@foo+//:data.bzl"));
result = evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
if (result.hasError()) {
throw result.getError().getException();
@@ -780,19 +780,19 @@ public void labels_readInModuleExtension() throws Exception {
"ext = use_extension('@ext//:defs.bzl','ext')",
"ext.tag(file='@bar//:requirements.txt')");
registry.addModule(createModuleKey("bar", "2.0"), "module(name='bar',version='2.0')");
- scratch.file(modulesRoot.getRelative("bar~v2.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("bar~v2.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("bar~v2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
+ modulesRoot.getRelative("bar+2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
registry.addModule(
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_str = 'requirements:'",
@@ -837,16 +837,16 @@ public void labels_passedOnToRepoRule() throws Exception {
"ext = use_extension('@ext//:defs.bzl','ext')",
"ext.tag(file='@bar//:requirements.txt')");
registry.addModule(createModuleKey("bar", "2.0"), "module(name='bar',version='2.0')");
- scratch.file(modulesRoot.getRelative("bar~v2.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("bar~v2.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("bar~v2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
+ modulesRoot.getRelative("bar+2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
registry.addModule(createModuleKey("ext", "1.0"), "module(name='ext',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('WORKSPACE')",
" ctx.file('BUILD')",
@@ -903,10 +903,10 @@ public void labels_fromExtensionGeneratedRepo() throws Exception {
scratch.file(workspaceRoot.getRelative("requirements.txt").getPathString(), "get up at 6am.");
registry.addModule(createModuleKey("ext", "1.0"), "module(name='ext',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('WORKSPACE')",
" ctx.file('BUILD')",
@@ -948,15 +948,15 @@ public void labels_constructedInModuleExtension_readInModuleExtension() throws E
"data=ext_data");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo',version='1.0')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("foo~v1.0/requirements.txt").getPathString(), "get up at 6am.");
+ modulesRoot.getRelative("foo+1.0/requirements.txt").getPathString(), "get up at 6am.");
registry.addModule(createModuleKey("bar", "2.0"), "module(name='bar',version='2.0')");
- scratch.file(modulesRoot.getRelative("bar~v2.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("bar~v2.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("bar+2.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("bar~v2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
+ modulesRoot.getRelative("bar+2.0/requirements.txt").getPathString(), "go to bed at 11pm.");
registry.addModule(
createModuleKey("ext", "1.0"),
@@ -964,10 +964,10 @@ public void labels_constructedInModuleExtension_readInModuleExtension() throws E
"bazel_dep(name='foo',version='1.0')",
"bazel_dep(name='bar',version='2.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
// The Label() call on the following line should work, using ext.1.0's repo mapping.
@@ -1004,20 +1004,20 @@ public void labels_constructedInModuleExtensionAsString_passedOnToRepoRule() thr
"data=ext_data");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo',version='1.0')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("foo~v1.0/requirements.txt").getPathString(), "get up at 6am.");
+ modulesRoot.getRelative("foo+1.0/requirements.txt").getPathString(), "get up at 6am.");
registry.addModule(
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='foo',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('WORKSPACE')",
" ctx.file('BUILD')",
@@ -1154,10 +1154,9 @@ public void generatedReposHaveCorrectMappings() throws Exception {
"ext=module_extension(implementation=_ext_impl)");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo',version='1.0')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
- scratch.file(
- modulesRoot.getRelative("foo~v1.0/data.bzl").getPathString(), "data = 'foo-stuff'");
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/data.bzl").getPathString(), "data = 'foo-stuff'");
SkyKey skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("//:data.bzl"));
EvaluationResult result =
@@ -1240,10 +1239,9 @@ public void generatedReposHaveCorrectMappings_internalRepoWins() throws Exceptio
"ext=module_extension(implementation=_ext_impl,tag_classes={'tag':tag})");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo',version='1.0')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
- scratch.file(
- modulesRoot.getRelative("foo~v1.0/data.bzl").getPathString(), "data = 'outer-foo'");
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/data.bzl").getPathString(), "data = 'outer-foo'");
SkyKey skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("//:data.bzl"));
EvaluationResult result =
@@ -1285,7 +1283,7 @@ public void generatedReposHaveCorrectMappings_strictDepsViolation() throws Excep
assertThat(result.hasError()).isTrue();
assertThat(result.getError().getException())
.hasMessageThat()
- .contains("No repository visible as '@foo' from repository '@@_main~ext~ext'");
+ .contains("No repository visible as '@foo' from repository '@@+ext+ext'");
}
@Test
@@ -1326,7 +1324,7 @@ public void importNonExistentRepo() throws Exception {
scratch.file(workspaceRoot.getRelative("BUILD").getPathString());
scratch.file(
workspaceRoot.getRelative("data.bzl").getPathString(),
- "load('@@_main~ext~ext//:data.bzl', ext_data='data')",
+ "load('@@+ext+ext//:data.bzl', ext_data='data')",
"data=ext_data");
SkyKey skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("//:data.bzl"));
@@ -1403,10 +1401,10 @@ public void nonVisibleLabelInLabelAttr() throws Exception {
public void nonVisibleLabelInLabelAttrNonRootModule() throws Exception {
registry.addModule(
createModuleKey("ext_module", "1.0"), "module(name='ext_module',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext_module~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext_module~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext_module+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext_module+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext_module~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext_module+1.0/defs.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('WORKSPACE')",
" ctx.file('BUILD')",
@@ -1434,7 +1432,7 @@ public void nonVisibleLabelInLabelAttrNonRootModule() throws Exception {
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
assertContainsEvent(
"Error in repository_rule: no repository visible as '@other_repo' to the repository"
- + " '@@ext_module~', but referenced by label '@other_repo//:foo' in attribute 'data' of"
+ + " '@@ext_module+', but referenced by label '@other_repo//:foo' in attribute 'data' of"
+ " data_repo 'ext'. Is the module 'ext_module' missing a bazel_dep or use_repo(...,"
+ " \"other_repo\")?");
}
@@ -1590,7 +1588,7 @@ public void extensionLoadsRepoFromAnotherExtension() throws Exception {
scratch.file(
workspaceRoot.getRelative("defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
- "load('@@ext~~ext~candy//:data.bzl', candy='data')",
+ "load('@@ext++ext+candy//:data.bzl', candy='data')",
"load('@exposed_candy//:data.bzl', exposed_candy='data')",
"def _ext_impl(ctx):",
" data_str = exposed_candy + ' (and ' + candy + ')'",
@@ -1607,10 +1605,10 @@ public void extensionLoadsRepoFromAnotherExtension() throws Exception {
createModuleKey("ext", "1.0"),
"module(name='ext',version='1.0')",
"bazel_dep(name='data_repo',version='1.0')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='candy', data='cotton candy')",
@@ -1642,7 +1640,7 @@ public void extensionRepoCtxReadsFromAnotherExtensionRepo() throws Exception {
workspaceRoot.getRelative("defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
- " data_file = ctx.read(Label('@@_main~my_ext2~candy2//:data.bzl'))",
+ " data_file = ctx.read(Label('@@+my_ext2+candy2//:data.bzl'))",
" data_repo(name='candy1',data=data_file)",
"my_ext=module_extension(implementation=_ext_impl)",
"def _ext_impl2(ctx):",
@@ -1689,7 +1687,7 @@ public void testReportRepoAndBzlCycles_circularExtReposCtxRead() throws Exceptio
SkyKey skyKey =
PackageIdentifier.create(
- RepositoryName.createUnvalidated("_main~my_ext~candy1"), PathFragment.EMPTY_FRAGMENT);
+ RepositoryName.createUnvalidated("+my_ext+candy1"), PathFragment.EMPTY_FRAGMENT);
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
assertThat(result.hasError()).isTrue();
@@ -1700,11 +1698,11 @@ public void testReportRepoAndBzlCycles_circularExtReposCtxRead() throws Exceptio
assertContainsEvent(
"ERROR : Circular definition of repositories generated by module extensions"
+ " and/or .bzl files:\n"
- + ".-> @@_main~my_ext~candy1\n"
+ + ".-> @@+my_ext+candy1\n"
+ "| extension 'my_ext' defined in //:defs.bzl\n"
- + "| @@_main~my_ext2~candy2\n"
+ + "| @@+my_ext2+candy2\n"
+ "| extension 'my_ext2' defined in //:defs.bzl\n"
- + "`-- @@_main~my_ext~candy1");
+ + "`-- @@+my_ext+candy1");
}
@Test
@@ -1734,8 +1732,7 @@ public void testReportRepoAndBzlCycles_circularExtReposLoadInDefFile() throws Ex
SkyKey skyKey =
PackageIdentifier.create(
- RepositoryName.createUnvalidated("_main~my_ext~candy1"),
- PathFragment.create("data.bzl"));
+ RepositoryName.createUnvalidated("+my_ext+candy1"), PathFragment.create("data.bzl"));
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
assertThat(result.hasError()).isTrue();
@@ -1746,13 +1743,13 @@ public void testReportRepoAndBzlCycles_circularExtReposLoadInDefFile() throws Ex
assertContainsEvent(
"ERROR : Circular definition of repositories generated by module extensions"
+ " and/or .bzl files:\n"
- + ".-> @@_main~my_ext~candy1\n"
+ + ".-> @@+my_ext+candy1\n"
+ "| extension 'my_ext' defined in //:defs.bzl\n"
- + "| @@_main~my_ext2~candy2\n"
+ + "| @@+my_ext2+candy2\n"
+ "| extension 'my_ext2' defined in //:defs2.bzl\n"
+ "| //:defs2.bzl\n"
- + "| @@_main~my_ext~candy1//:data.bzl\n"
- + "`-- @@_main~my_ext~candy1");
+ + "| @@+my_ext+candy1//:data.bzl\n"
+ + "`-- @@+my_ext+candy1");
}
@Test
@@ -1773,8 +1770,7 @@ public void testReportRepoAndBzlCycles_extRepoLoadSelfCycle() throws Exception {
SkyKey skyKey =
PackageIdentifier.create(
- RepositoryName.createUnvalidated("_main~my_ext~candy1"),
- PathFragment.create("data.bzl"));
+ RepositoryName.createUnvalidated("+my_ext+candy1"), PathFragment.create("data.bzl"));
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
assertThat(result.hasError()).isTrue();
@@ -1785,11 +1781,11 @@ public void testReportRepoAndBzlCycles_extRepoLoadSelfCycle() throws Exception {
assertContainsEvent(
"ERROR : Circular definition of repositories generated by module extensions"
+ " and/or .bzl files:\n"
- + ".-> @@_main~my_ext~candy1\n"
+ + ".-> @@+my_ext+candy1\n"
+ "| extension 'my_ext' defined in //:defs.bzl\n"
+ "| //:defs.bzl\n"
- + "| @@_main~my_ext~candy1//:data.bzl\n"
- + "`-- @@_main~my_ext~candy1");
+ + "| @@+my_ext+candy1//:data.bzl\n"
+ + "`-- @@+my_ext+candy1");
}
@Test
@@ -1870,11 +1866,11 @@ public void extensionMetadata_invalidRepoName() throws Exception {
var result =
evaluateSimpleModuleExtension(
"return"
- + " ctx.extension_metadata(root_module_direct_deps=['~invalid'],root_module_direct_dev_deps=[])");
+ + " ctx.extension_metadata(root_module_direct_deps=['+invalid'],root_module_direct_dev_deps=[])");
assertThat(result.hasError()).isTrue();
assertContainsEvent(
- "in root_module_direct_deps: invalid user-provided repo name '~invalid': valid names may"
+ "in root_module_direct_deps: invalid user-provided repo name '+invalid': valid names may"
+ " contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter");
}
@@ -1883,11 +1879,11 @@ public void extensionMetadata_invalidDevRepoName() throws Exception {
var result =
evaluateSimpleModuleExtension(
"return"
- + " ctx.extension_metadata(root_module_direct_dev_deps=['~invalid'],root_module_direct_deps=[])");
+ + " ctx.extension_metadata(root_module_direct_dev_deps=['+invalid'],root_module_direct_deps=[])");
assertThat(result.hasError()).isTrue();
assertContainsEvent(
- "in root_module_direct_dev_deps: invalid user-provided repo name '~invalid': valid names"
+ "in root_module_direct_dev_deps: invalid user-provided repo name '+invalid': valid names"
+ " may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter");
}
@@ -2021,10 +2017,10 @@ public void extensionMetadata() throws Exception {
"use_repo(ext, 'indirect_dep')",
"ext_dev = use_extension('//:defs.bzl', 'ext', dev_dependency = True)",
"use_repo(ext_dev, 'indirect_dev_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2082,7 +2078,7 @@ public void extensionMetadata() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"), "ext", Optional.empty())));
+ Label.parseCanonical("@@ext+//:defs.bzl"), "ext", Optional.empty())));
assertThat(evalValue.getFixup()).isPresent();
assertThat(evalValue.getFixup().get().moduleFilePathToBuildozerCommands())
.containsExactly(
@@ -2147,10 +2143,10 @@ public void extensionMetadata_includes() throws Exception {
"use_repo(ext, 'indirect_dep')",
"ext_dev = use_extension('//:defs.bzl', 'ext', dev_dependency = True)",
"use_repo(ext_dev, 'indirect_dev_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2209,7 +2205,7 @@ Not imported, but reported as direct dependencies by the extension (may cause th
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"), "ext", Optional.empty())));
+ Label.parseCanonical("@@ext+//:defs.bzl"), "ext", Optional.empty())));
assertThat(evalValue.getFixup()).isPresent();
assertThat(evalValue.getFixup().get().moduleFilePathToBuildozerCommands())
.containsExactly(
@@ -2253,10 +2249,10 @@ public void extensionMetadata_all() throws Exception {
"use_repo(ext, 'indirect_dep')",
"ext_dev = use_extension('//:defs.bzl', 'ext', dev_dependency = True)",
"use_repo(ext_dev, 'indirect_dev_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2279,7 +2275,7 @@ public void extensionMetadata_all() throws Exception {
assertThat(result.getError().getException())
.hasMessageThat()
.isEqualTo(
- "module extension \"ext\" from \"@@ext~//:defs.bzl\" does not generate repository "
+ "module extension \"ext\" from \"@@ext+//:defs.bzl\" does not generate repository "
+ "\"invalid_dep\", yet it is imported as \"invalid_dep\" in the usage at "
+ "/ws/MODULE.bazel:3:20");
@@ -2308,7 +2304,7 @@ public void extensionMetadata_all() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"), "ext", Optional.empty())));
+ Label.parseCanonical("@@ext+//:defs.bzl"), "ext", Optional.empty())));
assertThat(evalValue.getFixup()).isPresent();
assertThat(evalValue.getFixup().get().moduleFilePathToBuildozerCommands())
.containsExactly(
@@ -2347,10 +2343,10 @@ public void extensionMetadata_allDev() throws Exception {
"use_repo(ext, 'indirect_dep')",
"ext_dev = use_extension('//:defs.bzl', 'ext', dev_dependency = True)",
"use_repo(ext_dev, 'indirect_dev_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2375,7 +2371,7 @@ public void extensionMetadata_allDev() throws Exception {
assertThat(result.getError().getException())
.hasMessageThat()
.isEqualTo(
- "module extension \"ext\" from \"@@ext~//:defs.bzl\" does not generate repository "
+ "module extension \"ext\" from \"@@ext+//:defs.bzl\" does not generate repository "
+ "\"invalid_dep\", yet it is imported as \"invalid_dep\" in the usage at "
+ "/ws/MODULE.bazel:3:20");
@@ -2404,7 +2400,7 @@ public void extensionMetadata_allDev() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"), "ext", Optional.empty())));
+ Label.parseCanonical("@@ext+//:defs.bzl"), "ext", Optional.empty())));
assertThat(evalValue.getFixup()).isPresent();
assertThat(evalValue.getFixup().get().moduleFilePathToBuildozerCommands())
.containsExactly(
@@ -2435,10 +2431,10 @@ public void extensionMetadata_noRootUsage() throws Exception {
"use_repo(ext, 'indirect_dep')",
"ext_dev = use_extension('//:defs.bzl', 'ext', dev_dependency = True)",
"use_repo(ext_dev, 'indirect_dev_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2453,11 +2449,11 @@ public void extensionMetadata_noRootUsage() throws Exception {
" )",
"ext=module_extension(implementation=_ext_impl)");
scratch.file(
- modulesRoot.getRelative("ext~v1.0/data.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/data.bzl").getPathString(),
"load('@indirect_dep//:data.bzl', indirect_dep_data='data')",
"data = indirect_dep_data");
- SkyKey skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("@ext~//:data.bzl"));
+ SkyKey skyKey = BzlLoadValue.keyForBuild(Label.parseCanonical("@ext+//:data.bzl"));
EvaluationResult result =
evaluator.evaluate(ImmutableList.of(skyKey), evaluationContext);
assertThat(result.get(skyKey).getModule().getGlobal("data")).isEqualTo("indirect_dep_data");
@@ -2470,7 +2466,7 @@ public void extensionMetadata_noRootUsage() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"), "ext", Optional.empty())));
+ Label.parseCanonical("@@ext+//:defs.bzl"), "ext", Optional.empty())));
assertThat(evalValue.getFixup()).isEmpty();
}
@@ -2502,10 +2498,10 @@ public void extensionMetadata_isolated() throws Exception {
"bazel_dep(name='data_repo',version='1.0')",
"ext = use_extension('//:defs.bzl', 'ext')",
"use_repo(ext, 'indirect_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2556,7 +2552,7 @@ public void extensionMetadata_isolated() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"),
+ Label.parseCanonical("@@ext+//:defs.bzl"),
"ext",
Optional.of(
ModuleExtensionId.IsolationKey.create(ModuleKey.ROOT, "ext1")))));
@@ -2576,7 +2572,7 @@ public void extensionMetadata_isolated() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"),
+ Label.parseCanonical("@@ext+//:defs.bzl"),
"ext",
Optional.of(
ModuleExtensionId.IsolationKey.create(ModuleKey.ROOT, "ext2")))));
@@ -2616,10 +2612,10 @@ public void extensionMetadata_isolatedDev() throws Exception {
"bazel_dep(name='data_repo',version='1.0')",
"ext = use_extension('//:defs.bzl', 'ext')",
"use_repo(ext, 'indirect_dep')");
- scratch.file(modulesRoot.getRelative("ext~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("ext~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("ext+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("ext~v1.0/defs.bzl").getPathString(),
+ modulesRoot.getRelative("ext+1.0/defs.bzl").getPathString(),
"load('@data_repo//:defs.bzl','data_repo')",
"def _ext_impl(ctx):",
" data_repo(name='direct_dep')",
@@ -2670,7 +2666,7 @@ public void extensionMetadata_isolatedDev() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"),
+ Label.parseCanonical("@@ext+//:defs.bzl"),
"ext",
Optional.of(
ModuleExtensionId.IsolationKey.create(ModuleKey.ROOT, "ext1")))));
@@ -2690,7 +2686,7 @@ public void extensionMetadata_isolatedDev() throws Exception {
.get(
SingleExtensionValue.evalKey(
ModuleExtensionId.create(
- Label.parseCanonical("@@ext~//:defs.bzl"),
+ Label.parseCanonical("@@ext+//:defs.bzl"),
"ext",
Optional.of(
ModuleExtensionId.IsolationKey.create(ModuleKey.ROOT, "ext2")))));
@@ -2829,14 +2825,14 @@ public void innate() throws Exception {
"module(name='foo',version='1.0')",
"data_repo = use_repo_rule('//:repo.bzl', 'data_repo')",
"data_repo(name='data', data='go to bed at 11pm.')");
- scratch.file(modulesRoot.getRelative("foo~v1.0/WORKSPACE").getPathString());
- scratch.file(modulesRoot.getRelative("foo~v1.0/BUILD").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/WORKSPACE").getPathString());
+ scratch.file(modulesRoot.getRelative("foo+1.0/BUILD").getPathString());
scratch.file(
- modulesRoot.getRelative("foo~v1.0/data.bzl").getPathString(),
+ modulesRoot.getRelative("foo+1.0/data.bzl").getPathString(),
"load('@data//:data.bzl',repo_data='data')",
"data=repo_data");
scratch.file(
- modulesRoot.getRelative("foo~v1.0/repo.bzl").getPathString(),
+ modulesRoot.getRelative("foo+1.0/repo.bzl").getPathString(),
"def _data_repo_impl(ctx):",
" ctx.file('BUILD.bazel')",
" ctx.file('data.bzl', 'data='+json.encode(ctx.attr.data))",
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
index 7825df38f1a441..59d71fe3a29841 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunctionTest.java
@@ -267,8 +267,8 @@ public void testRootModule() throws Exception {
0));
assertThat(rootModuleFileValue.getNonRegistryOverrideCanonicalRepoNameLookup())
.containsExactly(
- RepositoryName.create("eee~"), "eee",
- RepositoryName.create("ggg~"), "ggg");
+ RepositoryName.create("eee+"), "eee",
+ RepositoryName.create("ggg+"), "ggg");
}
@Test
@@ -1271,6 +1271,7 @@ public void validateModuleName() throws Exception {
assertThrows(EvalException.class, () -> ModuleFileGlobals.validateModuleName("_foo"));
assertThrows(EvalException.class, () -> ModuleFileGlobals.validateModuleName("foo#bar"));
assertThrows(EvalException.class, () -> ModuleFileGlobals.validateModuleName("foo~bar"));
+ assertThrows(EvalException.class, () -> ModuleFileGlobals.validateModuleName("foo+bar"));
}
@Test
@@ -1689,6 +1690,6 @@ public void testInvalidUseExtensionLabel() throws Exception {
assertContainsEvent(
"Error in use_extension: invalid label \"@foo/bar:extensions.bzl\": invalid repository"
+ " name 'foo/bar:extensions.bzl': repo names may contain only A-Z, a-z, 0-9, '-',"
- + " '_', '.' and '~' and must not start with '~'");
+ + " '_', '.' and '+'");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleTest.java
index dd4db83801a0e7..1ac21e33385bc3 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleTest.java
@@ -46,17 +46,16 @@ public void getRepoMapping() throws Exception {
module.getRepoMappingWithBazelDepsOnly(
Stream.of(key, fooKey, barKey, ModuleKey.ROOT)
.collect(
- toImmutableMap(
- k -> k, ModuleKey::getCanonicalRepoNameWithoutVersionForTesting))))
+ toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithoutVersion))))
.isEqualTo(
createRepositoryMapping(
key,
"test_module",
- "test_module~",
+ "test_module+",
"my_foo",
- "foo~",
+ "foo+",
"my_bar",
- "bar~",
+ "bar+",
"my_root",
""));
}
@@ -74,9 +73,7 @@ public void getRepoMapping_asMainModule() throws Exception {
assertThat(
module.getRepoMappingWithBazelDepsOnly(
Stream.of(ModuleKey.ROOT, fooKey, barKey)
- .collect(
- toImmutableMap(
- k -> k, ModuleKey::getCanonicalRepoNameWithVersionForTesting))))
+ .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersion))))
.isEqualTo(
createRepositoryMapping(
ModuleKey.ROOT,
@@ -85,21 +82,18 @@ public void getRepoMapping_asMainModule() throws Exception {
"test_module",
"",
"my_foo",
- "foo~v1.0",
+ "foo+1.0",
"my_bar",
- "bar~v2.0"));
+ "bar+2.0"));
}
@Test
public void getCanonicalRepoName_isNotAWindowsShortPath() {
+ assertNotAShortPath(createModuleKey("foo", "").getCanonicalRepoNameWithoutVersion().getName());
+ assertNotAShortPath(createModuleKey("foo", "1").getCanonicalRepoNameWithVersion().getName());
+ assertNotAShortPath(createModuleKey("foo", "1.2").getCanonicalRepoNameWithVersion().getName());
assertNotAShortPath(
- createModuleKey("foo", "").getCanonicalRepoNameWithoutVersionForTesting().getName());
- assertNotAShortPath(
- createModuleKey("foo", "1").getCanonicalRepoNameWithVersionForTesting().getName());
- assertNotAShortPath(
- createModuleKey("foo", "1.2").getCanonicalRepoNameWithVersionForTesting().getName());
- assertNotAShortPath(
- createModuleKey("foo", "1.2.3").getCanonicalRepoNameWithVersionForTesting().getName());
+ createModuleKey("foo", "1.2.3").getCanonicalRepoNameWithVersion().getName());
}
private static void assertNotAShortPath(String name) {
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/StarlarkBazelModuleTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/StarlarkBazelModuleTest.java
index 256ce99a3f61b4..110eeb2fa753a6 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/StarlarkBazelModuleTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/StarlarkBazelModuleTest.java
@@ -96,8 +96,8 @@ public void basic() throws Exception {
extension,
module.getRepoMappingWithBazelDepsOnly(
ImmutableMap.of(
- fooKey, fooKey.getCanonicalRepoNameWithoutVersionForTesting(),
- barKey, barKey.getCanonicalRepoNameWithoutVersionForTesting())),
+ fooKey, fooKey.getCanonicalRepoNameWithoutVersion(),
+ barKey, barKey.getCanonicalRepoNameWithoutVersion())),
usage);
assertThat(moduleProxy.getName()).isEqualTo("foo");
@@ -123,8 +123,8 @@ public void basic() throws Exception {
assertThat(pomTags.get(0).getValue("pom_xmls"))
.isEqualTo(
StarlarkList.immutableOf(
- Label.parseCanonical("@@foo~//:pom.xml"),
- Label.parseCanonical("@@bar~//:pom.xml")));
+ Label.parseCanonical("@@foo+//:pom.xml"),
+ Label.parseCanonical("@@bar+//:pom.xml")));
}
@Test
@@ -144,8 +144,7 @@ public void unknownTagClass() throws Exception {
abridgedModule,
extension,
module.getRepoMappingWithBazelDepsOnly(
- ImmutableMap.of(
- fooKey, fooKey.getCanonicalRepoNameWithoutVersionForTesting())),
+ ImmutableMap.of(fooKey, fooKey.getCanonicalRepoNameWithoutVersion())),
usage));
assertThat(e).hasMessageThat().contains("does not have a tag class named blep");
}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/VersionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/VersionTest.java
index 8f580f64ed989f..dd5ce529950096 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/VersionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/VersionTest.java
@@ -35,6 +35,15 @@ public void testEmptyBeatsEverything() throws Exception {
assertThat(Version.parse("")).isGreaterThan(Version.parse("1.0-pre+build-kek.lol"));
}
+ @Test
+ public void testNormalized() throws Exception {
+ assertThat(Version.parse("1.0").getNormalized()).isEqualTo("1.0");
+ assertThat(Version.parse("1.0+build").getNormalized()).isEqualTo("1.0");
+ assertThat(Version.parse("1.0-pre").getNormalized()).isEqualTo("1.0-pre");
+ assertThat(Version.parse("1.0-pre+build-kek.lol").getNormalized()).isEqualTo("1.0-pre");
+ assertThat(Version.parse("1.0+build-notpre").getNormalized()).isEqualTo("1.0");
+ }
+
@Test
public void testReleaseVersion() throws Exception {
assertThat(Version.parse("2.0")).isGreaterThan(Version.parse("1.0"));
@@ -42,11 +51,9 @@ public void testReleaseVersion() throws Exception {
assertThat(Version.parse("11.0")).isGreaterThan(Version.parse("3.0"));
assertThat(Version.parse("1.0.1")).isGreaterThan(Version.parse("1.0"));
assertThat(Version.parse("1.0.0")).isGreaterThan(Version.parse("1.0"));
- assertThat(Version.parse("1.0+build2"))
- .isEquivalentAccordingToCompareTo(Version.parse("1.0+build3"));
+ assertThat(Version.parse("1.0+build2")).isEqualTo(Version.parse("1.0+build3"));
assertThat(Version.parse("1.0")).isGreaterThan(Version.parse("1.0-pre"));
- assertThat(Version.parse("1.0"))
- .isEquivalentAccordingToCompareTo(Version.parse("1.0+build-notpre"));
+ assertThat(Version.parse("1.0")).isEqualTo(Version.parse("1.0+build-notpre"));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ExtensionArgTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ExtensionArgTest.java
index 2bd1e58cb71a3d..1973250a481734 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ExtensionArgTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ExtensionArgTest.java
@@ -89,7 +89,7 @@ public void resolve_good() throws Exception {
.buildOrThrow();
ImmutableMap moduleKeyToCanonicalNames =
depGraph.keySet().stream()
- .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersionForTesting));
+ .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersion));
ImmutableBiMap baseModuleDeps = ImmutableBiMap.of("fred", key);
ImmutableBiMap baseModuleUnusedDeps = ImmutableBiMap.of();
@@ -103,7 +103,7 @@ public void resolve_good() throws Exception {
baseModuleUnusedDeps))
.isEqualTo(
ModuleExtensionId.create(
- Label.parseCanonical("@@foo~v1.0//:abc.bzl"), "def", Optional.empty()));
+ Label.parseCanonical("@@foo+1.0//:abc.bzl"), "def", Optional.empty()));
}
@Test
@@ -118,7 +118,7 @@ public void resolve_badLabel() throws Exception {
.buildOrThrow();
ImmutableMap moduleKeyToCanonicalNames =
depGraph.keySet().stream()
- .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersionForTesting));
+ .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersion));
ImmutableBiMap baseModuleDeps = ImmutableBiMap.of("fred", key);
ImmutableBiMap baseModuleUnusedDeps = ImmutableBiMap.of();
@@ -162,7 +162,7 @@ public void resolve_noneOrtooManyModules() throws Exception {
.buildOrThrow();
ImmutableMap moduleKeyToCanonicalNames =
depGraph.keySet().stream()
- .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersionForTesting));
+ .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersion));
ImmutableBiMap baseModuleDeps =
ImmutableBiMap.of("foo1", foo1, "foo2", foo2);
ImmutableBiMap baseModuleUnusedDeps = ImmutableBiMap.of();
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ModuleArgTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ModuleArgTest.java
index 70d6b212f84d54..f0487a55ceb505 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ModuleArgTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand/ModuleArgTest.java
@@ -80,10 +80,10 @@ public void converter() throws Exception {
ImmutableMap moduleKeyToCanonicalNames =
depGraph.keySet().stream()
- .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersionForTesting));
+ .collect(toImmutableMap(k -> k, ModuleKey::getCanonicalRepoNameWithVersion));
ImmutableBiMap baseModuleDeps = ImmutableBiMap.of("fred", foo2);
ImmutableBiMap baseModuleUnusedDeps = ImmutableBiMap.of("fred", foo1);
- RepositoryMapping rootMapping = createRepositoryMapping(ModuleKey.ROOT, "fred", "foo~v2.0");
+ RepositoryMapping rootMapping = createRepositoryMapping(ModuleKey.ROOT, "fred", "foo+2.0");
public ModuleArgTest() throws Exception {}
@@ -103,7 +103,7 @@ public void resolve_specificVersion_good() throws Exception {
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("foo@2.0", RepositoryName.create("foo~v2.0"));
+ .containsExactly("foo@2.0", RepositoryName.create("foo+2.0"));
}
@Test
@@ -192,7 +192,7 @@ public void resolve_allVersions_good() throws Exception {
// resolving to repo names doesn't care about unused deps.
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("foo@2.0", RepositoryName.create("foo~v2.0"));
+ .containsExactly("foo@2.0", RepositoryName.create("foo+2.0"));
}
@Test
@@ -244,7 +244,7 @@ public void resolve_apparentRepoName_good() throws Exception {
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("@fred", RepositoryName.create("foo~v2.0"));
+ .containsExactly("@fred", RepositoryName.create("foo+2.0"));
}
@Test
@@ -270,7 +270,7 @@ public void resolve_apparentRepoName_notFound() throws Exception {
@Test
public void resolve_canonicalRepoName_good() throws Exception {
- var arg = CanonicalRepoName.create(foo2.getCanonicalRepoNameWithVersionForTesting());
+ var arg = CanonicalRepoName.create(foo2.getCanonicalRepoNameWithVersion());
assertThat(
arg.resolveToModuleKeys(
@@ -285,12 +285,12 @@ public void resolve_canonicalRepoName_good() throws Exception {
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("@@foo~v2.0", RepositoryName.create("foo~v2.0"));
+ .containsExactly("@@foo+2.0", RepositoryName.create("foo+2.0"));
}
@Test
public void resolve_canonicalRepoName_notFound() throws Exception {
- var arg = CanonicalRepoName.create(RepositoryName.create("bar~v1.0"));
+ var arg = CanonicalRepoName.create(RepositoryName.create("bar+1.0"));
assertThrows(
InvalidArgumentException.class,
@@ -306,12 +306,12 @@ public void resolve_canonicalRepoName_notFound() throws Exception {
// The repo need not exist in the "repo -> repo" case.
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("@@bar~v1.0", RepositoryName.create("bar~v1.0"));
+ .containsExactly("@@bar+1.0", RepositoryName.create("bar+1.0"));
}
@Test
public void resolve_canonicalRepoName_unused() throws Exception {
- var arg = CanonicalRepoName.create(foo1.getCanonicalRepoNameWithVersionForTesting());
+ var arg = CanonicalRepoName.create(foo1.getCanonicalRepoNameWithVersion());
// Without --include_unused, this doesn't resolve, as foo@1.0 has been replaced by foo@2.0.
assertThat(
@@ -343,6 +343,6 @@ public void resolve_canonicalRepoName_unused() throws Exception {
// resolving to repo names doesn't care about unused deps.
assertThat(
arg.resolveToRepoNames(modulesIndex, depGraph, moduleKeyToCanonicalNames, rootMapping))
- .containsExactly("@@foo~v1.0", RepositoryName.create("foo~v1.0"));
+ .containsExactly("@@foo+1.0", RepositoryName.create("foo+1.0"));
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/BazelEmbeddedStarlarkBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/BazelEmbeddedStarlarkBlackBoxTest.java
index 7b958c8a656568..e42f930885842b 100644
--- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/BazelEmbeddedStarlarkBlackBoxTest.java
+++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/BazelEmbeddedStarlarkBlackBoxTest.java
@@ -112,13 +112,13 @@ public void testHttpArchive() throws Exception {
Path packedFile =
context()
.resolveBinPath(
- bazel, String.format("external/_main~_repo_rules~ext_local/%s.tar", tarTarget));
+ bazel, String.format("external/+_repo_rules+ext_local/%s.tar", tarTarget));
Files.copy(packedFile, zipFile);
// now build the target from http_archive
bazel.build("@ext//:" + RepoWithRuleWritingTextGenerator.TARGET);
- Path xPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out");
+ Path xPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out");
WorkspaceTestUtils.assertLinesExactly(xPath, HELLO_FROM_EXTERNAL_REPOSITORY);
// and use the rule from http_archive in the main repository
diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/GitRepositoryBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/GitRepositoryBlackBoxTest.java
index eac739da7a86b5..4a1896048a3716 100644
--- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/GitRepositoryBlackBoxTest.java
+++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/GitRepositoryBlackBoxTest.java
@@ -84,7 +84,7 @@ public void testCloneAtTag() throws Exception {
// This creates Bazel without MSYS, see implementation for details.
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@ext//:call_write_text");
- Path outPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out.txt");
+ Path outPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out.txt");
WorkspaceTestUtils.assertLinesExactly(outPath, HELLO_FROM_EXTERNAL_REPOSITORY);
}
@@ -116,7 +116,7 @@ public void testCloneAtCommit() throws Exception {
// This creates Bazel without MSYS, see implementation for details.
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@ext//:call_write_text");
- Path outPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out.txt");
+ Path outPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out.txt");
WorkspaceTestUtils.assertLinesExactly(outPath, HELLO_FROM_EXTERNAL_REPOSITORY);
}
@@ -148,7 +148,7 @@ public void testCloneAtMain() throws Exception {
// This creates Bazel without MSYS, see implementation for details.
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@ext//:call_write_text");
- Path outPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out.txt");
+ Path outPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out.txt");
WorkspaceTestUtils.assertLinesExactly(outPath, HELLO_FROM_EXTERNAL_REPOSITORY);
}
@@ -193,7 +193,7 @@ public void testCheckoutOfCommitFromBranch() throws Exception {
// This creates Bazel without MSYS, see implementation for details.
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@ext//:write_text");
- Path outPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out");
+ Path outPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out");
WorkspaceTestUtils.assertLinesExactly(outPath, HELLO_FROM_BRANCH);
}
@@ -244,7 +244,7 @@ public void testCheckoutOfCommitFromTag() throws Exception {
// This creates Bazel without MSYS, see implementation for details.
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@ext//:write_text");
- Path outPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~ext/out");
+ Path outPath = context().resolveBinPath(bazel, "external/+_repo_rules+ext/out");
WorkspaceTestUtils.assertLinesExactly(outPath, HELLO_FROM_BRANCH);
}
diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/PatchApiBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/PatchApiBlackBoxTest.java
index c9a5113ff73867..4bb1c2bafdd2f0 100644
--- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/PatchApiBlackBoxTest.java
+++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/PatchApiBlackBoxTest.java
@@ -157,8 +157,7 @@ public void testFallBackToPatchToolDueToPatchArgs() throws Exception {
} else {
assertFooIsPatched(bazel);
// foo.sh.orig should be generated due to "-b" argument.
- Path fooOrig =
- context().resolveExecRootPath(bazel, "external/_main~_repo_rules~test/foo.sh.orig");
+ Path fooOrig = context().resolveExecRootPath(bazel, "external/+_repo_rules+test/foo.sh.orig");
assertThat(fooOrig.toFile().exists()).isTrue();
}
}
@@ -201,7 +200,7 @@ public void testFallBackToPatchCmdsWhenPatchCmdsWinNotSpecified() throws Excepti
}
private void assertFooIsPatched(BuilderRunner bazel) throws Exception {
- Path foo = context().resolveExecRootPath(bazel, "external/_main~_repo_rules~test/foo.sh");
+ Path foo = context().resolveExecRootPath(bazel, "external/+_repo_rules+test/foo.sh");
assertThat(foo.toFile().exists()).isTrue();
ImmutableList patchedFoo =
ImmutableList.of(
diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/WorkspaceBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/WorkspaceBlackBoxTest.java
index c7a7d683955eba..2ce457a992f070 100644
--- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/WorkspaceBlackBoxTest.java
+++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/WorkspaceBlackBoxTest.java
@@ -138,20 +138,19 @@ public void testExecuteInWorkingDirectory() throws Exception {
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@relative//:debug_me");
- Path outFile = context().resolveBinPath(bazel, "external/_main~_repo_rules~relative/out");
+ Path outFile = context().resolveBinPath(bazel, "external/+_repo_rules+relative/out");
assertThat(outFile.toFile().exists()).isTrue();
List lines = PathUtils.readFile(outFile);
assertThat(lines.size()).isEqualTo(1);
assertThat(
- Paths.get(lines.get(0))
- .endsWith(Paths.get("external/_main~_repo_rules~relative/relative")))
+ Paths.get(lines.get(0)).endsWith(Paths.get("external/+_repo_rules+relative/relative")))
.isTrue();
bazel.build("@relative2//:debug_me");
bazel.build("@absolute//:debug_me");
bazel.build("@absolute2//:debug_me");
- Path outFile2 = context().resolveBinPath(bazel, "external/_main~_repo_rules~absolute2/out");
+ Path outFile2 = context().resolveBinPath(bazel, "external/+_repo_rules+absolute2/out");
assertThat(outFile2.toFile().exists()).isTrue();
List lines2 = PathUtils.readFile(outFile2);
assertThat(lines2.size()).isEqualTo(1);
@@ -178,7 +177,7 @@ public void testWorkspaceChanges() throws Exception {
BuilderRunner bazel = WorkspaceTestUtils.bazel(context());
bazel.build("@x//:" + RepoWithRuleWritingTextGenerator.TARGET);
- Path xPath = context().resolveBinPath(bazel, "external/_main~_repo_rules~x/out");
+ Path xPath = context().resolveBinPath(bazel, "external/+_repo_rules+x/out");
WorkspaceTestUtils.assertLinesExactly(xPath, "hi");
context()
@@ -214,8 +213,7 @@ public void testNoPackageLoadingOnBenignWorkspaceChanges() throws Exception {
// and Bazel recognizes that there is a terminal, so progress events will be displayed
.withFlags("--experimental_ui_debug_all_events", "--curses=yes");
- final String progressMessage =
- "PROGRESS : Loading package: @@_main~_repo_rules~ext//";
+ final String progressMessage = "PROGRESS : Loading package: @@+_repo_rules+ext//";
ProcessResult result = bazel.query("@ext//:all");
assertThat(result.outString()).contains(progressMessage);
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
index b57cf4f10cbc52..b825e0733a1bea 100644
--- a/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
+++ b/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
@@ -46,13 +46,13 @@ public void testValidateRepositoryName() throws Exception {
assertThat(RepositoryName.create("..foo").getName()).isEqualTo("..foo");
assertThat(RepositoryName.create("foo..").getName()).isEqualTo("foo..");
assertThat(RepositoryName.create(".foo").getName()).isEqualTo(".foo");
- assertThat(RepositoryName.create("foo~bar").getName()).isEqualTo("foo~bar");
+ assertThat(RepositoryName.create("foo+bar").getName()).isEqualTo("foo+bar");
assertNotValid(".", "repo names are not allowed to be '.'");
assertNotValid("..", "repo names are not allowed to be '..'");
- assertNotValid("foo/bar", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '~'");
- assertNotValid("foo@", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '~'");
- assertNotValid("foo\0", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '~'");
+ assertNotValid("foo/bar", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'");
+ assertNotValid("foo@", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'");
+ assertNotValid("foo\0", "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'");
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java
index 5662c7954831d9..c5f68b2053fac6 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java
@@ -126,7 +126,6 @@ private static BuildLanguageOptions buildRandomOptions(Random rand) throws Excep
"--experimental_single_package_toolchain_binding=" + rand.nextBoolean(),
"--enable_bzlmod=" + rand.nextBoolean(),
"--enable_workspace=" + rand.nextBoolean(),
- "--incompatible_use_plus_in_repo_names=" + rand.nextBoolean(),
"--experimental_isolated_extension_usages=" + rand.nextBoolean(),
"--experimental_google_legacy_api=" + rand.nextBoolean(),
"--experimental_platforms_api=" + rand.nextBoolean(),
@@ -173,7 +172,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
BuildLanguageOptions.EXPERIMENTAL_SINGLE_PACKAGE_TOOLCHAIN_BINDING, rand.nextBoolean())
.setBool(BuildLanguageOptions.ENABLE_BZLMOD, rand.nextBoolean())
.setBool(BuildLanguageOptions.ENABLE_WORKSPACE, rand.nextBoolean())
- .setBool(BuildLanguageOptions.INCOMPATIBLE_USE_PLUS_IN_REPO_NAMES, rand.nextBoolean())
.setBool(BuildLanguageOptions.EXPERIMENTAL_ISOLATED_EXTENSION_USAGES, rand.nextBoolean())
.setBool(BuildLanguageOptions.EXPERIMENTAL_GOOGLE_LEGACY_API, rand.nextBoolean())
.setBool(BuildLanguageOptions.EXPERIMENTAL_PLATFORMS_API, rand.nextBoolean())
diff --git a/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java b/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
index 51c2b8da691188..a1f1852617662d 100644
--- a/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
@@ -2504,27 +2504,27 @@ protected void writeBzlmodBuildFiles() throws Exception {
")");
helper.addModule(
ModuleKey.create("repo", Version.parse("1.0")), "module(name = 'repo', version = '1.0')");
- writeFile(helper.getModuleRoot().getRelative("repo~v1.0/WORKSPACE").getPathString(), "");
+ writeFile(helper.getModuleRoot().getRelative("repo+1.0/WORKSPACE").getPathString(), "");
writeFile(
- helper.getModuleRoot().getRelative("repo~v1.0/a/BUILD").getPathString(),
+ helper.getModuleRoot().getRelative("repo+1.0/a/BUILD").getPathString(),
"exports_files(['x', 'y', 'z'])",
"sh_library(name = 'a_shar')");
writeFile(
- helper.getModuleRoot().getRelative("repo~v1.0/a/b/BUILD").getPathString(),
+ helper.getModuleRoot().getRelative("repo+1.0/a/b/BUILD").getPathString(),
"exports_files(['p', 'q'])",
"sh_library(name = 'a_b_shar')");
RepositoryMapping mapping =
RepositoryMapping.create(
- ImmutableMap.of("my_repo", RepositoryName.create("repo~")), RepositoryName.MAIN);
+ ImmutableMap.of("my_repo", RepositoryName.create("repo+")), RepositoryName.MAIN);
helper.setMainRepoTargetParser(mapping);
}
- protected static final String REPO_A_RULES = "@@repo~//a:a_shar";
- protected static final String REPO_AB_RULES = "@@repo~//a/b:a_b_shar";
+ protected static final String REPO_A_RULES = "@@repo+//a:a_shar";
+ protected static final String REPO_AB_RULES = "@@repo+//a/b:a_b_shar";
protected static final String REPO_AB_ALL =
- "@@repo~//a/b:BUILD @@repo~//a/b:a_b_shar @@repo~//a/b:p @@repo~//a/b:q";
+ "@@repo+//a/b:BUILD @@repo+//a/b:a_b_shar @@repo+//a/b:p @@repo+//a/b:q";
protected static final String REPO_A_ALL =
- "@@repo~//a:BUILD @@repo~//a:a_shar @@repo~//a:x @@repo~//a:y @@repo~//a:z";
+ "@@repo+//a:BUILD @@repo+//a:a_shar @@repo+//a:x @@repo+//a:y @@repo+//a:z";
protected static final String REPO_A_AB_RULES = REPO_AB_RULES + " " + REPO_A_RULES;
protected static final String REPO_A_AB_ALL = REPO_AB_ALL + " " + REPO_A_ALL;
diff --git a/src/test/java/com/google/devtools/build/lib/rules/LabelBuildSettingTest.java b/src/test/java/com/google/devtools/build/lib/rules/LabelBuildSettingTest.java
index 61e450bf55f10e..842e188bfb66a0 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/LabelBuildSettingTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/LabelBuildSettingTest.java
@@ -425,8 +425,8 @@ def _rule_impl(ctx):
public void transitionOutput_otherRepo() throws Exception {
scratch.overwriteFile("MODULE.bazel", "bazel_dep(name='foo',version='1.0')");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo', version='1.0')");
- scratch.file("modules/foo~v1.0/WORKSPACE");
- scratch.file("modules/foo~v1.0/BUILD", "filegroup(name='other_rule')");
+ scratch.file("modules/foo+1.0/WORKSPACE");
+ scratch.file("modules/foo+1.0/BUILD", "filegroup(name='other_rule')");
scratch.overwriteFile(
"tools/allowlists/function_transition_allowlist/BUILD",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/starlarkdocextract/StarlarkDocExtractTest.java b/src/test/java/com/google/devtools/build/lib/rules/starlarkdocextract/StarlarkDocExtractTest.java
index 6d8c7f7edd63fe..381e9a920d68a1 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/starlarkdocextract/StarlarkDocExtractTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/starlarkdocextract/StarlarkDocExtractTest.java
@@ -398,7 +398,7 @@ public void originKeyFileAndModuleInfoFileLabels_forBzlFileInBzlmodModule_areDis
registry.addModule(
BzlmodTestUtil.createModuleKey("origin_repo", "0.1"),
"module(name='origin_repo', version='0.1')");
- Path originRepoPath = moduleRoot.getRelative("origin_repo~v0.1");
+ Path originRepoPath = moduleRoot.getRelative("origin_repo+0.1");
scratch.file(originRepoPath.getRelative("WORKSPACE").getPathString());
scratch.file(
originRepoPath.getRelative("BUILD").getPathString(), //
@@ -453,12 +453,12 @@ def my_macro():
invalidatePackages();
// verify that ModuleInfo.name for a .bzl file in another bzlmod module is in display form, i.e.
- // "@origin_repo//:origin.bzl" as opposed to "@@origin_repo~0.1//:origin.bzl"
+ // "@origin_repo//:origin.bzl" as opposed to "@@origin_repo+0.1//:origin.bzl"
ModuleInfo originModuleInfo = protoFromConfiguredTarget("//:extract_origin");
assertThat(originModuleInfo.getFile()).isEqualTo("@origin_repo//:origin.bzl");
// verify that OriginKey.name for entities defined in a .bzl file in another bzlmod module is in
- // display form, i.e. "@origin_repo//:origin.bzl" as opposed to "@@origin_repo~0.1//:origin.bzl"
+ // display form, i.e. "@origin_repo//:origin.bzl" as opposed to "@@origin_repo+0.1//:origin.bzl"
ModuleInfo renamedModuleInfo = protoFromConfiguredTarget("//:extract_renamed");
assertThat(renamedModuleInfo.getFile()).isEqualTo("//:renamer.bzl");
assertThat(renamedModuleInfo.getFuncInfo(0).getOriginKey().getFile())
@@ -1199,7 +1199,7 @@ public void repoName_inBzlmodDep() throws Exception {
"MODULE.bazel", "module(name = 'my_module')", "bazel_dep(name='dep_mod', version='0.1')");
registry.addModule(
BzlmodTestUtil.createModuleKey("dep_mod", "0.1"), "module(name='dep_mod', version='0.1')");
- Path depModRepoPath = moduleRoot.getRelative("dep_mod~v0.1");
+ Path depModRepoPath = moduleRoot.getRelative("dep_mod+0.1");
scratch.file(depModRepoPath.getRelative("WORKSPACE").getPathString());
scratch.file(
depModRepoPath.getRelative("foo.bzl").getPathString(),
@@ -1222,7 +1222,7 @@ def my_macro(arg = Label("//target:target")):
""");
invalidatePackages();
- ModuleInfo moduleInfo = protoFromConfiguredTarget("@dep_mod~//:extract");
+ ModuleInfo moduleInfo = protoFromConfiguredTarget("@dep_mod+//:extract");
assertThat(moduleInfo.getFile()).isEqualTo("@dep_mod//:foo.bzl");
assertThat(moduleInfo.getFuncInfo(0).getParameter(0).getDefaultValue())
.isEqualTo("Label(\"@dep_mod//target:target\")");
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/BzlLoadFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/BzlLoadFunctionTest.java
index a57631ed8da07a..e8a53d72732b82 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/BzlLoadFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/BzlLoadFunctionTest.java
@@ -1138,7 +1138,7 @@ public void testLoadBzlFileFromBzlmod() throws Exception {
"module(name='foo',version='1.0')",
"bazel_dep(name='bar',version='2.0',repo_name='bar_alias')")
.addModule(createModuleKey("bar", "2.0"), "module(name='bar',version='2.0')");
- Path fooDir = moduleRoot.getRelative("foo~v1.0");
+ Path fooDir = moduleRoot.getRelative("foo+1.0");
scratch.file(fooDir.getRelative("WORKSPACE").getPathString());
scratch.file(fooDir.getRelative("BUILD").getPathString());
scratch.file(
@@ -1147,12 +1147,12 @@ public void testLoadBzlFileFromBzlmod() throws Exception {
"load('@bar_alias//:test.scl', 'haha')",
"l = Label('@foo//:whatever')",
"hoho = haha");
- Path barDir = moduleRoot.getRelative("bar~v2.0");
+ Path barDir = moduleRoot.getRelative("bar+2.0");
scratch.file(barDir.getRelative("WORKSPACE").getPathString());
scratch.file(barDir.getRelative("BUILD").getPathString());
scratch.file(barDir.getRelative("test.scl").getPathString(), "haha = 5");
- SkyKey skyKey = BzlLoadValue.keyForBzlmod(Label.parseCanonical("@@foo~//:test.bzl"));
+ SkyKey skyKey = BzlLoadValue.keyForBzlmod(Label.parseCanonical("@@foo+//:test.bzl"));
EvaluationResult result =
SkyframeExecutorTestUtils.evaluate(
getSkyframeExecutor(), skyKey, /*keepGoing=*/ false, reporter);
@@ -1163,9 +1163,9 @@ public void testLoadBzlFileFromBzlmod() throws Exception {
assertThat(bzlLoadValue.getRecordedRepoMappings().cellSet())
.containsExactly(
Tables.immutableCell(
- RepositoryName.create("foo~"), "bar_alias", RepositoryName.create("bar~")),
+ RepositoryName.create("foo+"), "bar_alias", RepositoryName.create("bar+")),
Tables.immutableCell(
- RepositoryName.create("foo~"), "foo", RepositoryName.create("foo~")))
+ RepositoryName.create("foo+"), "foo", RepositoryName.create("foo+")))
.inOrder();
// Note that we're not testing the case of a non-registry override using @bazel_tools here, but
// that is incredibly hard to set up in a unit test. So we should just rely on integration tests
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java
index b7da2217809b17..d7e91dcbbc6550 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java
@@ -214,9 +214,9 @@ public void testFunctionLoadsTargetFromExternalRepo() throws Exception {
WalkableGraph walkableGraph = getGraphFromPatternsEvaluation(patternSequence);
// Then the graph contains a value for the target "@//rinne:rinne" and the dep
- // "@@repo~//a:x",
+ // "@@repo+//a:x",
assertValidValue(walkableGraph, getKeyForLabel(Label.create("//rinne", "rinne")));
- assertValidValue(walkableGraph, getKeyForLabel(Label.create("@repo~//a", "x")));
+ assertValidValue(walkableGraph, getKeyForLabel(Label.create("@repo+//a", "x")));
}
// Regression test for b/225877591 ("Unexpected missing value in PrepareDepsOfPatternsFunction
@@ -365,9 +365,9 @@ private void writeBzlmodFiles() throws Exception {
registry.addModule(
ModuleKey.create("repo", Version.parse("1.0")),
"module(name = \"repo\", version = \"1.0\")");
- scratch.file(moduleRoot.getRelative("repo~v1.0/WORKSPACE").getPathString(), "");
+ scratch.file(moduleRoot.getRelative("repo+1.0/WORKSPACE").getPathString(), "");
scratch.file(
- moduleRoot.getRelative("repo~v1.0/a/BUILD").getPathString(), "exports_files(['x'])");
+ moduleRoot.getRelative("repo+1.0/a/BUILD").getPathString(), "exports_files(['x'])");
invalidatePackages();
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RepoFileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RepoFileFunctionTest.java
index afd0e48989c2cf..7b830767e1b7a2 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RepoFileFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RepoFileFunctionTest.java
@@ -56,12 +56,12 @@ public void repoFileInAnExternalRepo() throws Exception {
scratch.overwriteFile("MODULE.bazel", "bazel_dep(name='foo',version='1.0')");
scratch.overwriteFile("abc/def/BUILD", "filegroup(name='what')");
registry.addModule(createModuleKey("foo", "1.0"), "module(name='foo',version='1.0')");
- scratch.overwriteFile(moduleRoot.getRelative("foo~v1.0/WORKSPACE.bazel").getPathString());
+ scratch.overwriteFile(moduleRoot.getRelative("foo+1.0/WORKSPACE.bazel").getPathString());
scratch.overwriteFile(
- moduleRoot.getRelative("foo~v1.0/REPO.bazel").getPathString(),
+ moduleRoot.getRelative("foo+1.0/REPO.bazel").getPathString(),
"repo(default_deprecation='EVERYTHING IS DEPRECATED')");
scratch.overwriteFile(
- moduleRoot.getRelative("foo~v1.0/abc/def/BUILD").getPathString(), "filegroup(name='what')");
+ moduleRoot.getRelative("foo+1.0/abc/def/BUILD").getPathString(), "filegroup(name='what')");
invalidatePackages();
@@ -71,7 +71,7 @@ public void repoFileInAnExternalRepo() throws Exception {
.get("deprecation", Type.STRING))
.isNull();
assertThat(
- getRuleContext(getConfiguredTarget("@@foo~//abc/def:what"))
+ getRuleContext(getConfiguredTarget("@@foo+//abc/def:what"))
.attributes()
.get("deprecation", Type.STRING))
.isEqualTo("EVERYTHING IS DEPRECATED");
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunctionTest.java
index a96242ea762d4f..ee4eadebac2aa0 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RepositoryMappingFunctionTest.java
@@ -146,7 +146,7 @@ public void testRepoNameMapping_asRootModule() throws Exception {
TestConstants.LEGACY_WORKSPACE_NAME,
RepositoryName.MAIN,
"com_foo_bar_b",
- RepositoryName.create("bbb~")),
+ RepositoryName.create("bbb+")),
"aaa",
"0.1"));
}
@@ -175,7 +175,7 @@ public void testRepoNameMapping_asRootModule_withOwnRepoName() throws Exception
TestConstants.LEGACY_WORKSPACE_NAME,
RepositoryName.MAIN,
"com_foo_bar_b",
- RepositoryName.create("bbb~")),
+ RepositoryName.create("bbb+")),
"aaa",
"0.1"));
}
@@ -194,7 +194,7 @@ public void testRepoNameMapping_asDependency() throws Exception {
"module(name='ccc', version='1.0')",
"bazel_dep(name='bbb', version='1.0', repo_name='com_foo_bar_b')");
- RepositoryName name = RepositoryName.create("ccc~");
+ RepositoryName name = RepositoryName.create("ccc+");
SkyKey skyKey = RepositoryMappingValue.key(name);
EvaluationResult result = eval(skyKey);
@@ -204,8 +204,8 @@ public void testRepoNameMapping_asDependency() throws Exception {
.isEqualTo(
valueForBzlmod(
ImmutableMap.of(
- "ccc", RepositoryName.create("ccc~"),
- "com_foo_bar_b", RepositoryName.create("bbb~")),
+ "ccc", RepositoryName.create("ccc+"),
+ "com_foo_bar_b", RepositoryName.create("bbb+")),
name,
"ccc",
"1.0"));
@@ -220,7 +220,7 @@ public void testRepoNameMapping_dependencyOnRootModule() throws Exception {
"module(name='bbb', version='1.0')",
"bazel_dep(name='aaa',version='3.0')");
- RepositoryName name = RepositoryName.create("bbb~");
+ RepositoryName name = RepositoryName.create("bbb+");
SkyKey skyKey = RepositoryMappingValue.key(name);
EvaluationResult result = eval(skyKey);
@@ -230,7 +230,7 @@ public void testRepoNameMapping_dependencyOnRootModule() throws Exception {
.isEqualTo(
valueForBzlmod(
ImmutableMap.of(
- "bbb", RepositoryName.create("bbb~"), "aaa", RepositoryName.create("")),
+ "bbb", RepositoryName.create("bbb+"), "aaa", RepositoryName.create("")),
name,
"bbb",
"1.0"));
@@ -266,9 +266,9 @@ public void testRepoNameMapping_multipleVersionOverride_fork() throws Exception
TestConstants.LEGACY_WORKSPACE_NAME,
RepositoryName.MAIN,
"bbb1",
- RepositoryName.create("bbb~v1.0"),
+ RepositoryName.create("bbb+1.0"),
"bbb2",
- RepositoryName.create("bbb~v2.0")),
+ RepositoryName.create("bbb+2.0")),
"aaa",
"0.1"));
}
@@ -291,7 +291,7 @@ public void testRepoNameMapping_multipleVersionOverride_diamond() throws Excepti
.addModule(createModuleKey("ddd", "1.0"), "module(name='ddd', version='1.0')")
.addModule(createModuleKey("ddd", "2.0"), "module(name='ddd', version='2.0')");
- RepositoryName name = RepositoryName.create("bbb~");
+ RepositoryName name = RepositoryName.create("bbb+");
SkyKey skyKey = RepositoryMappingValue.key(name);
EvaluationResult result = eval(skyKey);
@@ -303,8 +303,8 @@ public void testRepoNameMapping_multipleVersionOverride_diamond() throws Excepti
.isEqualTo(
valueForBzlmod(
ImmutableMap.of(
- "bbb", RepositoryName.create("bbb~"),
- "ddd", RepositoryName.create("ddd~v1.0")),
+ "bbb", RepositoryName.create("bbb+"),
+ "ddd", RepositoryName.create("ddd+1.0")),
name,
"bbb",
"1.0"));
@@ -326,7 +326,7 @@ public void testRepoNameMapping_multipleVersionOverride_lookup() throws Exceptio
.addModule(createModuleKey("bbb", "2.0"), "module(name='bbb', version='2.0')")
.addModule(createModuleKey("ccc", "1.0"), "module(name='ccc', version='1.0')");
- RepositoryName name = RepositoryName.create("bbb~v1.0");
+ RepositoryName name = RepositoryName.create("bbb+1.0");
SkyKey skyKey = RepositoryMappingValue.key(name);
EvaluationResult result = eval(skyKey);
@@ -338,8 +338,8 @@ public void testRepoNameMapping_multipleVersionOverride_lookup() throws Exceptio
.isEqualTo(
valueForBzlmod(
ImmutableMap.of(
- "bbb", RepositoryName.create("bbb~v1.0"),
- "com_foo_bar_c", RepositoryName.create("ccc~")),
+ "bbb", RepositoryName.create("bbb+1.0"),
+ "com_foo_bar_c", RepositoryName.create("ccc+")),
name,
"bbb",
"1.0"));
@@ -452,16 +452,16 @@ public void testMixtureOfBothSystems_workspaceRepo() throws Exception {
.put("", RepositoryName.MAIN)
.put("aaa", RepositoryName.MAIN)
.put("root", RepositoryName.MAIN)
- // mappings to @bbb get remapped to @bbb~ because of root dep on bbb@1.0
- .put("bbb_alias", RepositoryName.create("bbb~"))
- .put("bbb_alias2", RepositoryName.create("bbb~"))
- // mapping from @bbb to @bbb~1.0 is also created
- .put("bbb", RepositoryName.create("bbb~"))
- // mapping from @ccc to @ccc~2.0 is created despite not being mentioned
- .put("ccc", RepositoryName.create("ccc~"))
+ // mappings to @bbb get remapped to @@bbb+ because of root dep on bbb@1.0
+ .put("bbb_alias", RepositoryName.create("bbb+"))
+ .put("bbb_alias2", RepositoryName.create("bbb+"))
+ // mapping from @bbb to @@bbb+ is also created
+ .put("bbb", RepositoryName.create("bbb+"))
+ // mapping from @ccc to @@ccc+ is created despite not being mentioned
+ .put("ccc", RepositoryName.create("ccc+"))
// mapping to @ddd gets remapped to a module-extension-generated repo
- .put("ddd_alias", RepositoryName.create("ccc~~ext~ddd"))
- .put("ddd", RepositoryName.create("ccc~~ext~ddd"))
+ .put("ddd_alias", RepositoryName.create("ccc++ext+ddd"))
+ .put("ddd", RepositoryName.create("ccc++ext+ddd"))
// mapping to @eee is untouched because the root module doesn't know about it
.put("eee_alias", RepositoryName.create("eee"))
.buildOrThrow()));
@@ -493,7 +493,7 @@ public void testMixtureOfBothSystems_mainRepo() throws Exception {
ImmutableMap.of(
"", RepositoryName.MAIN,
"aaa", RepositoryName.MAIN,
- "bbb", RepositoryName.create("bbb~"),
+ "bbb", RepositoryName.create("bbb+"),
"root", RepositoryName.MAIN,
"ws_repo", RepositoryName.create("ws_repo")),
"aaa",
@@ -526,7 +526,7 @@ public void testMixtureOfBothSystems_mainRepo_shouldNotSeeWorkspaceRepos() throw
ImmutableMap.of(
"", RepositoryName.MAIN,
"aaa", RepositoryName.MAIN,
- "bbb", RepositoryName.create("bbb~")),
+ "bbb", RepositoryName.create("bbb+")),
RepositoryName.MAIN,
"aaa",
"0.1"));
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingFunctionParserTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingFunctionParserTest.java
index 983ede413aca63..cf93599c90c333 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingFunctionParserTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingFunctionParserTest.java
@@ -49,7 +49,7 @@ public class PlatformMappingFunctionParserTest extends AnalysisTestCase {
private static final Label PLATFORM1 = Label.parseCanonicalUnchecked("//platforms:one");
private static final Label PLATFORM2 = Label.parseCanonicalUnchecked("//platforms:two");
private static final Label EXTERNAL_PLATFORM =
- Label.parseCanonicalUnchecked("@dep~v1.0//platforms:two");
+ Label.parseCanonicalUnchecked("@dep+1.0//platforms:two");
@Test
public void testParse() throws Exception {
@@ -80,7 +80,7 @@ public void testParse() throws Exception {
public void testParseWithRepoMapping() throws Exception {
RepositoryMapping repoMapping =
RepositoryMapping.create(
- ImmutableMap.of("foo", RepositoryName.MAIN, "dep", RepositoryName.create("dep~v1.0")),
+ ImmutableMap.of("foo", RepositoryName.MAIN, "dep", RepositoryName.create("dep+1.0")),
RepositoryName.MAIN);
PlatformMappingFunction.Mappings mappings =
parse(
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingValueTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingValueTest.java
index 9f125a9fe63c52..20734e1461fbb1 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingValueTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/config/PlatformMappingValueTest.java
@@ -43,11 +43,11 @@ public final class PlatformMappingValueTest {
private static final Label PLATFORM_ONE = Label.parseCanonicalUnchecked("//platforms:one");
private static final Label PLATFORM_TWO =
- Label.parseCanonicalUnchecked("@dep~v1.0//platforms:two");
+ Label.parseCanonicalUnchecked("@dep+1.0//platforms:two");
private static final RepositoryMapping REPO_MAPPING =
RepositoryMapping.create(
ImmutableMap.of(
- "", RepositoryName.MAIN, "dep", RepositoryName.createUnvalidated("dep~v1.0")),
+ "", RepositoryName.MAIN, "dep", RepositoryName.createUnvalidated("dep+1.0")),
RepositoryName.MAIN);
private static final Label DEFAULT_TARGET_PLATFORM =
Label.parseCanonicalUnchecked("@bazel_tools//tools:host_platform");
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredExecutionPlatformsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredExecutionPlatformsFunctionTest.java
index 5617f2bfe523fc..7adcc851326894 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredExecutionPlatformsFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredExecutionPlatformsFunctionTest.java
@@ -387,8 +387,7 @@ public void testRegisteredExecutionPlatforms_bzlmod() throws Exception {
"register_execution_platforms('@eee//:plat', '//:plat')",
"bazel_dep(name='eee',version='1.0')")
.addModule(createModuleKey("eee", "1.0"), "module(name='eee', version='1.0')");
- for (String repo :
- ImmutableList.of("bbb~v1.0", "ccc~v1.1", "ddd~v1.0", "ddd~v1.1", "eee~v1.0")) {
+ for (String repo : ImmutableList.of("bbb+1.0", "ccc+1.1", "ddd+1.0", "ddd+1.1", "eee+1.0")) {
scratch.file(moduleRoot.getRelative(repo).getRelative("WORKSPACE").getPathString());
scratch.file(
moduleRoot.getRelative(repo).getRelative("BUILD").getPathString(),
@@ -422,10 +421,10 @@ public void testRegisteredExecutionPlatforms_bzlmod() throws Exception {
Label.parseCanonical("//:wsplat"),
Label.parseCanonical("//:wsplat2"),
// Other modules' toolchains
- Label.parseCanonical("@@bbb~//:plat"),
- Label.parseCanonical("@@ccc~//:plat"),
- Label.parseCanonical("@@eee~//:plat"),
- Label.parseCanonical("@@ddd~//:plat"))
+ Label.parseCanonical("@@bbb+//:plat"),
+ Label.parseCanonical("@@ccc+//:plat"),
+ Label.parseCanonical("@@eee+//:plat"),
+ Label.parseCanonical("@@ddd+//:plat"))
.inOrder();
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredToolchainsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredToolchainsFunctionTest.java
index 13659beb0f579b..9d42a6b27a201d 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredToolchainsFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/RegisteredToolchainsFunctionTest.java
@@ -419,7 +419,7 @@ public void testRegisteredToolchains_bzlmod() throws Exception {
createModuleKey("toolchain_def", "1.0"), "module(name='toolchain_def',version='1.0')");
// Everyone depends on toolchain_def@1.0 for the declare_toolchain macro.
- Path toolchainDefDir = moduleRoot.getRelative("toolchain_def~v1.0");
+ Path toolchainDefDir = moduleRoot.getRelative("toolchain_def+1.0");
scratch.file(toolchainDefDir.getRelative("WORKSPACE").getPathString());
scratch.file(
toolchainDefDir.getRelative("BUILD").getPathString(),
@@ -440,8 +440,7 @@ public void testRegisteredToolchains_bzlmod() throws Exception {
" data = 'stuff')");
// Now create the toolchains for each module.
- for (String repo :
- ImmutableList.of("bbb~v1.0", "ccc~v1.1", "ddd~v1.0", "ddd~v1.1", "eee~v1.0")) {
+ for (String repo : ImmutableList.of("bbb+1.0", "ccc+1.1", "ddd+1.0", "ddd+1.1", "eee+1.0")) {
scratch.file(moduleRoot.getRelative(repo).getRelative("WORKSPACE").getPathString());
scratch.file(
moduleRoot.getRelative(repo).getRelative("BUILD").getPathString(),
@@ -493,10 +492,10 @@ public void testRegisteredToolchains_bzlmod() throws Exception {
Label.parseCanonical("//toolchain:suffix_toolchain_2_impl"),
Label.parseCanonical("//:wstool2_impl"),
// Other modules' toolchains
- Label.parseCanonical("@@bbb~//:tool_impl"),
- Label.parseCanonical("@@ccc~//:tool_impl"),
- Label.parseCanonical("@@eee~//:tool_impl"),
- Label.parseCanonical("@@ddd~//:tool_impl"),
+ Label.parseCanonical("@@bbb+//:tool_impl"),
+ Label.parseCanonical("@@ccc+//:tool_impl"),
+ Label.parseCanonical("@@eee+//:tool_impl"),
+ Label.parseCanonical("@@ddd+//:tool_impl"),
// WORKSPACE suffix toolchains
Label.parseCanonical("//toolchain:suffix_toolchain_1_impl"))
.inOrder();
diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
index 5abdd71acb01df..31e335260289ce 100644
--- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
@@ -6397,8 +6397,8 @@ private Object eval(Module module, String... lines) throws Exception {
@Test
public void testLabelWithStrictVisibility() throws Exception {
- RepositoryName currentRepo = RepositoryName.createUnvalidated("module~v1.2.3");
- RepositoryName otherRepo = RepositoryName.createUnvalidated("dep~v4.5");
+ RepositoryName currentRepo = RepositoryName.createUnvalidated("module+1.2.3");
+ RepositoryName otherRepo = RepositoryName.createUnvalidated("dep+4.5");
Label bzlLabel =
Label.create(
PackageIdentifier.create(currentRepo, PathFragment.create("lib")), "label.bzl");
@@ -6417,15 +6417,14 @@ public void testLabelWithStrictVisibility() throws Exception {
clientData);
assertThat(eval(module, "Label('//foo:bar').workspace_root"))
- .isEqualTo("external/module~v1.2.3");
+ .isEqualTo("external/module+1.2.3");
assertThat(eval(module, "Label('@my_module//foo:bar').workspace_root"))
- .isEqualTo("external/module~v1.2.3");
- assertThat(eval(module, "Label('@@module~v1.2.3//foo:bar').workspace_root"))
- .isEqualTo("external/module~v1.2.3");
- assertThat(eval(module, "Label('@dep//foo:bar').workspace_root"))
- .isEqualTo("external/dep~v4.5");
- assertThat(eval(module, "Label('@@dep~v4.5//foo:bar').workspace_root"))
- .isEqualTo("external/dep~v4.5");
+ .isEqualTo("external/module+1.2.3");
+ assertThat(eval(module, "Label('@@module+1.2.3//foo:bar').workspace_root"))
+ .isEqualTo("external/module+1.2.3");
+ assertThat(eval(module, "Label('@dep//foo:bar').workspace_root")).isEqualTo("external/dep+4.5");
+ assertThat(eval(module, "Label('@@dep+4.5//foo:bar').workspace_root"))
+ .isEqualTo("external/dep+4.5");
assertThat(eval(module, "Label('@@//foo:bar').workspace_root")).isEqualTo("");
assertThat(eval(module, "str(Label('@@//foo:bar'))")).isEqualTo("@@//foo:bar");
@@ -6435,14 +6434,14 @@ public void testLabelWithStrictVisibility() throws Exception {
.hasMessageThat()
.isEqualTo(
"'workspace_name' is not allowed on invalid Label @@[unknown repo '' requested from"
- + " @@module~v1.2.3]//foo:bar");
+ + " @@module+1.2.3]//foo:bar");
assertThat(
assertThrows(
EvalException.class, () -> eval(module, "Label('@//foo:bar').workspace_root")))
.hasMessageThat()
.isEqualTo(
"'workspace_root' is not allowed on invalid Label @@[unknown repo '' requested from"
- + " @@module~v1.2.3]//foo:bar");
+ + " @@module+1.2.3]//foo:bar");
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleImplementationFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleImplementationFunctionsTest.java
index 1344492d279dd3..80c1e68913cfae 100644
--- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleImplementationFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleImplementationFunctionsTest.java
@@ -2760,12 +2760,12 @@ public void testArgsCanonicalRepoLabel() throws Exception {
ev.exec(
"actions = ruleContext.actions",
"a = []",
- "a.append(actions.args().add(Label('@@repo~//:foo')))",
- "a.append(actions.args().add('-flag', Label('@@repo~//:foo')))",
- "a.append(actions.args().add('-flag', Label('@@repo~//:foo'), format = '_%s_'))",
- "a.append(actions.args().add_all(['foo', Label('@@repo~//:foo')]))",
- "a.append(actions.args().add_all(depset([Label('@@other_repo~//:foo'),"
- + " Label('@@repo~//:foo')])))",
+ "a.append(actions.args().add(Label('@@repo+//:foo')))",
+ "a.append(actions.args().add('-flag', Label('@@repo+//:foo')))",
+ "a.append(actions.args().add('-flag', Label('@@repo+//:foo'), format = '_%s_'))",
+ "a.append(actions.args().add_all(['foo', Label('@@repo+//:foo')]))",
+ "a.append(actions.args().add_all(depset([Label('@@other_repo+//:foo'),"
+ + " Label('@@repo+//:foo')])))",
"ruleContext.actions.run(",
" inputs = depset(ruleContext.files.srcs),",
" outputs = ruleContext.files.srcs,",
@@ -2780,15 +2780,15 @@ public void testArgsCanonicalRepoLabel() throws Exception {
assertThat(action.getArguments())
.containsExactly(
"foo/t.exe",
- "@@repo~//:foo",
+ "@@repo+//:foo",
"-flag",
- "@@repo~//:foo",
+ "@@repo+//:foo",
"-flag",
- "_@@repo~//:foo_",
+ "_@@repo+//:foo_",
"foo",
- "@@repo~//:foo",
- "@@other_repo~//:foo",
- "@@repo~//:foo")
+ "@@repo+//:foo",
+ "@@other_repo+//:foo",
+ "@@repo+//:foo")
.inOrder();
}
@@ -2803,11 +2803,11 @@ public void testArgsApparentRepoLabel() throws Exception {
ev.exec(
"actions = ruleContext.actions",
"a = []",
- "a.append(actions.args().add(Label('@@foo~//:foo')))",
- "a.append(actions.args().add('-flag', Label('@@foo~//:foo')))",
- "a.append(actions.args().add('-flag', Label('@@foo~//:foo'), format = '_%s_'))",
- "a.append(actions.args().add_all(['foo', Label('@@foo~//:foo')]))",
- "a.append(actions.args().add_all(depset([Label('@@repo~//:foo'), Label('@@foo~//:foo')])))",
+ "a.append(actions.args().add(Label('@@foo+//:foo')))",
+ "a.append(actions.args().add('-flag', Label('@@foo+//:foo')))",
+ "a.append(actions.args().add('-flag', Label('@@foo+//:foo'), format = '_%s_'))",
+ "a.append(actions.args().add_all(['foo', Label('@@foo+//:foo')]))",
+ "a.append(actions.args().add_all(depset([Label('@@repo+//:foo'), Label('@@foo+//:foo')])))",
"ruleContext.actions.run(",
" inputs = depset(ruleContext.files.srcs),",
" outputs = ruleContext.files.srcs,",
@@ -2829,7 +2829,7 @@ public void testArgsApparentRepoLabel() throws Exception {
"_@foo//:foo_",
"foo",
"@foo//:foo",
- "@@repo~//:foo",
+ "@@repo+//:foo",
"@foo//:foo")
.inOrder();
}
@@ -3516,23 +3516,23 @@ public void starlarkCustomCommandLineKeyComputation_labelVsString() throws Excep
RepositoryMapping mainRepoMapping =
RepositoryMapping.create(
- ImmutableMap.of("apparent", RepositoryName.createUnvalidated("canonical~")),
+ ImmutableMap.of("apparent", RepositoryName.createUnvalidated("canonical+")),
RepositoryName.MAIN);
CommandLine commandLine1 =
getCommandLine(
mainRepoMapping,
"""
args = ruleContext.actions.args()
- args.add(Label("@@canonical~//foo:bar"))
- args.add(str(Label("@@canonical~//foo:bar")))
+ args.add(Label("@@canonical+//foo:bar"))
+ args.add(str(Label("@@canonical+//foo:bar")))
""");
CommandLine commandLine2 =
getCommandLine(
mainRepoMapping,
"""
args = ruleContext.actions.args()
- args.add(Label("@@canonical~//foo:bar"))
- args.add(Label("@@canonical~//foo:bar"))
+ args.add(Label("@@canonical+//foo:bar"))
+ args.add(Label("@@canonical+//foo:bar"))
""");
assertThat(getArguments(commandLine1, PathMapper.NOOP))
@@ -3550,23 +3550,23 @@ public void starlarkCustomCommandLineKeyComputation_labelDepsetVsMixedList() thr
RepositoryMapping.create(
ImmutableMap.of(
"apparent1",
- RepositoryName.createUnvalidated("canonical1~"),
+ RepositoryName.createUnvalidated("canonical1+"),
"apparent2",
- RepositoryName.createUnvalidated("canonical2~")),
+ RepositoryName.createUnvalidated("canonical2+")),
RepositoryName.MAIN);
CommandLine commandLine1 =
getCommandLine(
mainRepoMapping,
"""
args = ruleContext.actions.args()
-args.add_all(depset([Label("@@canonical1~//foo:bar"), Label("@@canonical2~//foo:bar")]))
+args.add_all(depset([Label("@@canonical1+//foo:bar"), Label("@@canonical2+//foo:bar")]))
""");
CommandLine commandLine2 =
getCommandLine(
mainRepoMapping,
"""
args = ruleContext.actions.args()
- args.add_all([Label("@@canonical1~//foo:bar"), str(Label("@@canonical2~//foo:bar"))])
+ args.add_all([Label("@@canonical1+//foo:bar"), str(Label("@@canonical2+//foo:bar"))])
""");
assertThat(getArguments(commandLine1, PathMapper.NOOP))
diff --git a/src/test/java/com/google/devtools/build/lib/starlarkbuildapi/core/ContextGuardedValueTest.java b/src/test/java/com/google/devtools/build/lib/starlarkbuildapi/core/ContextGuardedValueTest.java
index 3b6bc1c1849aca..0695c2474d8349 100644
--- a/src/test/java/com/google/devtools/build/lib/starlarkbuildapi/core/ContextGuardedValueTest.java
+++ b/src/test/java/com/google/devtools/build/lib/starlarkbuildapi/core/ContextGuardedValueTest.java
@@ -57,18 +57,18 @@ public void workspaceRepo_doesntMatchCommonSubstr() throws Exception {
@Test
public void bzlmodRepo_matchesStart() throws Exception {
- assertAllowed("@rules_foo~override//tools/lang", "@rules_foo//");
- assertAllowed("@rules_foo~v1.2.3//tools/lang", "@rules_foo//");
+ assertAllowed("@rules_foo+override//tools/lang", "@rules_foo//");
+ assertAllowed("@rules_foo+1.2.3//tools/lang", "@rules_foo//");
}
@Test
public void bzlmodRepo_matchesWithin() throws Exception {
- assertAllowed("@rules_lang~override~ext~foo_helper//tools/lang", "@foo_helper//");
+ assertAllowed("@rules_lang+override+ext+foo_helper//tools/lang", "@foo_helper//");
}
@Test
public void bzlmodRepo_doesntMatchCommonSubstr() throws Exception {
- assertNotAllowed("@rules_lang~override~ext~my_foo_helper_lib//tools/lang", "@foo_helper//");
+ assertNotAllowed("@rules_lang+override+ext+my_foo_helper_lib//tools/lang", "@foo_helper//");
}
@Test
@@ -84,14 +84,14 @@ public void verifySomeRealisticCases() throws Exception {
// Python with bzlmod
assertAllowed(
- "@rules_python~override~internal_deps~rules_python_internal//private", "@rules_python//");
+ "@rules_python+override+internal_deps+rules_python_internal//private", "@rules_python//");
// CC with workspace
assertAllowed("@//tools/build_defs/cc", "@//tools/build_defs/cc");
assertNotAllowed("@rules_cc_helper//tools/build_defs/cc", "@rules_cc//");
// CC with Bzlmod
- assertAllowed("@rules_cc~v1.2.3~ext_name~local_cc_config//foo", "@local_cc_config//");
+ assertAllowed("@rules_cc+1.2.3+ext_name+local_cc_config//foo", "@local_cc_config//");
}
private Object createClientData(String callerLabelStr) {
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/BUILD b/src/test/java/com/google/devtools/build/lib/testutil/BUILD
index 199065a6cf6f47..6a995774656026 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/testutil/BUILD
@@ -257,7 +257,7 @@ write_file(
content = [
"package com.google.devtools.build.lib.testutil;",
"class RulesCcRepoName {",
- " protected static final String CANONICAL_REPO_NAME = \"%s\";" % get_canonical_repo_name("@rules_cc"),
+ " protected static final String CANONICAL_REPO_NAME = \"%s\";" % get_canonical_repo_name("@rules_cc").replace("+", "~"),
"}",
],
)
diff --git a/src/test/java/com/google/devtools/build/lib/util/ShellEscaperTest.java b/src/test/java/com/google/devtools/build/lib/util/ShellEscaperTest.java
index d0089323a446dc..a686ae7671970d 100644
--- a/src/test/java/com/google/devtools/build/lib/util/ShellEscaperTest.java
+++ b/src/test/java/com/google/devtools/build/lib/util/ShellEscaperTest.java
@@ -42,10 +42,10 @@ public void shellEscape() throws Exception {
assertThat(escapeString("${filename%.c}.o")).isEqualTo("'${filename%.c}.o'");
assertThat(escapeString("")).isEqualTo("''");
assertThat(escapeString("~not_home")).isEqualTo("'~not_home'");
- assertThat(escapeString("external/protobuf~v3.19.6/src/google"))
- .isEqualTo("external/protobuf~v3.19.6/src/google");
- assertThat(escapeString("external/~install_dev_dependencies~foo/pkg"))
- .isEqualTo("external/~install_dev_dependencies~foo/pkg");
+ assertThat(escapeString("external/protobuf+3.19.6/src/goo~gle"))
+ .isEqualTo("external/protobuf+3.19.6/src/goo~gle");
+ assertThat(escapeString("external/+install_dev_dependencies+foo/pkg"))
+ .isEqualTo("external/+install_dev_dependencies+foo/pkg");
}
@Test
diff --git a/src/test/py/bazel/bazel_external_repository_test.py b/src/test/py/bazel/bazel_external_repository_test.py
index 7587bf03509289..a045d0d2ceb293 100644
--- a/src/test/py/bazel/bazel_external_repository_test.py
+++ b/src/test/py/bazel/bazel_external_repository_test.py
@@ -322,7 +322,7 @@ def testDeletedPackagesOnExternalRepo(self):
)
self.AssertExitCode(exit_code, 1, stderr)
self.assertIn(
- "'@@_main~_repo_rules~other_repo//pkg/ignore' is a subpackage",
+ "'@@+_repo_rules+other_repo//pkg/ignore' is a subpackage",
''.join(stderr),
)
@@ -331,7 +331,7 @@ def testDeletedPackagesOnExternalRepo(self):
'build',
'@other_repo//pkg:file',
# TODO(bzlmod): support apparent repo name for --deleted_packages
- '--deleted_packages=@@_main~_repo_rules~other_repo//pkg/ignore',
+ '--deleted_packages=@@+_repo_rules+other_repo//pkg/ignore',
],
cwd=work_dir,
)
@@ -360,7 +360,7 @@ def testBazelignoreFileOnExternalRepo(self):
)
self.AssertExitCode(exit_code, 1, stderr)
self.assertIn(
- "'@@_main~_repo_rules~other_repo//pkg/ignore' is a subpackage",
+ "'@@+_repo_rules+other_repo//pkg/ignore' is a subpackage",
''.join(stderr),
)
@@ -381,7 +381,7 @@ def testBazelignoreFileOnExternalRepo(self):
)
self.AssertExitCode(exit_code, 1, stderr)
self.assertIn(
- "no such package '@@_main~_repo_rules~other_repo//pkg/ignore'",
+ "no such package '@@+_repo_rules+other_repo//pkg/ignore'",
''.join(stderr),
)
diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py
index e80c253620894b..f8ae542de5c176 100644
--- a/src/test/py/bazel/bazel_windows_cpp_test.py
+++ b/src/test/py/bazel/bazel_windows_cpp_test.py
@@ -383,7 +383,7 @@ def testDLLIsCopiedFromExternalRepo(self):
# Test if A.dll is copied to the directory of main.exe
main_bin = os.path.join(bazel_bin, 'main.exe')
self.assertTrue(os.path.exists(main_bin))
- self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_4b00e9cb.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_729d833d.dll')))
# Run the binary to see if it runs successfully
_, stdout, _ = self.RunProgram([main_bin])
diff --git a/src/test/py/bazel/bzlmod/bazel_fetch_test.py b/src/test/py/bazel/bzlmod/bazel_fetch_test.py
index 5a3a925a406b9d..acb252f1c4a2f9 100644
--- a/src/test/py/bazel/bzlmod/bazel_fetch_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_fetch_test.py
@@ -107,9 +107,9 @@ def testFetchAll(self):
self.RunBazel(['fetch'])
_, stdout, _ = self.RunBazel(['info', 'output_base'])
repos_fetched = os.listdir(stdout[0] + '/external')
- self.assertIn('aaa~', repos_fetched)
- self.assertIn('bbb~', repos_fetched)
- self.assertIn('_main~ext~hello', repos_fetched)
+ self.assertIn('aaa+', repos_fetched)
+ self.assertIn('bbb+', repos_fetched)
+ self.assertIn('+ext+hello', repos_fetched)
def testFetchConfig(self):
self.main_registry.createCcModule('aaa', '1.0').createCcModule(
@@ -147,9 +147,9 @@ def testFetchConfig(self):
self.RunBazel(['fetch', '--configure'])
_, stdout, _ = self.RunBazel(['info', 'output_base'])
repos_fetched = os.listdir(stdout[0] + '/external')
- self.assertNotIn('aaa~', repos_fetched)
- self.assertNotIn('_main~ext~notConfig', repos_fetched)
- self.assertIn('_main~ext~IamConfig', repos_fetched)
+ self.assertNotIn('aaa+', repos_fetched)
+ self.assertNotIn('+ext+notConfig', repos_fetched)
+ self.assertIn('+ext+IamConfig', repos_fetched)
def testFetchFailsWithMultipleOptions(self):
exit_code, _, stderr = self.RunBazel(
@@ -185,12 +185,12 @@ def testFetchRepo(self):
)
self.ScratchFile('BUILD')
# Test canonical/apparent repo names & multiple repos
- self.RunBazel(['fetch', '--repo=@@bbb~', '--repo=@my_repo'])
+ self.RunBazel(['fetch', '--repo=@@bbb+', '--repo=@my_repo'])
_, stdout, _ = self.RunBazel(['info', 'output_base'])
repos_fetched = os.listdir(stdout[0] + '/external')
- self.assertIn('bbb~', repos_fetched)
- self.assertIn('ccc~', repos_fetched)
- self.assertNotIn('aaa~', repos_fetched)
+ self.assertIn('bbb+', repos_fetched)
+ self.assertIn('ccc+', repos_fetched)
+ self.assertNotIn('aaa+', repos_fetched)
def testFetchInvalidRepo(self):
# Invalid repo name (not canonical or apparent)
diff --git a/src/test/py/bazel/bzlmod/bazel_lockfile_test.py b/src/test/py/bazel/bzlmod/bazel_lockfile_test.py
index f8c12e800fa1db..b4ecccaadae6ab 100644
--- a/src/test/py/bazel/bzlmod/bazel_lockfile_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_lockfile_test.py
@@ -439,7 +439,7 @@ def testIsolatedAndNonIsolatedModuleExtensions(self):
with open(self.Path('MODULE.bazel.lock'), 'r') as f:
lockfile = json.loads(f.read().strip())
self.assertIn(
- '//:extension.bzl%lockfile_ext%~lockfile_ext_1',
+ '//:extension.bzl%lockfile_ext%+lockfile_ext_1',
lockfile['moduleExtensions'],
)
self.assertIn(
@@ -485,7 +485,7 @@ def testUpdateIsolatedModuleExtension(self):
with open(self.Path('MODULE.bazel.lock'), 'r') as f:
lockfile = json.loads(f.read().strip())
self.assertIn(
- '//:extension.bzl%lockfile_ext%~lockfile_ext',
+ '//:extension.bzl%lockfile_ext%+lockfile_ext',
lockfile['moduleExtensions'],
)
self.assertNotIn(
@@ -509,7 +509,7 @@ def testUpdateIsolatedModuleExtension(self):
with open(self.Path('MODULE.bazel.lock'), 'r') as f:
lockfile = json.loads(f.read().strip())
self.assertNotIn(
- '//:extension.bzl%lockfile_ext%~lockfile_ext',
+ '//:extension.bzl%lockfile_ext%+lockfile_ext',
lockfile['moduleExtensions'],
)
self.assertIn(
@@ -1755,7 +1755,7 @@ def testExtensionRepoMappingChange(self):
)
_, _, stderr = self.RunBazel(['build', ':lol'])
- self.assertIn('STR=@@foo~//:lib_foo', '\n'.join(stderr))
+ self.assertIn('STR=@@foo+//:lib_foo', '\n'.join(stderr))
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -1779,7 +1779,7 @@ def testExtensionRepoMappingChange(self):
_, _, stderr = self.RunBazel(['build', ':lol'])
stderr = '\n'.join(stderr)
self.assertIn('ran the extension!', stderr)
- self.assertIn('STR=@@bar~//:lib_foo', stderr)
+ self.assertIn('STR=@@bar+//:lib_foo', stderr)
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -1798,7 +1798,7 @@ def testExtensionRepoMappingChange(self):
_, _, stderr = self.RunBazel(['build', ':lol'])
stderr = '\n'.join(stderr)
self.assertNotIn('ran the extension!', stderr)
- self.assertIn('STR=@@bar~//:lib_foo', stderr)
+ self.assertIn('STR=@@bar+//:lib_foo', stderr)
def testExtensionRepoMappingChange_BzlInit(self):
# Regression test for #20721; same test as above, except that the call to
@@ -1838,7 +1838,7 @@ def testExtensionRepoMappingChange_BzlInit(self):
)
_, _, stderr = self.RunBazel(['build', ':lol'])
- self.assertIn('STR=@@foo~//:lib_foo', '\n'.join(stderr))
+ self.assertIn('STR=@@foo+//:lib_foo', '\n'.join(stderr))
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -1862,7 +1862,7 @@ def testExtensionRepoMappingChange_BzlInit(self):
_, _, stderr = self.RunBazel(['build', ':lol'])
stderr = '\n'.join(stderr)
self.assertIn('ran the extension!', stderr)
- self.assertIn('STR=@@bar~//:lib_foo', stderr)
+ self.assertIn('STR=@@bar+//:lib_foo', stderr)
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -1881,7 +1881,7 @@ def testExtensionRepoMappingChange_BzlInit(self):
_, _, stderr = self.RunBazel(['build', ':lol'])
stderr = '\n'.join(stderr)
self.assertNotIn('ran the extension!', stderr)
- self.assertIn('STR=@@bar~//:lib_foo', stderr)
+ self.assertIn('STR=@@bar+//:lib_foo', stderr)
def testExtensionRepoMappingChange_loadsAndRepoRelativeLabels(self):
# Regression test for #20721; same test as above, except that the call to
@@ -1936,7 +1936,7 @@ def testExtensionRepoMappingChange_loadsAndRepoRelativeLabels(self):
)
_, _, stderr = self.RunBazel(['build', ':lol'])
- self.assertIn('STR=@@foo~//:BUILD', '\n'.join(stderr))
+ self.assertIn('STR=@@foo+//:BUILD', '\n'.join(stderr))
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -1957,7 +1957,7 @@ def testExtensionRepoMappingChange_loadsAndRepoRelativeLabels(self):
],
)
_, _, stderr = self.RunBazel(['build', ':lol'])
- self.assertIn('STR=@@bar~//:BUILD', '\n'.join(stderr))
+ self.assertIn('STR=@@bar+//:BUILD', '\n'.join(stderr))
def testExtensionRepoMappingChange_sourceRepoNoLongerExistent(self):
# Regression test for #20721; verify that an old recorded repo mapping entry
@@ -1994,7 +1994,7 @@ def testExtensionRepoMappingChange_sourceRepoNoLongerExistent(self):
)
_, _, stderr = self.RunBazel(['build', ':lol'])
- self.assertIn('STR=@@foo~//:lib_foo', '\n'.join(stderr))
+ self.assertIn('STR=@@foo+//:lib_foo', '\n'.join(stderr))
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
@@ -2012,7 +2012,7 @@ def testExtensionRepoMappingChange_sourceRepoNoLongerExistent(self):
extension = lockfile['moduleExtensions']['//:ext.bzl%ext']['general']
self.assertIn('recordedRepoMappingEntries', extension)
extension['recordedRepoMappingEntries'].append(
- ['_unknown_source_repo', 'other_name', 'bar~']
+ ['_unknown_source_repo', 'other_name', 'bar+']
)
with open(self.Path('MODULE.bazel.lock'), 'w') as f:
@@ -2022,7 +2022,7 @@ def testExtensionRepoMappingChange_sourceRepoNoLongerExistent(self):
_, _, stderr = self.RunBazel(['build', ':lol'])
stderr = '\n'.join(stderr)
self.assertIn('ran the extension!', stderr)
- self.assertIn('STR=@@foo~//:lib_foo', stderr)
+ self.assertIn('STR=@@foo+//:lib_foo', stderr)
def testExtensionRepoMappingChange_mainRepoEvalCycleWithWorkspace(self):
# Regression test for #20942
@@ -2060,7 +2060,7 @@ def testExtensionRepoMappingChange_mainRepoEvalCycleWithWorkspace(self):
self.ScratchFile('WORKSPACE.bzlmod', ['load("@repo//:defs.bzl","STR")'])
_, _, stderr = self.RunBazel(['build', '--enable_workspace', ':lol'])
- self.assertIn('STR=@@foo~//:lib_foo', '\n'.join(stderr))
+ self.assertIn('STR=@@foo+//:lib_foo', '\n'.join(stderr))
# Shutdown bazel to make sure we rely on the lockfile and not skyframe
self.RunBazel(['shutdown'])
diff --git a/src/test/py/bazel/bzlmod/bazel_module_test.py b/src/test/py/bazel/bzlmod/bazel_module_test.py
index 8ff5efd3fdffc3..ff9e3abbb705a9 100644
--- a/src/test/py/bazel/bzlmod/bazel_module_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_module_test.py
@@ -271,8 +271,10 @@ def testRepositoryRuleErrorInModuleExtensionFailsTheBuild(self):
allow_failure=True)
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
- "ERROR: : //pkg:_main~module_ext~foo: no such attribute 'invalid_attr' in 'repo_rule' rule",
- stderr)
+ 'ERROR: : //pkg:+module_ext+foo: no such attribute'
+ " 'invalid_attr' in 'repo_rule' rule",
+ stderr,
+ )
self.assertTrue(
any([
'/pkg/extension.bzl", line 3, column 14, in _module_ext_impl'
@@ -424,10 +426,10 @@ def testNativePackageRelativeLabel(self):
_, _, stderr = self.RunBazel(['build', '@bar//quux:book'])
stderr = '\n'.join(stderr)
- self.assertIn('1st: @@bar~//quux:bleb', stderr)
- self.assertIn('2nd: @@bar~//bleb:bleb', stderr)
+ self.assertIn('1st: @@bar+//quux:bleb', stderr)
+ self.assertIn('2nd: @@bar+//bleb:bleb', stderr)
self.assertIn('3rd: @@//bleb:bleb', stderr)
- self.assertIn('4th: @@bar~//bleb:bleb', stderr)
+ self.assertIn('4th: @@bar+//bleb:bleb', stderr)
self.assertIn('5th: @@bleb//bleb:bleb', stderr)
self.assertIn('6th: @@//bleb:bleb', stderr)
@@ -471,10 +473,10 @@ def testWorkspaceEvaluatedBzlCanSeeRootModuleMappings(self):
stderr = '\n'.join(stderr)
# @bar is mapped to @@baz, which Bzlmod doesn't recognize, so we leave it be
self.assertIn('1st: @@baz//:z', stderr)
- # @my_aaa is mapped to @@aaa, which Bzlmod remaps to @@aaa~
- self.assertIn('2nd: @@aaa~//:z', stderr)
- # @bbb isn't mapped in WORKSPACE, but Bzlmod maps it to @@bbb~
- self.assertIn('3rd: @@bbb~//:z', stderr)
+ # @my_aaa is mapped to @@aaa, which Bzlmod remaps to @@aaa+
+ self.assertIn('2nd: @@aaa+//:z', stderr)
+ # @bbb isn't mapped in WORKSPACE, but Bzlmod maps it to @@bbb+
+ self.assertIn('3rd: @@bbb+//:z', stderr)
# @blarg isn't mapped by WORKSPACE or Bzlmod
self.assertIn('4th: @@blarg//:z', stderr)
@@ -664,9 +666,9 @@ def testNativeModuleNameAndVersion(self):
)
stderr = '\n'.join(stderr)
self.assertIn('@@ reporting in: root@0.1', stderr)
- self.assertIn('@@foo~ reporting in: foo@1.0', stderr)
- self.assertIn('@@foo~~report_ext~report_repo reporting in: foo@1.0', stderr)
- self.assertIn('@@bar~ reporting in: bar@2.0', stderr)
+ self.assertIn('@@foo+ reporting in: foo@1.0', stderr)
+ self.assertIn('@@foo++report_ext+report_repo reporting in: foo@1.0', stderr)
+ self.assertIn('@@bar+ reporting in: bar@2.0', stderr)
self.assertIn('@@quux reporting in: None@None', stderr)
def testWorkspaceToolchainRegistrationWithPlatformsConstraint(self):
@@ -812,7 +814,7 @@ def testLocationNonRegistry(self):
)
self.ScratchFile('hello/MODULE.bazel', ['wat'])
_, _, stderr = self.RunBazel(['build', '@what'], allow_failure=True)
- self.assertIn('ERROR: @@hello~//:MODULE.bazel', '\n'.join(stderr))
+ self.assertIn('ERROR: @@hello+//:MODULE.bazel', '\n'.join(stderr))
def testLoadRulesJavaSymbolThroughBazelTools(self):
"""Tests that loads from @bazel_tools that delegate to other modules resolve."""
diff --git a/src/test/py/bazel/bzlmod/bazel_overrides_test.py b/src/test/py/bazel/bzlmod/bazel_overrides_test.py
index 7b377a8a10f977..0f6ebf8d728472 100644
--- a/src/test/py/bazel/bzlmod/bazel_overrides_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_overrides_test.py
@@ -437,7 +437,7 @@ def testCmdAbsoluteModuleOverride(self):
)
# module file override should be ignored, and bb directory should be used
self.assertIn(
- 'Target @@ss~//:choose_me up-to-date (nothing to build)', stderr
+ 'Target @@ss+//:choose_me up-to-date (nothing to build)', stderr
)
def testCmdRelativeModuleOverride(self):
@@ -475,7 +475,7 @@ def testCmdRelativeModuleOverride(self):
cwd=self.Path('aa/cc'),
)
self.assertIn(
- 'Target @@ss~//:choose_me up-to-date (nothing to build)', stderr
+ 'Target @@ss+//:choose_me up-to-date (nothing to build)', stderr
)
# Test delete previous overrides
@@ -531,7 +531,7 @@ def testCmdWorkspaceRelativeModuleOverride(self):
cwd=self.Path('aa'),
)
self.assertIn(
- 'Target @@ss~//:choose_me up-to-date (nothing to build)', stderr
+ 'Target @@ss+//:choose_me up-to-date (nothing to build)', stderr
)
def testLocalPathOverrideErrorResolved(self):
diff --git a/src/test/py/bazel/bzlmod/bazel_repo_mapping_test.py b/src/test/py/bazel/bzlmod/bazel_repo_mapping_test.py
index 36c136411688b3..0e89aa970e9590 100644
--- a/src/test/py/bazel/bzlmod/bazel_repo_mapping_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_repo_mapping_test.py
@@ -166,12 +166,12 @@ def testRunfilesRepoMappingManifest(self):
with open(self.Path(path), 'r') as f:
self.assertEqual(
f.read().strip(),
- """,foo,foo~
+ """,foo,foo+
,me,_main
,me_ws,_main
-foo~,foo,foo~
-foo~,quux,quux~v1.0
-quux~v1.0,quux,quux~v1.0""",
+foo+,foo,foo+
+foo+,quux,quux+1.0
+quux+1.0,quux,quux+1.0""",
)
with open(self.Path('bazel-bin/me.runfiles_manifest')) as f:
self.assertIn('_repo_mapping ', f.read())
@@ -183,18 +183,18 @@ def testRunfilesRepoMappingManifest(self):
'--test_output=errors',
])
- paths = ['bazel-bin/external/bar~/bar.repo_mapping']
+ paths = ['bazel-bin/external/bar+/bar.repo_mapping']
if not self.IsWindows():
- paths.append('bazel-bin/external/bar~/bar.runfiles/_repo_mapping')
+ paths.append('bazel-bin/external/bar+/bar.runfiles/_repo_mapping')
for path in paths:
with open(self.Path(path), 'r') as f:
self.assertEqual(
f.read().strip(),
- """bar~,bar,bar~
-bar~,quux,quux~v2.0
-quux~v2.0,quux,quux~v2.0""",
+ """bar+,bar,bar+
+bar+,quux,quux+2.0
+quux+2.0,quux,quux+2.0""",
)
- with open(self.Path('bazel-bin/external/bar~/bar.runfiles_manifest')) as f:
+ with open(self.Path('bazel-bin/external/bar+/bar.runfiles_manifest')) as f:
self.assertIn('_repo_mapping ', f.read())
def testBashRunfilesLibraryRepoMapping(self):
diff --git a/src/test/py/bazel/bzlmod/bazel_vendor_test.py b/src/test/py/bazel/bzlmod/bazel_vendor_test.py
index 578c988ff722b4..3796886b90c17c 100644
--- a/src/test/py/bazel/bzlmod/bazel_vendor_test.py
+++ b/src/test/py/bazel/bzlmod/bazel_vendor_test.py
@@ -98,10 +98,10 @@ def testBasicVendoring(self):
# Assert repos are vendored with marker files and VENDOR.bazel is created
vendor_dir = self._test_cwd + '/vendor'
repos_vendored = os.listdir(vendor_dir)
- self.assertIn('aaa~', repos_vendored)
- self.assertIn('bbb~', repos_vendored)
- self.assertIn('@aaa~.marker', repos_vendored)
- self.assertIn('@bbb~.marker', repos_vendored)
+ self.assertIn('aaa+', repos_vendored)
+ self.assertIn('bbb+', repos_vendored)
+ self.assertIn('@aaa+.marker', repos_vendored)
+ self.assertIn('@bbb+.marker', repos_vendored)
self.assertIn('VENDOR.bazel', repos_vendored)
# Update bbb to 2.0 and re-vendor
@@ -114,11 +114,11 @@ def testBasicVendoring(self):
'path="platforms_mock")',
],
)
- self.ScratchFile('vendor/bbb~/foo')
+ self.ScratchFile('vendor/bbb+/foo')
self.RunBazel(['vendor', '--vendor_dir=vendor'])
- bbb_module_bazel = os.path.join(vendor_dir, 'bbb~/MODULE.bazel')
+ bbb_module_bazel = os.path.join(vendor_dir, 'bbb+/MODULE.bazel')
self.AssertFileContentContains(bbb_module_bazel, 'version = "2.0"')
- foo = os.path.join(vendor_dir, 'bbb~/foo')
+ foo = os.path.join(vendor_dir, 'bbb+/foo')
self.assertFalse(
os.path.exists(foo)
) # foo should be removed due to re-vendor
@@ -156,11 +156,11 @@ def testVendorAfterFetch(self):
)
self.ScratchFile('BUILD')
- self.RunBazel(['fetch', '--repo=@@aaa~'])
- self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@@aaa~'])
+ self.RunBazel(['fetch', '--repo=@@aaa+'])
+ self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@@aaa+'])
repos_vendored = os.listdir(self._test_cwd + '/vendor')
- self.assertIn('aaa~', repos_vendored)
+ self.assertIn('aaa+', repos_vendored)
def testVendoringMultipleTimes(self):
self.main_registry.createCcModule('aaa', '1.0')
@@ -184,7 +184,7 @@ def testVendoringMultipleTimes(self):
self.RunBazel(['vendor', '--vendor_dir=vendor'])
_, stdout, _ = self.RunBazel(['info', 'output_base'])
- repo_path = stdout[0] + '/external/aaa~'
+ repo_path = stdout[0] + '/external/aaa+'
self.AssertPathIsSymlink(repo_path)
def testVendorRepo(self):
@@ -204,12 +204,12 @@ def testVendorRepo(self):
self.ScratchFile('BUILD')
# Test canonical/apparent repo names & multiple repos
self.RunBazel(
- ['vendor', '--vendor_dir=vendor', '--repo=@@bbb~', '--repo=@my_repo']
+ ['vendor', '--vendor_dir=vendor', '--repo=@@bbb+', '--repo=@my_repo']
)
repos_vendored = os.listdir(self._test_cwd + '/vendor')
- self.assertIn('bbb~', repos_vendored)
- self.assertIn('ccc~', repos_vendored)
- self.assertNotIn('aaa~', repos_vendored)
+ self.assertIn('bbb+', repos_vendored)
+ self.assertIn('ccc+', repos_vendored)
+ self.assertNotIn('aaa+', repos_vendored)
def testVendorExistingRepo(self):
self.main_registry.createCcModule('aaa', '1.0')
@@ -225,7 +225,7 @@ def testVendorExistingRepo(self):
self.ScratchFile('BUILD')
# Test canonical/apparent repo names & multiple repos
self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@my_repo'])
- self.assertIn('aaa~', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('aaa+', os.listdir(self._test_cwd + '/vendor'))
# Delete repo from external cache
self.RunBazel(['clean', '--expunge'])
@@ -341,24 +341,24 @@ def testIgnoreFromVendoring(self):
os.makedirs(self._test_cwd + '/vendor', exist_ok=True)
with open(self._test_cwd + '/vendor/VENDOR.bazel', 'w') as f:
- f.write("ignore('@@_main~ext~regularRepo')\n")
+ f.write("ignore('@@+ext+regularRepo')\n")
self.RunBazel(['vendor', '--vendor_dir=vendor'])
repos_vendored = os.listdir(self._test_cwd + '/vendor')
# Assert aaa & bbb are vendored with marker files
- self.assertIn('aaa~', repos_vendored)
- self.assertIn('bbb~', repos_vendored)
- self.assertIn('@bbb~.marker', repos_vendored)
- self.assertIn('@aaa~.marker', repos_vendored)
+ self.assertIn('aaa+', repos_vendored)
+ self.assertIn('bbb+', repos_vendored)
+ self.assertIn('@bbb+.marker', repos_vendored)
+ self.assertIn('@aaa+.marker', repos_vendored)
# Assert regular repo (from VENDOR.bazel), local and config repos are
# not vendored
self.assertNotIn('bazel_tools', repos_vendored)
self.assertNotIn('local_config_platform', repos_vendored)
- self.assertNotIn('_main~ext~localRepo', repos_vendored)
- self.assertNotIn('_main~ext~configRepo', repos_vendored)
- self.assertNotIn('_main~ext~regularRepo', repos_vendored)
+ self.assertNotIn('+ext+localRepo', repos_vendored)
+ self.assertNotIn('+ext+configRepo', repos_vendored)
+ self.assertNotIn('+ext+regularRepo', repos_vendored)
def testBuildingWithPinnedRepo(self):
self.ScratchFile(
@@ -384,7 +384,7 @@ def testBuildingWithPinnedRepo(self):
self.ScratchFile('BUILD')
self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@venRepo'])
- self.assertIn('_main~ext~venRepo', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('+ext+venRepo', os.listdir(self._test_cwd + '/vendor'))
self.ScratchFile(
'extension.bzl',
[
@@ -402,16 +402,16 @@ def testBuildingWithPinnedRepo(self):
# Pin the repo then build, should build what is under vendor
# directory with no warning
with open(self._test_cwd + '/vendor/VENDOR.bazel', 'w') as f:
- f.write("pin('@@_main~ext~venRepo')\n")
+ f.write("pin('@@+ext+venRepo')\n")
_, _, stderr = self.RunBazel(
['build', '@venRepo//:all', '--vendor_dir=vendor'],
)
self.assertNotIn(
- "Vendored repository '_main~ext~venRepo' is out-of-date.",
+ "Vendored repository '+ext+venRepo' is out-of-date.",
'\n'.join(stderr),
)
self.assertIn(
- 'Target @@_main~ext~venRepo//:lala up-to-date (nothing to build)',
+ 'Target @@+ext+venRepo//:lala up-to-date (nothing to build)',
stderr,
)
@@ -422,12 +422,11 @@ def testBuildingWithPinnedRepo(self):
['build', '@venRepo//:all', '--vendor_dir=vendor'],
)
self.assertIn(
- 'Target @@_main~ext~venRepo//:IhaveChanged up-to-date (nothing to'
- ' build)',
+ 'Target @@+ext+venRepo//:IhaveChanged up-to-date (nothing to build)',
stderr,
)
self.assertIn(
- "Vendored repository '_main~ext~venRepo' is out-of-date.",
+ "Vendored repository '+ext+venRepo' is out-of-date.",
'\n'.join(stderr),
)
@@ -437,7 +436,7 @@ def testBuildingWithPinnedRepo(self):
['build', '@venRepo//:all', '--vendor_dir=vendor'],
)
self.assertNotIn(
- "Vendored repository '_main~ext~venRepo' is out-of-date.",
+ "Vendored repository '+ext+venRepo' is out-of-date.",
'\n'.join(stderr),
)
@@ -466,12 +465,12 @@ def testBuildingOutOfDateVendoredRepo(self):
# Vendor, assert and build with no problems
self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@justRepo'])
- self.assertIn('_main~ext~justRepo', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('+ext+justRepo', os.listdir(self._test_cwd + '/vendor'))
_, _, stderr = self.RunBazel(
['build', '@justRepo//:all', '--vendor_dir=vendor']
)
self.assertNotIn(
- "WARNING: : Vendored repository '_main~ext~justRepo' is"
+ "WARNING: : Vendored repository '+ext+justRepo' is"
' out-of-date. The up-to-date version will be fetched into the external'
' cache and used. To update the repo in the vendor directory, run'
' the bazel vendor command',
@@ -501,14 +500,14 @@ def testBuildingOutOfDateVendoredRepo(self):
# Assert repo in vendor is out-of-date, and the new one is fetched into
# external and not a symlink
self.assertIn(
- "WARNING: : Vendored repository '_main~ext~justRepo' is"
+ "WARNING: : Vendored repository '+ext+justRepo' is"
' out-of-date. The up-to-date version will be fetched into the external'
' cache and used. To update the repo in the vendor directory, run'
' the bazel vendor command',
stderr,
)
_, stdout, _ = self.RunBazel(['info', 'output_base'])
- self.assertFalse(os.path.islink(stdout[0] + '/external/bbb~'))
+ self.assertFalse(os.path.islink(stdout[0] + '/external/bbb+'))
# Assert vendoring again solves the problem
self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@justRepo'])
@@ -517,7 +516,7 @@ def testBuildingOutOfDateVendoredRepo(self):
['build', '@justRepo//:all', '--vendor_dir=vendor']
)
self.assertNotIn(
- "WARNING: : Vendored repository '_main~ext~justRepo' is"
+ "WARNING: : Vendored repository '+ext+justRepo' is"
' out-of-date. The up-to-date version will be fetched into the external'
' cache and used. To update the repo in the vendor directory, run'
' the bazel vendor command',
@@ -549,7 +548,7 @@ def testBuildingVendoredRepoWithNoFetch(self):
# Vendor, assert and build with no problems
self.RunBazel(['vendor', '--vendor_dir=vendor', '@venRepo//:all'])
- self.assertIn('_main~ext~venRepo', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('+ext+venRepo', os.listdir(self._test_cwd + '/vendor'))
# Make updates in repo definition
self.ScratchFile(
@@ -581,7 +580,7 @@ def testBuildingVendoredRepoWithNoFetch(self):
allow_failure=True,
)
self.assertIn(
- 'ERROR: Vendored repository _main~ext~noVenRepo not found under the'
+ 'ERROR: Vendored repository +ext+noVenRepo not found under the'
' vendor directory and fetching is disabled. To fix, run the bazel'
" vendor command or build without the '--nofetch'",
stderr,
@@ -593,14 +592,14 @@ def testBuildingVendoredRepoWithNoFetch(self):
['build', '@venRepo//:all', '--vendor_dir=vendor', '--nofetch'],
)
self.assertIn(
- "WARNING: : Vendored repository '_main~ext~venRepo' is"
+ "WARNING: : Vendored repository '+ext+venRepo' is"
' out-of-date and fetching is disabled. Run build without the'
" '--nofetch' option or run the bazel vendor command to update it",
stderr,
)
# Assert the out-dated repo is the one built with
self.assertIn(
- 'Target @@_main~ext~venRepo//:lala up-to-date (nothing to build)',
+ 'Target @@+ext+venRepo//:lala up-to-date (nothing to build)',
stderr,
)
@@ -622,9 +621,9 @@ def testBasicVendorTarget(self):
['vendor', '@aaa//:lib_aaa', '@bbb//:lib_bbb', '--vendor_dir=vendor']
)
# Assert aaa & bbb and are vendored
- self.assertIn('aaa~', os.listdir(self._test_cwd + '/vendor'))
- self.assertIn('bbb~', os.listdir(self._test_cwd + '/vendor'))
- self.assertNotIn('ccc~', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('aaa+', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('bbb+', os.listdir(self._test_cwd + '/vendor'))
+ self.assertNotIn('ccc+', os.listdir(self._test_cwd + '/vendor'))
# Delete vendor source and re-vendor should work without server restart
def on_rm_error(func, path, exc_info):
@@ -636,9 +635,9 @@ def on_rm_error(func, path, exc_info):
self.RunBazel(
['vendor', '@aaa//:lib_aaa', '@bbb//:lib_bbb', '--vendor_dir=vendor']
)
- self.assertIn('aaa~', os.listdir(self._test_cwd + '/vendor'))
- self.assertIn('bbb~', os.listdir(self._test_cwd + '/vendor'))
- self.assertNotIn('ccc~', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('aaa+', os.listdir(self._test_cwd + '/vendor'))
+ self.assertIn('bbb+', os.listdir(self._test_cwd + '/vendor'))
+ self.assertNotIn('ccc+', os.listdir(self._test_cwd + '/vendor'))
def testBuildVendoredTargetOffline(self):
self.main_registry.createCcModule('aaa', '1.0').createCcModule(
@@ -689,7 +688,7 @@ def testBuildVendoredTargetOffline(self):
# Assert repos in {OUTPUT_BASE}/external are symlinks (junction on
# windows, this validates it was created from vendor and not fetched)
_, stdout, _ = self.RunBazel(['info', 'output_base'])
- for repo in ['aaa~', 'bbb~']:
+ for repo in ['aaa+', 'bbb+']:
repo_path = stdout[0] + '/external/' + repo
self.AssertPathIsSymlink(repo_path)
@@ -750,7 +749,7 @@ def testVendorRepoWithSymlinks(self):
# Symlink to a file in another repo
' ctx.symlink(ctx.path(Label("@bar//:data")), "sym_bar")',
# Symlink to a directory in another repo
- ' ctx.symlink("../_main~ext~bar/pkg", "sym_pkg")',
+ ' ctx.symlink("../+ext+bar/pkg", "sym_pkg")',
(
' ctx.file("BUILD", "exports_files([\'sym_abs\','
" 'sym_foo','sym_bar', 'sym_pkg/data'])\")"
@@ -802,7 +801,7 @@ def testVendorRepoWithSymlinks(self):
_, stdout, _ = self.RunBazel(
[f'--output_base={output_base}', 'info', 'output_base']
)
- self.AssertPathIsSymlink(stdout[0] + '/external/_main~ext~foo')
+ self.AssertPathIsSymlink(stdout[0] + '/external/+ext+foo')
output = os.path.join(self._test_cwd, './bazel-bin/output.txt')
self.AssertFileContentContains(
output,
diff --git a/src/test/py/bazel/bzlmod/bzlmod_query_test.py b/src/test/py/bazel/bzlmod/bzlmod_query_test.py
index 0e1555944a5662..d6b8c4bcd3b8ad 100644
--- a/src/test/py/bazel/bzlmod/bzlmod_query_test.py
+++ b/src/test/py/bazel/bzlmod/bzlmod_query_test.py
@@ -81,7 +81,7 @@ def testQueryModuleRepoTransitiveDeps(self):
'--notool_deps',
])
self.assertListEqual(
- ['//:main', '@my_repo//:lib_aaa', '@@ccc~//:lib_ccc'], stdout
+ ['//:main', '@my_repo//:lib_aaa', '@@ccc+//:lib_ccc'], stdout
)
def testQueryModuleRepoTransitiveDeps_consistentLabels(self):
@@ -109,7 +109,7 @@ def testQueryModuleRepoTransitiveDeps_consistentLabels(self):
'--consistent_labels',
])
self.assertListEqual(
- ['@@//:main', '@@aaa~//:lib_aaa', '@@ccc~//:lib_ccc'], stdout
+ ['@@//:main', '@@aaa+//:lib_aaa', '@@ccc+//:lib_ccc'], stdout
)
def testQueryModuleRepoTransitiveDeps_consistentLabels_outputPackage(self):
@@ -137,7 +137,7 @@ def testQueryModuleRepoTransitiveDeps_consistentLabels_outputPackage(self):
'--consistent_labels',
'--output=package',
])
- self.assertListEqual(['@@//pkg', '@@aaa~//', '@@ccc~//'], stdout)
+ self.assertListEqual(['@@//pkg', '@@aaa+//', '@@ccc+//'], stdout)
def testQueryModuleRepoTransitiveDeps_consistentLabels_outputBuild(self):
self.ScratchFile(
@@ -166,7 +166,7 @@ def testQueryModuleRepoTransitiveDeps_consistentLabels_outputBuild(self):
])
# Verify that there are no non-canonical labels in the output.
stdout = '\n'.join(stdout)
- self.assertEmpty(re.findall('(? (my_project@1.0)',
- '|___$@@ext2~//:ext.bzl%ext',
- '| |___repo1',
- '|___$@@ext~//:ext.bzl%ext',
+ '|___$@@ext+//:ext.bzl%ext',
'| |___repo1',
'| |...repo2',
'| |...repo5',
+ '|___$@@ext2+//:ext.bzl%ext',
+ '| |___repo1',
'|___ext@1.0',
'|___ext2@1.0',
'|___foo@1.0',
- '| |___$@@ext~//:ext.bzl%ext ...',
+ '| |___$@@ext+//:ext.bzl%ext ...',
'| | |___repo1',
'| |___ext@1.0 (*)',
'| |___bar@2.0',
- '| |___$@@ext2~//:ext.bzl%ext ...',
+ '| |___$@@ext+//:ext.bzl%ext ...',
'| | |___repo3',
- '| |___$@@ext~//:ext.bzl%ext ...',
+ '| |___$@@ext2+//:ext.bzl%ext ...',
'| | |___repo3',
'| |___ext@1.0 (*)',
'| |___ext2@1.0 (*)',
'|___foo@2.0',
- ' |___$@@ext~//:ext.bzl%ext ...',
+ ' |___$@@ext+//:ext.bzl%ext ...',
' | |___repo3',
' | |___repo4',
' |___bar@2.0 (*)',
@@ -221,16 +221,16 @@ def testGraphWithExtensionFilter(self):
stdout,
[
' (my_project@1.0)',
- '|___$@@ext~//:ext.bzl%ext',
+ '|___$@@ext+//:ext.bzl%ext',
'| |___repo1',
'|___foo@1.0 #',
- '| |___$@@ext~//:ext.bzl%ext',
+ '| |___$@@ext+//:ext.bzl%ext',
'| | |___repo1',
'| |___bar@2.0 #',
- '| |___$@@ext~//:ext.bzl%ext',
+ '| |___$@@ext+//:ext.bzl%ext',
'| |___repo3',
'|___foo@2.0 #',
- ' |___$@@ext~//:ext.bzl%ext',
+ ' |___$@@ext+//:ext.bzl%ext',
' | |___repo3',
' | |___repo4',
' |___bar@2.0 (*)',
@@ -258,7 +258,7 @@ def testShowExtensionAllUsages(self):
self.assertListEqual(
stdout,
[
- '## @@ext~//:ext.bzl%ext:',
+ '## @@ext+//:ext.bzl%ext:',
'',
'Fetched repositories:',
' - repo1 (imported by , foo@1.0)',
@@ -313,31 +313,18 @@ def testShowExtensionSomeExtensionsSomeUsages(self):
rstrip=True,
)
self.assertRegex(
- stdout.pop(6), r'^## Usage in bar@2.0 from .*MODULE\.bazel:11$'
+ stdout.pop(9), r'^## Usage in foo@2.0 from .*MODULE\.bazel:8$'
)
self.assertRegex(
- stdout.pop(21), r'^## Usage in foo@2.0 from .*MODULE\.bazel:8$'
+ stdout.pop(16), r'^## Usage in bar@2.0 from .*MODULE\.bazel:8$'
)
self.assertRegex(
- stdout.pop(28), r'^## Usage in bar@2.0 from .*MODULE\.bazel:8$'
+ stdout.pop(28), r'^## Usage in bar@2.0 from .*MODULE\.bazel:11$'
)
self.assertListEqual(
stdout,
[
- '## @@ext2~//:ext.bzl%ext:',
- '',
- 'Fetched repositories:',
- ' - repo1 (imported by )',
- ' - repo3 (imported by bar@2.0)',
- '',
- # pop(6)
- 'ext.dep(name="repo3")',
- 'use_repo(',
- ' ext,',
- ' my_repo2="repo3",',
- ')',
- '',
- '## @@ext~//:ext.bzl%ext:',
+ '## @@ext+//:ext.bzl%ext:',
'',
'Fetched repositories:',
' - repo1 (imported by , foo@1.0)',
@@ -346,7 +333,7 @@ def testShowExtensionSomeExtensionsSomeUsages(self):
' - repo2',
' - repo5',
'',
- # pop(21)
+ # pop(9)
'ext.dep(name="repo4")',
'use_repo(',
' ext,',
@@ -354,13 +341,26 @@ def testShowExtensionSomeExtensionsSomeUsages(self):
' my_repo4="repo4",',
')',
'',
- # pop(28)
+ # pop(16)
'ext.dep(name="repo3")',
'use_repo(',
' ext,',
' my_repo3="repo3",',
')',
'',
+ '## @@ext2+//:ext.bzl%ext:',
+ '',
+ 'Fetched repositories:',
+ ' - repo1 (imported by )',
+ ' - repo3 (imported by bar@2.0)',
+ '',
+ # pop(28)
+ 'ext.dep(name="repo3")',
+ 'use_repo(',
+ ' ext,',
+ ' my_repo2="repo3",',
+ ')',
+ '',
],
'Wrong output in the show with some extensions and some usages query.',
)
@@ -392,7 +392,7 @@ def testShowExtensionWithUnknownExtension(self):
rstrip=True,
)
self.assertIn(
- 'No extension @@ext~//foo:unknown.bzl%x exists in the dependency graph',
+ 'No extension @@ext+//foo:unknown.bzl%x exists in the dependency graph',
'\n'.join(stderr),
)
@@ -427,7 +427,7 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
'## @bar_from_foo2:',
'# ',
'http_archive(',
- ' name = "bar~",',
+ ' name = "bar+",',
# pop(4) -- urls=[...]
# pop(4) -- integrity=...
' strip_prefix = "",',
@@ -436,7 +436,7 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
' remote_patches = {},',
' remote_patch_strip = 0,',
')',
- '# Rule bar~ instantiated at (most recent call last):',
+ '# Rule bar+ instantiated at (most recent call last):',
'# in ',
'# Rule http_archive defined at (most recent call last):',
# pop(13)
@@ -444,19 +444,19 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
'## ext@1.0:',
'# ',
'local_repository(',
- ' name = "ext~",',
+ ' name = "ext+",',
# pop(19) -- path=...
')',
- '# Rule ext~ instantiated at (most recent call last):',
+ '# Rule ext+ instantiated at (most recent call last):',
'# in ',
'',
'## @my_repo3:',
'# ',
'data_repo(',
- ' name = "ext~~ext~repo3",',
+ ' name = "ext++ext+repo3",',
' data = "requested repo",',
')',
- '# Rule ext~~ext~repo3 instantiated at (most recent call last):',
+ '# Rule ext++ext+repo3 instantiated at (most recent call last):',
'# in ',
'# Rule data_repo defined at (most recent call last):',
# pop(32)
@@ -464,10 +464,10 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
'## @my_repo4:',
'# ',
'data_repo(',
- ' name = "ext~~ext~repo4",',
+ ' name = "ext++ext+repo4",',
' data = "requested repo",',
')',
- '# Rule ext~~ext~repo4 instantiated at (most recent call last):',
+ '# Rule ext++ext+repo4 instantiated at (most recent call last):',
'# in ',
'# Rule data_repo defined at (most recent call last):',
# pop(42)
@@ -475,7 +475,7 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
'## bar@2.0:',
'# ',
'http_archive(',
- ' name = "bar~",',
+ ' name = "bar+",',
# pop(47) -- urls=[...]
# pop(47) -- integrity=...
' strip_prefix = "",',
@@ -484,7 +484,7 @@ def testShowModuleAndExtensionReposFromBaseModule(self):
' remote_patches = {},',
' remote_patch_strip = 0,',
')',
- '# Rule bar~ instantiated at (most recent call last):',
+ '# Rule bar+ instantiated at (most recent call last):',
'# in ',
'# Rule http_archive defined at (most recent call last):',
# pop(55)
@@ -526,7 +526,7 @@ def testDumpRepoMapping(self):
'mod',
'dump_repo_mapping',
'',
- 'foo~v2.0',
+ 'foo+2.0',
],
)
root_mapping, foo_mapping = [json.loads(l) for l in stdout]
@@ -534,9 +534,9 @@ def testDumpRepoMapping(self):
self.assertContainsSubset(
{
'my_project': '',
- 'foo1': 'foo~v1.0',
- 'foo2': 'foo~v2.0',
- 'myrepo2': 'ext2~~ext~repo1',
+ 'foo1': 'foo+1.0',
+ 'foo2': 'foo+2.0',
+ 'myrepo2': 'ext2++ext+repo1',
'bazel_tools': 'bazel_tools',
}.items(),
root_mapping.items(),
@@ -544,9 +544,9 @@ def testDumpRepoMapping(self):
self.assertContainsSubset(
{
- 'foo': 'foo~v2.0',
- 'ext_mod': 'ext~',
- 'my_repo3': 'ext~~ext~repo3',
+ 'foo': 'foo+2.0',
+ 'ext_mod': 'ext+',
+ 'my_repo3': 'ext++ext+repo3',
'bazel_tools': 'bazel_tools',
}.items(),
foo_mapping.items(),
@@ -570,8 +570,8 @@ def testDumpRepoMappingThrowsInvalidRepoName(self):
)
self.assertIn(
"ERROR: invalid repository name '{}': repo names may contain only A-Z,"
- " a-z, 0-9, '-', '_', '.' and '~' and must not start with '~'. Type"
- " 'bazel help mod' for syntax and help.",
+ " a-z, 0-9, '-', '_', '.' and '+'. Type 'bazel help mod' for syntax"
+ ' and help.',
stderr,
)
diff --git a/src/test/py/bazel/py_test.py b/src/test/py/bazel/py_test.py
index 3c2c519de1ab7d..347d972f85a39d 100644
--- a/src/test/py/bazel/py_test.py
+++ b/src/test/py/bazel/py_test.py
@@ -263,37 +263,52 @@ def testPyRunfilesLibraryCurrentRepository(self):
])
self.ScratchFile('other_repo_path/REPO.bazel')
- self.ScratchFile('other_repo_path/pkg/BUILD.bazel', [
- 'py_binary(',
- ' name = "binary",',
- ' srcs = ["binary.py"],',
- ' deps = [',
- ' "@//pkg:library",',
- ' "@bazel_tools//tools/python/runfiles",',
- ' ],',
- ')',
- '',
- 'py_test(',
- ' name = "test",',
- ' srcs = ["test.py"],',
- ' deps = [',
- ' "@//pkg:library",',
- ' "@bazel_tools//tools/python/runfiles",',
- ' ],',
- ')',
- ])
- self.ScratchFile('other_repo_path/pkg/binary.py', [
- 'from bazel_tools.tools.python.runfiles import runfiles',
- 'from pkg import library',
- 'library.print_repo_name()',
- 'print("in external/other_repo/pkg/binary.py: \'%s\'" % runfiles.Create().CurrentRepository())',
- ])
- self.ScratchFile('other_repo_path/pkg/test.py', [
- 'from bazel_tools.tools.python.runfiles import runfiles',
- 'from pkg import library',
- 'library.print_repo_name()',
- 'print("in external/other_repo/pkg/test.py: \'%s\'" % runfiles.Create().CurrentRepository())',
- ])
+ self.ScratchFile(
+ 'other_repo_path/other_pkg/BUILD.bazel',
+ [
+ 'py_binary(',
+ ' name = "binary",',
+ ' srcs = ["binary.py"],',
+ ' deps = [',
+ ' "@//pkg:library",',
+ ' "@bazel_tools//tools/python/runfiles",',
+ ' ],',
+ ')',
+ '',
+ 'py_test(',
+ ' name = "test",',
+ ' srcs = ["test.py"],',
+ ' deps = [',
+ ' "@//pkg:library",',
+ ' "@bazel_tools//tools/python/runfiles",',
+ ' ],',
+ ')',
+ ],
+ )
+ self.ScratchFile(
+ 'other_repo_path/other_pkg/binary.py',
+ [
+ 'from bazel_tools.tools.python.runfiles import runfiles',
+ 'from pkg import library',
+ 'library.print_repo_name()',
+ (
+ 'print("in external/other_repo/other_pkg/binary.py: \'%s\'" %'
+ ' runfiles.Create().CurrentRepository())'
+ ),
+ ],
+ )
+ self.ScratchFile(
+ 'other_repo_path/other_pkg/test.py',
+ [
+ 'from bazel_tools.tools.python.runfiles import runfiles',
+ 'from pkg import library',
+ 'library.print_repo_name()',
+ (
+ 'print("in external/other_repo/other_pkg/test.py: \'%s\'" %'
+ ' runfiles.Create().CurrentRepository())'
+ ),
+ ],
+ )
_, stdout, _ = self.RunBazel(['run', '//pkg:binary'])
self.assertIn('in pkg/binary.py: \'\'', stdout)
@@ -305,18 +320,18 @@ def testPyRunfilesLibraryCurrentRepository(self):
self.assertIn('in pkg/test.py: \'\'', stdout)
self.assertIn('in pkg/library.py: \'\'', stdout)
- _, stdout, _ = self.RunBazel(['run', '@other_repo//pkg:binary'])
+ _, stdout, _ = self.RunBazel(['run', '@other_repo//other_pkg:binary'])
self.assertIn(
- "in external/other_repo/pkg/binary.py: '_main~_repo_rules~other_repo'",
+ "in external/other_repo/other_pkg/binary.py: '+_repo_rules+other_repo'",
stdout,
)
self.assertIn('in pkg/library.py: \'\'', stdout)
_, stdout, _ = self.RunBazel(
- ['test', '@other_repo//pkg:test', '--test_output=streamed']
+ ['test', '@other_repo//other_pkg:test', '--test_output=streamed']
)
self.assertIn(
- "in external/other_repo/pkg/test.py: '_main~_repo_rules~other_repo'",
+ "in external/other_repo/other_pkg/test.py: '+_repo_rules+other_repo'",
stdout,
)
self.assertIn('in pkg/library.py: \'\'', stdout)
diff --git a/src/test/shell/bazel/bazel_coverage_java_test.sh b/src/test/shell/bazel/bazel_coverage_java_test.sh
index 1f94464552eeff..042c95d6c597be 100755
--- a/src/test/shell/bazel/bazel_coverage_java_test.sh
+++ b/src/test/shell/bazel/bazel_coverage_java_test.sh
@@ -33,7 +33,7 @@ override_java_tools "${RULES_JAVA_REPO_NAME}" "${JAVA_TOOLS_ZIP}" "${JAVA_TOOLS_
COVERAGE_GENERATOR_WORKSPACE_FILE="$1"; shift
if [[ "${COVERAGE_GENERATOR_WORKSPACE_FILE}" != "released" ]]; then
COVERAGE_GENERATOR_DIR="$(dirname "$(rlocation $COVERAGE_GENERATOR_WORKSPACE_FILE)")"
- add_to_bazelrc "build --override_repository=bazel_tools~remote_coverage_tools_extension~remote_coverage_tools=${COVERAGE_GENERATOR_DIR}"
+ add_to_bazelrc "build --override_repository=bazel_tools+remote_coverage_tools_extension+remote_coverage_tools=${COVERAGE_GENERATOR_DIR}"
fi
if [[ $# -gt 0 ]]; then
diff --git a/src/test/shell/bazel/bazel_with_jdk_test.sh b/src/test/shell/bazel/bazel_with_jdk_test.sh
index 9220e991af99f8..aaa563dea57553 100755
--- a/src/test/shell/bazel/bazel_with_jdk_test.sh
+++ b/src/test/shell/bazel/bazel_with_jdk_test.sh
@@ -175,19 +175,19 @@ EOF
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=8 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 8 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=local_jdk_8 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 8 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=11 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 8 and selecting it failed"
- expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
}
# Bazel shall detect JDK version and configure it with "local_jdk_{version}" and "{version}" setting.
@@ -210,19 +210,19 @@ EOF
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=11 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=local_jdk_11 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=17 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
}
# Bazel shall detect JDK version and configure it with "local_jdk_{version}" and "{version}" setting.
@@ -245,19 +245,19 @@ EOF
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=11 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=local_jdk_11 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
bazel cquery \
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
--java_runtime_version=17 \
//java/main:JavaExample &>"${TEST_log}" || fail "Autodetecting a fake JDK version 11 and selecting it failed"
- expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_not_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
}
# Failure to detect JDK version shall be handled gracefully.
@@ -281,7 +281,7 @@ EOF
--toolchain_resolution_debug=tools/jdk:runtime_toolchain_type \
//java/main:JavaExample &>"${TEST_log}" \
|| fail "Failed to resolve Java toolchain when version cannot be detected"
- expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java~.*~toolchains~local_jdk//:jdk"
+ expect_log "@@bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @@rules_java+.*+toolchains+local_jdk//:jdk"
}
# Bazel shall provide Java compilation toolchains that use local JDK.
diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh
index 8f67d33494193b..c2a639751621c2 100755
--- a/src/test/shell/bazel/local_repository_test.sh
+++ b/src/test/shell/bazel/local_repository_test.sh
@@ -1047,7 +1047,7 @@ local_repository(
EOF
bazel build @r/a//:bin &> $TEST_log && fail "expected build failure, but succeeded"
- expect_log "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '~'"
+ expect_log "repo names may contain only A-Z, a-z, 0-9, '-', '_', '.' and '+'"
}
function test_remote_includes() {
diff --git a/src/test/shell/bazel/python_version_test.sh b/src/test/shell/bazel/python_version_test.sh
index ddde6e9d0bd03e..04491747b07d0d 100755
--- a/src/test/shell/bazel/python_version_test.sh
+++ b/src/test/shell/bazel/python_version_test.sh
@@ -541,7 +541,7 @@ package_group(
name = "allowed",
packages = [
"//__EXTERNAL_REPOS__/external_repo/...",
- "//__EXTERNAL_REPOS__/external_repo~/...",
+ "//__EXTERNAL_REPOS__/external_repo+/...",
"//__EXTERNAL_REPOS__/bazel_tools/...",
##"//tools/python/windows...",
],
diff --git a/src/test/shell/bazel/starlark_repository_test.sh b/src/test/shell/bazel/starlark_repository_test.sh
index 0355da9b90be2d..409506fa54ec71 100755
--- a/src/test/shell/bazel/starlark_repository_test.sh
+++ b/src/test/shell/bazel/starlark_repository_test.sh
@@ -2673,7 +2673,7 @@ module(name="bar")
EOF
bazel build @r >& $TEST_log || fail "expected bazel to succeed"
- expect_log "I see: @@foo~//:data"
+ expect_log "I see: @@foo+//:data"
# So far, so good. Now we make `@data` point to bar instead!
cat > MODULE.bazel <& $TEST_log || fail "expected bazel to succeed"
- expect_log "I see: @@bar~//:data"
+ expect_log "I see: @@bar+//:data"
}
function test_repo_mapping_change_in_bzl_init() {
@@ -2720,7 +2720,7 @@ module(name="bar")
EOF
bazel build @r >& $TEST_log || fail "expected bazel to succeed"
- expect_log "I see: @@foo~//:data"
+ expect_log "I see: @@foo+//:data"
# So far, so good. Now we make `@data` point to bar instead!
cat > MODULE.bazel <& $TEST_log || fail "expected bazel to succeed"
- expect_log "I see: @@bar~//:data"
+ expect_log "I see: @@bar+//:data"
}
function test_file_watching_inside_working_dir() {
@@ -2873,7 +2873,7 @@ EOF
def _foo(rctx):
rctx.file("BUILD", "filegroup(name='foo')")
# this repo might not have been defined yet
- rctx.watch("../_main~_repo_rules~bar/BUILD")
+ rctx.watch("../+_repo_rules+bar/BUILD")
print("I see something!")
foo=repository_rule(_foo)
EOF
@@ -2881,7 +2881,7 @@ EOF
bazel build @foo >& $TEST_log || fail "expected bazel to succeed"
expect_log "I see something!"
- # Defining @@_main~_repo_rules~bar should now cause @foo to refetch.
+ # Defining @@+_repo_rules+bar should now cause @foo to refetch.
cat >> MODULE.bazel <& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
expect_not_log "exec external/host_javabase/bin/java"
# If we don't specify anything, we expect the remote JDK to be used.
bazel aquery --output=text //java:javalib >& $TEST_log
expect_not_log "exec external/embedded_jdk/bin/java"
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
bazel aquery --output=text --java_runtime_version='host_javabase' //java:javalib >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
expect_not_log "exec external/host_javabase/bin/java"
}
@@ -106,13 +106,13 @@ EOF
touch foobar/bin/java
bazel aquery --output=text --java_language_version=8 //java:javalib >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
bazel aquery --output=text --java_language_version=11 //java:javalib >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
bazel aquery --output=text --java_language_version=17 //java:javalib >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
}
# Javabuilder shall be executed using JDK defined in java_toolchain's java_runtime attribute, not tool_java_runtime.
@@ -159,21 +159,21 @@ EOF
# We expect the given host_javabase does not appear in the command line of
# java_library actions.
bazel aquery --output=text --tool_java_runtime_version='host_javabase' 'deps(//java:sample,1)' >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
expect_not_log "exec external/host_javabase/bin/java"
# If we don't specify anything, we expect the remote JDK to be used.
# Note that this will change in the future but is the current state.
bazel aquery --output=text 'deps(//java:sample,1)' >& $TEST_log
expect_not_log "exec external/embedded_jdk/bin/java"
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
bazel aquery --output=text --tool_java_runtime_version='host_javabase' 'deps(//java:sample,1)' >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
expect_not_log "exec external/host_javabase/bin/java"
bazel aquery --output=text --tool_java_language_version=17 --tool_java_runtime_version='host_javabase' 'deps(//java:sample,1)' >& $TEST_log
- expect_log "exec external/rules_java~.*~toolchains~${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
+ expect_log "exec external/rules_java+.*+toolchains+${DEFAULT_JAVA_RUNTIME_VERSION}_.*/bin/java"
expect_not_log "exec external/host_javabase/bin/java"
}
@@ -225,7 +225,7 @@ EOF
# Check that we use local_jdk when it's not specified.
bazel build //java:javabin
cat bazel-bin/java/javabin >& $TEST_log
- expect_log "JAVABIN=.*/rules_java~.*~toolchains~local_jdk/bin/java"
+ expect_log "JAVABIN=.*/rules_java+.*+toolchains+local_jdk/bin/java"
}
function write_javabase_files() {
diff --git a/src/test/shell/testenv.sh.tmpl b/src/test/shell/testenv.sh.tmpl
index 4058bcf74d3338..aad0a628f993ba 100755
--- a/src/test/shell/testenv.sh.tmpl
+++ b/src/test/shell/testenv.sh.tmpl
@@ -1022,7 +1022,7 @@ function override_java_tools() {
JAVA_TOOLS_ZIP="$1"; shift
JAVA_TOOLS_PREBUILT_ZIP="$1"; shift
- JAVA_TOOLS_REPO_PREFIX="${RULES_JAVA_REPO_NAME}~toolchains~"
+ JAVA_TOOLS_REPO_PREFIX="${RULES_JAVA_REPO_NAME}+toolchains+"
if [[ "${JAVA_TOOLS_ZIP}" != "released" ]]; then
JAVA_TOOLS_ZIP_FILE="$(rlocation "${JAVA_TOOLS_ZIP}")"
diff --git a/src/test/tools/bzlmod/MODULE.bazel.lock b/src/test/tools/bzlmod/MODULE.bazel.lock
index 2daf52bc583470..def946bfc00b6e 100644
--- a/src/test/tools/bzlmod/MODULE.bazel.lock
+++ b/src/test/tools/bzlmod/MODULE.bazel.lock
@@ -1,5 +1,5 @@
{
- "lockFileVersion": 11,
+ "lockFileVersion": 12,
"registryFileHashes": {
"https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
"https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
@@ -76,12 +76,12 @@
"recordedRepoMappingEntries": []
}
},
- "@@rules_jvm_external~//:extensions.bzl%maven": {
+ "@@rules_jvm_external+//:extensions.bzl%maven": {
"general": {
"bzlTransitiveDigest": "ktqZUWl2nBo/3HEhakOj9tfmT3+/Z90z7ldq8XwxYnE=",
"usagesDigest": "UPebZtX4g40+QepdK3oMHged0o0tq6ojKbW84wE6XRA=",
"recordedFileInputs": {
- "@@rules_jvm_external~//rules_jvm_external_deps_install.json": "10442a5ae27d9ff4c2003e5ab71643bf0d8b48dcf968b4173fa274c3232a8c06"
+ "@@rules_jvm_external+//rules_jvm_external_deps_install.json": "10442a5ae27d9ff4c2003e5ab71643bf0d8b48dcf968b4173fa274c3232a8c06"
},
"recordedDirentsInputs": {},
"envVariables": {},
@@ -339,7 +339,7 @@
}
},
"rules_jvm_external_deps": {
- "bzlFile": "@@rules_jvm_external~//:coursier.bzl",
+ "bzlFile": "@@rules_jvm_external+//:coursier.bzl",
"ruleClassName": "pinned_coursier_fetch",
"attributes": {
"repositories": [
@@ -355,7 +355,7 @@
"fetch_sources": true,
"fetch_javadoc": false,
"generate_compat_repositories": false,
- "maven_install_json": "@@rules_jvm_external~//:rules_jvm_external_deps_install.json",
+ "maven_install_json": "@@rules_jvm_external+//:rules_jvm_external_deps_install.json",
"override_targets": {},
"strict_visibility": false,
"strict_visibility_value": [
@@ -433,7 +433,7 @@
}
},
"maven": {
- "bzlFile": "@@rules_jvm_external~//:coursier.bzl",
+ "bzlFile": "@@rules_jvm_external+//:coursier.bzl",
"ruleClassName": "coursier_fetch",
"attributes": {
"repositories": [
@@ -701,7 +701,7 @@
}
},
"unpinned_rules_jvm_external_deps": {
- "bzlFile": "@@rules_jvm_external~//:coursier.bzl",
+ "bzlFile": "@@rules_jvm_external+//:coursier.bzl",
"ruleClassName": "coursier_fetch",
"attributes": {
"repositories": [
@@ -726,7 +726,7 @@
"strict_visibility_value": [
"@@//visibility:private"
],
- "maven_install_json": "@@rules_jvm_external~//:rules_jvm_external_deps_install.json",
+ "maven_install_json": "@@rules_jvm_external+//:rules_jvm_external_deps_install.json",
"resolve_timeout": 600,
"jetify": false,
"jetify_include_list": [
@@ -1088,19 +1088,19 @@
},
"recordedRepoMappingEntries": [
[
- "rules_jvm_external~",
+ "rules_jvm_external+",
"bazel_tools",
"bazel_tools"
],
[
- "rules_jvm_external~",
+ "rules_jvm_external+",
"rules_jvm_external",
- "rules_jvm_external~"
+ "rules_jvm_external+"
]
]
}
},
- "@@rules_jvm_external~//:non-module-deps.bzl%non_module_deps": {
+ "@@rules_jvm_external+//:non-module-deps.bzl%non_module_deps": {
"general": {
"bzlTransitiveDigest": "4VF2Z/DNZaLHTP3izo0uTvnjS8it3dSViL5+ack4ogE=",
"usagesDigest": "bTG4ItERqhG1LeSs62hQ01DiMarFsflWgpZaghM5qik=",
@@ -1121,14 +1121,14 @@
},
"recordedRepoMappingEntries": [
[
- "rules_jvm_external~",
+ "rules_jvm_external+",
"bazel_tools",
"bazel_tools"
]
]
}
},
- "@@rules_python~//python/extensions:python.bzl%python": {
+ "@@rules_python+//python/extensions:python.bzl%python": {
"general": {
"bzlTransitiveDigest": "e3ZmjG1ZEg3xSbspFPC5afi43pqfpAU89V2ghTtcNug=",
"usagesDigest": "7vjNHuEgQORYN9+9/77Q4zw1kawobM2oCQb9p0uhL68=",
@@ -1137,7 +1137,7 @@
"envVariables": {},
"generatedRepoSpecs": {
"pythons_hub": {
- "bzlFile": "@@rules_python~//python/extensions/private:interpreter_hub.bzl",
+ "bzlFile": "@@rules_python+//python/extensions/private:interpreter_hub.bzl",
"ruleClassName": "hub_repo",
"attributes": {
"toolchains": []
@@ -1146,19 +1146,19 @@
},
"recordedRepoMappingEntries": [
[
- "rules_python~",
+ "rules_python+",
"bazel_tools",
"bazel_tools"
],
[
- "rules_python~",
+ "rules_python+",
"rules_python",
- "rules_python~"
+ "rules_python+"
]
]
}
},
- "@@rules_python~//python/extensions/private:internal_deps.bzl%internal_deps": {
+ "@@rules_python+//python/extensions/private:internal_deps.bzl%internal_deps": {
"general": {
"bzlTransitiveDigest": "f4sn8DF0csno6nVTa/bU1ixR43r+jYeZRRCD3xniTxQ=",
"usagesDigest": "b+nMDqtqPCBxiMBewNNde3aNjzKqZyvJuN5/49xB62s=",
@@ -1175,7 +1175,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "95203854f974e07af96358c0b261f1048d8e1083f2de9b1c565e1be4a3a48cfc",
"type": "zip",
@@ -1193,7 +1193,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "6c4459b3de97b75e3bd6b7d4b7f0db13f17f504f3d13e2a7c623786289dd670e",
"type": "zip",
@@ -1221,7 +1221,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "af4fffaffc4067232253715065e30c5a7ec6faac36f8fc8d6f64263b15f74db0",
"type": "zip",
@@ -1239,7 +1239,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "4a5375e28c5191ac38cca59b38edd33ef4cc914732c916f2929029b4bfb50795",
"type": "zip",
@@ -1257,7 +1257,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "b4a5be1748d538a710f87542f22c2cad22f80545a847ad91ce45e77417293eb4",
"type": "zip",
@@ -1275,7 +1275,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "b9023e237f4c02ff739581ef35969c3739445fb059b060ca51771e69101efffe",
"type": "zip",
@@ -1293,7 +1293,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "784f53ebc9f3fd0e2a3f6a78b2be1bd1f5575d7863e10c6e12504f240fd06660",
"type": "zip",
@@ -1321,7 +1321,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "d900bb429fdfd7f511f868cedd03a6bbb142f3f9118c09b99ef8dc9bf9643c3c",
"type": "zip",
@@ -1339,7 +1339,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "a8fb6cf131ac4070c9c5a3e21de0f7dc5a0fbe8bc77c9456ced896c12fcdad91",
"type": "zip",
@@ -1367,7 +1367,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "633713d70ad6bfc49b34ead4060531658dc6dfc9b3eb7d8a716d5873377ab745",
"type": "zip",
@@ -1395,7 +1395,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "c4ed2820d919351f4167e52425e096af41bfabacb1857186c1ea32ff9983ed75",
"type": "zip",
@@ -1423,7 +1423,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "8f830ed581b45b82451a40faabb89c84e1a998124ee4212d440e9c6cf70083e5",
"type": "zip",
@@ -1461,7 +1461,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "6b07130585d54fe8dff3d97b93b0e20290de974dc8177c320aeaf23459219c0b",
"type": "zip",
@@ -1479,7 +1479,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "2198ea6fc548de52adc826f62cb18554caedfb1d26548c1b7c88d8f7faa8f6ba",
"type": "zip",
@@ -1547,7 +1547,7 @@
"-p1"
],
"patches": [
- "@@rules_python~//python/private:coverage.patch"
+ "@@rules_python+//python/private:coverage.patch"
],
"sha256": "ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53",
"type": "zip",
@@ -1579,19 +1579,19 @@
},
"recordedRepoMappingEntries": [
[
- "rules_python~",
+ "rules_python+",
"bazel_skylib",
- "bazel_skylib~"
+ "bazel_skylib+"
],
[
- "rules_python~",
+ "rules_python+",
"bazel_tools",
"bazel_tools"
],
[
- "rules_python~",
+ "rules_python+",
"rules_python",
- "rules_python~"
+ "rules_python+"
]
]
}
diff --git a/src/tools/bzlmod/blazel_utils.bzl b/src/tools/bzlmod/blazel_utils.bzl
index 9cd5a2723afb33..b5cf22f895ff16 100644
--- a/src/tools/bzlmod/blazel_utils.bzl
+++ b/src/tools/bzlmod/blazel_utils.bzl
@@ -18,4 +18,6 @@ def get_canonical_repo_name(apparent_repo_name):
"""Returns the canonical repo name for the given apparent repo name seen by the module this bzl file belongs to."""
if not apparent_repo_name.startswith("@"):
apparent_repo_name = "@" + apparent_repo_name
- return Label(apparent_repo_name).workspace_name
+
+ # TODO: remove the `replace` part once we're building with 7.3.0
+ return Label(apparent_repo_name).workspace_name.replace("~", "+")
diff --git a/src/tools/bzlmod/utils.bzl b/src/tools/bzlmod/utils.bzl
index f8398cba4daf72..47e1fb375a3eab 100644
--- a/src/tools/bzlmod/utils.bzl
+++ b/src/tools/bzlmod/utils.bzl
@@ -80,13 +80,14 @@ def parse_http_artifacts(ctx, lockfile_path, required_repos):
for extension_id, extension_entry in lockfile["moduleExtensions"].items():
if extension_id.startswith("@@"):
- # @@rules_foo~//:extensions.bzl%foo --> rules_foo~
- module_repo_name = extension_id.removeprefix("@@").partition("//")[0]
+ # "@@rules_foo+//:extensions.bzl%foo" --> "rules_foo+"
+ # "@@rules_foo~//:extensions.bzl%foo" --> "rules_foo+" (legacy format; remove after building with 8.0)
+ module_repo_name = extension_id.removeprefix("@@").partition("//")[0].replace("~", "+")
else:
- # //:extensions.bzl%foo --> _main
- module_repo_name = "_main"
+ # "//:extensions.bzl%foo" --> ""
+ module_repo_name = ""
extension_name = extension_id.partition("%")[2]
- repo_name_prefix = "{}~{}~".format(module_repo_name, extension_name)
+ repo_name_prefix = "{}+{}+".format(module_repo_name, extension_name)
extensions = []
for _, extension_per_platform in extension_entry.items():
extensions.append(extension_per_platform)
@@ -168,4 +169,4 @@ def _module_repo_name(module):
if module_name in _WELL_KNOWN_MODULES:
return module_name
- return "{}~".format(module_name)
+ return "{}+".format(module_name)
diff --git a/tools/bash/runfiles/runfiles_test.bash b/tools/bash/runfiles/runfiles_test.bash
index c4e21983bca42c..8105c842b108ee 100755
--- a/tools/bash/runfiles/runfiles_test.bash
+++ b/tools/bash/runfiles/runfiles_test.bash
@@ -216,40 +216,40 @@ function test_directory_based_runfiles_with_repo_mapping_from_main() {
export RUNFILES_DIR=${tmpdir}/mock/runfiles
mkdir -p "$RUNFILES_DIR"
cat > "$RUNFILES_DIR/_repo_mapping" < "$RUNFILES_DIR/_repo_mapping" < "$tmpdir/foo.repo_mapping" < "$RUNFILES_MANIFEST_FILE" << EOF
_repo_mapping $tmpdir/foo.repo_mapping
config.json $tmpdir/config.json
-protobuf~3.19.2/foo/runfile $tmpdir/protobuf~3.19.2/foo/runfile
+protobuf+3.19.2/foo/runfile $tmpdir/protobuf+3.19.2/foo/runfile
_main/bar/runfile $tmpdir/_main/bar/runfile
-protobuf~3.19.2/bar/dir $tmpdir/protobuf~3.19.2/bar/dir
+protobuf+3.19.2/bar/dir $tmpdir/protobuf+3.19.2/bar/dir
EOF
source "$runfiles_lib_path"
mkdir -p "$tmpdir/_main/bar"
touch "$tmpdir/_main/bar/runfile"
- mkdir -p "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted"
- touch "$tmpdir/protobuf~3.19.2/bar/dir/file"
- touch "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"
- mkdir -p "$tmpdir/protobuf~3.19.2/foo"
- touch "$tmpdir/protobuf~3.19.2/foo/runfile"
+ mkdir -p "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted"
+ touch "$tmpdir/protobuf+3.19.2/bar/dir/file"
+ touch "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"
+ mkdir -p "$tmpdir/protobuf+3.19.2/foo"
+ touch "$tmpdir/protobuf+3.19.2/foo/runfile"
touch "$tmpdir/config.json"
[[ "$(rlocation "my_module/bar/runfile" "" || echo failed)" == "$tmpdir/_main/bar/runfile" ]] || fail
[[ "$(rlocation "my_workspace/bar/runfile" "" || echo failed)" == "$tmpdir/_main/bar/runfile" ]] || fail
- [[ "$(rlocation "my_protobuf/foo/runfile" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/foo/runfile" ]] || fail
- [[ "$(rlocation "my_protobuf/bar/dir" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir" ]] || fail
- [[ "$(rlocation "my_protobuf/bar/dir/file" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/file" ]] || fail
- [[ "$(rlocation "my_protobuf/bar/dir/de eply/nes ted/fi~le" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" ]] || fail
+ [[ "$(rlocation "my_protobuf/foo/runfile" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/foo/runfile" ]] || fail
+ [[ "$(rlocation "my_protobuf/bar/dir" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir" ]] || fail
+ [[ "$(rlocation "my_protobuf/bar/dir/file" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/file" ]] || fail
+ [[ "$(rlocation "my_protobuf/bar/dir/de eply/nes ted/fi+le" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" ]] || fail
[[ -z "$(rlocation "protobuf/foo/runfile" "" || echo failed)" ]] || fail
- [[ -z "$(rlocation "protobuf/bar/dir/dir/de eply/nes ted/fi~le" "" || echo failed)" ]] || fail
+ [[ -z "$(rlocation "protobuf/bar/dir/dir/de eply/nes ted/fi+le" "" || echo failed)" ]] || fail
[[ "$(rlocation "_main/bar/runfile" "" || echo failed)" == "$tmpdir/_main/bar/runfile" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/foo/runfile" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/foo/runfile" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir/file" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/file" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" "" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/foo/runfile" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/foo/runfile" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir/file" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/file" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" "" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" ]] || fail
[[ "$(rlocation "config.json" "" || echo failed)" == "$tmpdir/config.json" ]] || fail
}
@@ -350,48 +350,48 @@ function test_manifest_based_runfiles_with_repo_mapping_from_other_repo() {
local tmpdir="$(mktemp -d $TEST_TMPDIR/tmp.XXXXXXXX)"
cat > "$tmpdir/foo.repo_mapping" < "$RUNFILES_MANIFEST_FILE" << EOF
_repo_mapping $tmpdir/foo.repo_mapping
config.json $tmpdir/config.json
-protobuf~3.19.2/foo/runfile $tmpdir/protobuf~3.19.2/foo/runfile
+protobuf+3.19.2/foo/runfile $tmpdir/protobuf+3.19.2/foo/runfile
_main/bar/runfile $tmpdir/_main/bar/runfile
-protobuf~3.19.2/bar/dir $tmpdir/protobuf~3.19.2/bar/dir
+protobuf+3.19.2/bar/dir $tmpdir/protobuf+3.19.2/bar/dir
EOF
source "$runfiles_lib_path"
mkdir -p "$tmpdir/_main/bar"
touch "$tmpdir/_main/bar/runfile"
- mkdir -p "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted"
- touch "$tmpdir/protobuf~3.19.2/bar/dir/file"
- touch "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"
- mkdir -p "$tmpdir/protobuf~3.19.2/foo"
- touch "$tmpdir/protobuf~3.19.2/foo/runfile"
+ mkdir -p "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted"
+ touch "$tmpdir/protobuf+3.19.2/bar/dir/file"
+ touch "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"
+ mkdir -p "$tmpdir/protobuf+3.19.2/foo"
+ touch "$tmpdir/protobuf+3.19.2/foo/runfile"
touch "$tmpdir/config.json"
- [[ "$(rlocation "protobuf/foo/runfile" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/foo/runfile" ]] || fail
- [[ "$(rlocation "protobuf/bar/dir" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir" ]] || fail
- [[ "$(rlocation "protobuf/bar/dir/file" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/file" ]] || fail
- [[ "$(rlocation "protobuf/bar/dir/de eply/nes ted/fi~le" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" ]] || fail
+ [[ "$(rlocation "protobuf/foo/runfile" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/foo/runfile" ]] || fail
+ [[ "$(rlocation "protobuf/bar/dir" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir" ]] || fail
+ [[ "$(rlocation "protobuf/bar/dir/file" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/file" ]] || fail
+ [[ "$(rlocation "protobuf/bar/dir/de eply/nes ted/fi+le" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" ]] || fail
- [[ -z "$(rlocation "my_module/bar/runfile" "protobuf~3.19.2" || echo failed)" ]] || fail
- [[ -z "$(rlocation "my_protobuf/bar/dir/de eply/nes ted/fi~le" "protobuf~3.19.2" || echo failed)" ]] || fail
+ [[ -z "$(rlocation "my_module/bar/runfile" "protobuf+3.19.2" || echo failed)" ]] || fail
+ [[ -z "$(rlocation "my_protobuf/bar/dir/de eply/nes ted/fi+le" "protobuf+3.19.2" || echo failed)" ]] || fail
- [[ "$(rlocation "_main/bar/runfile" "protobuf~3.19.2" || echo failed)" == "$tmpdir/_main/bar/runfile" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/foo/runfile" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/foo/runfile" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir/file" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/file" ]] || fail
- [[ "$(rlocation "protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" "protobuf~3.19.2" || echo failed)" == "$tmpdir/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le" ]] || fail
+ [[ "$(rlocation "_main/bar/runfile" "protobuf+3.19.2" || echo failed)" == "$tmpdir/_main/bar/runfile" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/foo/runfile" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/foo/runfile" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir/file" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/file" ]] || fail
+ [[ "$(rlocation "protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" "protobuf+3.19.2" || echo failed)" == "$tmpdir/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le" ]] || fail
- [[ "$(rlocation "config.json" "protobuf~3.19.2" || echo failed)" == "$tmpdir/config.json" ]] || fail
+ [[ "$(rlocation "config.json" "protobuf+3.19.2" || echo failed)" == "$tmpdir/config.json" ]] || fail
}
function test_directory_based_envvars() {
diff --git a/tools/compliance/packages_used_test.py b/tools/compliance/packages_used_test.py
index 8bfab07c19d53d..2a8c86de530867 100644
--- a/tools/compliance/packages_used_test.py
+++ b/tools/compliance/packages_used_test.py
@@ -53,7 +53,7 @@ def test_found_remote_packages(self):
raw_json = read_data_file("bazel_packages.json")
content = json.loads(raw_json)
self.assertIn(
- "@@remoteapis~override//:build_bazel_remote_execution_v2_remote_execution_proto",
+ "@@remoteapis+//:build_bazel_remote_execution_v2_remote_execution_proto",
content["packages"],
)
diff --git a/tools/cpp/runfiles/runfiles_test.cc b/tools/cpp/runfiles/runfiles_test.cc
index 122b184cafe1d0..80161c4467c132 100644
--- a/tools/cpp/runfiles/runfiles_test.cc
+++ b/tools/cpp/runfiles/runfiles_test.cc
@@ -588,17 +588,17 @@ TEST_F(RunfilesTest, ManifestBasedRlocationWithRepoMapping_fromMain) {
string uid = LINE_AS_STRING();
unique_ptr rm(
MockFile::Create("foo" + uid + ".repo_mapping",
- {",config.json,config.json~1.2.3", ",my_module,_main",
- ",my_protobuf,protobuf~3.19.2", ",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"}));
+ {",config.json,config.json+1.2.3", ",my_module,_main",
+ ",my_protobuf,protobuf+3.19.2", ",my_workspace,_main",
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"}));
ASSERT_TRUE(rm != nullptr);
unique_ptr mf(MockFile::Create(
"foo" + uid + ".runfiles_manifest",
{"_repo_mapping " + rm->Path(), "config.json /etc/config.json",
- "protobuf~3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
+ "protobuf+3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
"_main/bar/runfile /the/path/./to/other//other runfile.txt",
- "protobuf~3.19.2/bar/dir E:\\Actual Path\\Directory"}));
+ "protobuf+3.19.2/bar/dir E:\\Actual Path\\Directory"}));
ASSERT_TRUE(mf != nullptr);
string argv0(mf->Path().substr(
0, mf->Path().size() - string(".runfiles_manifest").size()));
@@ -619,24 +619,24 @@ TEST_F(RunfilesTest, ManifestBasedRlocationWithRepoMapping_fromMain) {
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir"), "E:\\Actual Path\\Directory");
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/file"),
"E:\\Actual Path\\Directory/file");
- EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"),
- "E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"),
+ "E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("protobuf/foo/runfile"), "");
EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), "");
EXPECT_EQ(r->Rlocation("protobuf/bar/dir/file"), "");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le"), "");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le"), "");
EXPECT_EQ(r->Rlocation("_main/bar/runfile"),
"/the/path/./to/other//other runfile.txt");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/foo/runfile"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/foo/runfile"),
"C:/Actual Path\\protobuf\\runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir"),
"E:\\Actual Path\\Directory");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/file"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/file"),
"E:\\Actual Path\\Directory/file");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"),
- "E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"),
+ "E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("config.json"), "/etc/config.json");
EXPECT_EQ(r->Rlocation("_main"), "");
@@ -648,17 +648,17 @@ TEST_F(RunfilesTest, ManifestBasedRlocationWithRepoMapping_fromOtherRepo) {
string uid = LINE_AS_STRING();
unique_ptr rm(
MockFile::Create("foo" + uid + ".repo_mapping",
- {",config.json,config.json~1.2.3", ",my_module,_main",
- ",my_protobuf,protobuf~3.19.2", ",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"}));
+ {",config.json,config.json+1.2.3", ",my_module,_main",
+ ",my_protobuf,protobuf+3.19.2", ",my_workspace,_main",
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"}));
ASSERT_TRUE(rm != nullptr);
unique_ptr mf(MockFile::Create(
"foo" + uid + ".runfiles_manifest",
{"_repo_mapping " + rm->Path(), "config.json /etc/config.json",
- "protobuf~3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
+ "protobuf+3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
"_main/bar/runfile /the/path/./to/other//other runfile.txt",
- "protobuf~3.19.2/bar/dir E:\\Actual Path\\Directory"}));
+ "protobuf+3.19.2/bar/dir E:\\Actual Path\\Directory"}));
ASSERT_TRUE(mf != nullptr);
string argv0(mf->Path().substr(
0, mf->Path().size() - string(".runfiles_manifest").size()));
@@ -666,7 +666,7 @@ TEST_F(RunfilesTest, ManifestBasedRlocationWithRepoMapping_fromOtherRepo) {
string error;
unique_ptr r(Runfiles::Create(argv0, /*runfiles_manifest_file=*/"",
/*runfiles_dir=*/"",
- "protobuf~3.19.2", &error));
+ "protobuf+3.19.2", &error));
ASSERT_TRUE(r != nullptr);
EXPECT_TRUE(error.empty());
@@ -675,25 +675,25 @@ TEST_F(RunfilesTest, ManifestBasedRlocationWithRepoMapping_fromOtherRepo) {
EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), "E:\\Actual Path\\Directory");
EXPECT_EQ(r->Rlocation("protobuf/bar/dir/file"),
"E:\\Actual Path\\Directory/file");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi~le"),
- "E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi+le"),
+ "E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("my_module/bar/runfile"), "");
EXPECT_EQ(r->Rlocation("my_protobuf/foo/runfile"), "");
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir"), "");
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/file"), "");
- EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"), "");
+ EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"), "");
EXPECT_EQ(r->Rlocation("_main/bar/runfile"),
"/the/path/./to/other//other runfile.txt");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/foo/runfile"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/foo/runfile"),
"C:/Actual Path\\protobuf\\runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir"),
"E:\\Actual Path\\Directory");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/file"),
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/file"),
"E:\\Actual Path\\Directory/file");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"),
- "E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"),
+ "E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("config.json"), "/etc/config.json");
EXPECT_EQ(r->Rlocation("_main"), "");
@@ -705,10 +705,10 @@ TEST_F(RunfilesTest, DirectoryBasedRlocationWithRepoMapping_fromMain) {
string uid = LINE_AS_STRING();
unique_ptr rm(
MockFile::Create("foo" + uid + ".runfiles/_repo_mapping",
- {",config.json,config.json~1.2.3", ",my_module,_main",
- ",my_protobuf,protobuf~3.19.2", ",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"}));
+ {",config.json,config.json+1.2.3", ",my_module,_main",
+ ",my_protobuf,protobuf+3.19.2", ",my_workspace,_main",
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"}));
ASSERT_TRUE(rm != nullptr);
string dir = rm->DirName();
string argv0(dir.substr(0, dir.size() - string(".runfiles").size()));
@@ -724,28 +724,28 @@ TEST_F(RunfilesTest, DirectoryBasedRlocationWithRepoMapping_fromMain) {
EXPECT_EQ(r->Rlocation("my_workspace/bar/runfile"),
dir + "/_main/bar/runfile");
EXPECT_EQ(r->Rlocation("my_protobuf/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
+ dir + "/protobuf+3.19.2/foo/runfile");
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir"),
- dir + "/protobuf~3.19.2/bar/dir");
+ dir + "/protobuf+3.19.2/bar/dir");
EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("protobuf/foo/runfile"),
dir + "/protobuf/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("_main/bar/runfile"), dir + "/_main/bar/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir"),
- dir + "/protobuf~3.19.2/bar/dir");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/foo/runfile"),
+ dir + "/protobuf+3.19.2/foo/runfile");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir"),
+ dir + "/protobuf+3.19.2/bar/dir");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/file"),
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("config.json"), dir + "/config.json");
}
@@ -754,10 +754,10 @@ TEST_F(RunfilesTest, DirectoryBasedRlocationWithRepoMapping_fromOtherRepo) {
string uid = LINE_AS_STRING();
unique_ptr rm(
MockFile::Create("foo" + uid + ".runfiles/_repo_mapping",
- {",config.json,config.json~1.2.3", ",my_module,_main",
- ",my_protobuf,protobuf~3.19.2", ",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"}));
+ {",config.json,config.json+1.2.3", ",my_module,_main",
+ ",my_protobuf,protobuf+3.19.2", ",my_workspace,_main",
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"}));
ASSERT_TRUE(rm != nullptr);
string dir = rm->DirName();
string argv0(dir.substr(0, dir.size() - string(".runfiles").size()));
@@ -765,32 +765,32 @@ TEST_F(RunfilesTest, DirectoryBasedRlocationWithRepoMapping_fromOtherRepo) {
string error;
unique_ptr r(Runfiles::Create(argv0, /*runfiles_manifest_file=*/"",
/*runfiles_dir=*/"",
- "protobuf~3.19.2", &error));
+ "protobuf+3.19.2", &error));
ASSERT_TRUE(r != nullptr);
EXPECT_TRUE(error.empty());
EXPECT_EQ(r->Rlocation("protobuf/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), dir + "/protobuf~3.19.2/bar/dir");
+ dir + "/protobuf+3.19.2/foo/runfile");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), dir + "/protobuf+3.19.2/bar/dir");
EXPECT_EQ(r->Rlocation("protobuf/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("my_module/bar/runfile"),
dir + "/my_module/bar/runfile");
- EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"),
- dir + "/my_protobuf/bar/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/my_protobuf/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("_main/bar/runfile"), dir + "/_main/bar/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir"),
- dir + "/protobuf~3.19.2/bar/dir");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/foo/runfile"),
+ dir + "/protobuf+3.19.2/foo/runfile");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir"),
+ dir + "/protobuf+3.19.2/bar/dir");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/file"),
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("config.json"), dir + "/config.json");
}
@@ -800,10 +800,10 @@ TEST_F(RunfilesTest,
string uid = LINE_AS_STRING();
unique_ptr rm(
MockFile::Create("foo" + uid + ".runfiles/_repo_mapping",
- {",config.json,config.json~1.2.3", ",my_module,_main",
- ",my_protobuf,protobuf~3.19.2", ",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"}));
+ {",config.json,config.json+1.2.3", ",my_module,_main",
+ ",my_protobuf,protobuf+3.19.2", ",my_workspace,_main",
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"}));
ASSERT_TRUE(rm != nullptr);
string dir = rm->DirName();
string argv0(dir.substr(0, dir.size() - string(".runfiles").size()));
@@ -812,32 +812,32 @@ TEST_F(RunfilesTest,
unique_ptr r(Runfiles::Create(argv0, /*runfiles_manifest_file=*/"",
/*runfiles_dir=*/"",
/*source_repository=*/"", &error));
- r = r->WithSourceRepository("protobuf~3.19.2");
+ r = r->WithSourceRepository("protobuf+3.19.2");
ASSERT_TRUE(r != nullptr);
EXPECT_TRUE(error.empty());
EXPECT_EQ(r->Rlocation("protobuf/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), dir + "/protobuf~3.19.2/bar/dir");
+ dir + "/protobuf+3.19.2/foo/runfile");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir"), dir + "/protobuf+3.19.2/bar/dir");
EXPECT_EQ(r->Rlocation("protobuf/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("protobuf/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("my_module/bar/runfile"),
dir + "/my_module/bar/runfile");
- EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"),
- dir + "/my_protobuf/bar/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/my_protobuf/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("_main/bar/runfile"), dir + "/_main/bar/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/foo/runfile"),
- dir + "/protobuf~3.19.2/foo/runfile");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir"),
- dir + "/protobuf~3.19.2/bar/dir");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/file"),
- dir + "/protobuf~3.19.2/bar/dir/file");
- EXPECT_EQ(r->Rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"),
- dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/foo/runfile"),
+ dir + "/protobuf+3.19.2/foo/runfile");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir"),
+ dir + "/protobuf+3.19.2/bar/dir");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/file"),
+ dir + "/protobuf+3.19.2/bar/dir/file");
+ EXPECT_EQ(r->Rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"),
+ dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
EXPECT_EQ(r->Rlocation("config.json"), dir + "/config.json");
}
diff --git a/tools/java/runfiles/testing/RunfilesTest.java b/tools/java/runfiles/testing/RunfilesTest.java
index 92d420f77ce7bf..215842df2e1e58 100644
--- a/tools/java/runfiles/testing/RunfilesTest.java
+++ b/tools/java/runfiles/testing/RunfilesTest.java
@@ -264,21 +264,21 @@ public void testManifestBasedRlocationWithRepoMapping_fromMain() throws Exceptio
tempFile(
"foo.repo_mapping",
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Path mf =
tempFile(
"foo.runfiles_manifest",
ImmutableList.of(
"_repo_mapping " + rm,
"config.json /etc/config.json",
- "protobuf~3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
+ "protobuf+3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
"_main/bar/runfile /the/path/./to/other//other runfile.txt",
- "protobuf~3.19.2/bar/dir E:\\Actual Path\\Directory"));
+ "protobuf+3.19.2/bar/dir E:\\Actual Path\\Directory"));
Runfiles r = Runfiles.createManifestBasedForTesting(mf.toString()).withSourceRepository("");
assertThat(r.rlocation("my_module/bar/runfile"))
@@ -290,23 +290,23 @@ public void testManifestBasedRlocationWithRepoMapping_fromMain() throws Exceptio
assertThat(r.rlocation("my_protobuf/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
assertThat(r.rlocation("my_protobuf/bar/dir/file"))
.isEqualTo("E:\\Actual Path\\Directory/file");
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
assertThat(r.rlocation("protobuf/foo/runfile")).isNull();
assertThat(r.rlocation("protobuf/bar/dir")).isNull();
assertThat(r.rlocation("protobuf/bar/dir/file")).isNull();
- assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le")).isNull();
+ assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le")).isNull();
assertThat(r.rlocation("_main/bar/runfile"))
.isEqualTo("/the/path/./to/other//other runfile.txt");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
.isEqualTo("C:/Actual Path\\protobuf\\runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
.isEqualTo("E:\\Actual Path\\Directory/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo("/etc/config.json");
assertThat(r.rlocation("_main")).isNull();
@@ -320,21 +320,21 @@ public void testManifestBasedRlocationUnmapped() throws Exception {
tempFile(
"foo.repo_mapping",
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Path mf =
tempFile(
"foo.runfiles_manifest",
ImmutableList.of(
"_repo_mapping " + rm,
"config.json /etc/config.json",
- "protobuf~3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
+ "protobuf+3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
"_main/bar/runfile /the/path/./to/other//other runfile.txt",
- "protobuf~3.19.2/bar/dir E:\\Actual Path\\Directory"));
+ "protobuf+3.19.2/bar/dir E:\\Actual Path\\Directory"));
Runfiles r = Runfiles.createManifestBasedForTesting(mf.toString()).unmapped();
assertThat(r.rlocation("my_module/bar/runfile")).isNull();
@@ -342,22 +342,22 @@ public void testManifestBasedRlocationUnmapped() throws Exception {
assertThat(r.rlocation("my_protobuf/foo/runfile")).isNull();
assertThat(r.rlocation("my_protobuf/bar/dir")).isNull();
assertThat(r.rlocation("my_protobuf/bar/dir/file")).isNull();
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le")).isNull();
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le")).isNull();
assertThat(r.rlocation("protobuf/foo/runfile")).isNull();
assertThat(r.rlocation("protobuf/bar/dir")).isNull();
assertThat(r.rlocation("protobuf/bar/dir/file")).isNull();
- assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le")).isNull();
+ assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le")).isNull();
assertThat(r.rlocation("_main/bar/runfile"))
.isEqualTo("/the/path/./to/other//other runfile.txt");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
.isEqualTo("C:/Actual Path\\protobuf\\runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
.isEqualTo("E:\\Actual Path\\Directory/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo("/etc/config.json");
assertThat(r.rlocation("_main")).isNull();
@@ -371,46 +371,46 @@ public void testManifestBasedRlocationWithRepoMapping_fromOtherRepo() throws Exc
tempFile(
"foo.repo_mapping",
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Path mf =
tempFile(
"foo.runfiles/MANIFEST",
ImmutableList.of(
"_repo_mapping " + rm,
"config.json /etc/config.json",
- "protobuf~3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
+ "protobuf+3.19.2/foo/runfile C:/Actual Path\\protobuf\\runfile",
"_main/bar/runfile /the/path/./to/other//other runfile.txt",
- "protobuf~3.19.2/bar/dir E:\\Actual Path\\Directory"));
+ "protobuf+3.19.2/bar/dir E:\\Actual Path\\Directory"));
Runfiles r =
Runfiles.createManifestBasedForTesting(mf.toString())
- .withSourceRepository("protobuf~3.19.2");
+ .withSourceRepository("protobuf+3.19.2");
assertThat(r.rlocation("protobuf/foo/runfile")).isEqualTo("C:/Actual Path\\protobuf\\runfile");
assertThat(r.rlocation("protobuf/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
assertThat(r.rlocation("protobuf/bar/dir/file")).isEqualTo("E:\\Actual Path\\Directory/file");
- assertThat(r.rlocation("protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
assertThat(r.rlocation("my_module/bar/runfile")).isNull();
assertThat(r.rlocation("my_protobuf/foo/runfile")).isNull();
assertThat(r.rlocation("my_protobuf/bar/dir")).isNull();
assertThat(r.rlocation("my_protobuf/bar/dir/file")).isNull();
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le")).isNull();
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le")).isNull();
assertThat(r.rlocation("_main/bar/runfile"))
.isEqualTo("/the/path/./to/other//other runfile.txt");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
.isEqualTo("C:/Actual Path\\protobuf\\runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo("E:\\Actual Path\\Directory");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
.isEqualTo("E:\\Actual Path\\Directory/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo("E:\\Actual Path\\Directory/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo("/etc/config.json");
assertThat(r.rlocation("_main")).isNull();
@@ -425,36 +425,36 @@ public void testDirectoryBasedRlocationWithRepoMapping_fromMain() throws Excepti
tempFile(
dir.resolve("_repo_mapping").toString(),
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Runfiles r = Runfiles.createDirectoryBasedForTesting(dir.toString()).withSourceRepository("");
assertThat(r.rlocation("my_module/bar/runfile")).isEqualTo(dir + "/_main/bar/runfile");
assertThat(r.rlocation("my_workspace/bar/runfile")).isEqualTo(dir + "/_main/bar/runfile");
assertThat(r.rlocation("my_protobuf/foo/runfile"))
- .isEqualTo(dir + "/protobuf~3.19.2/foo/runfile");
- assertThat(r.rlocation("my_protobuf/bar/dir")).isEqualTo(dir + "/protobuf~3.19.2/bar/dir");
+ .isEqualTo(dir + "/protobuf+3.19.2/foo/runfile");
+ assertThat(r.rlocation("my_protobuf/bar/dir")).isEqualTo(dir + "/protobuf+3.19.2/bar/dir");
assertThat(r.rlocation("my_protobuf/bar/dir/file"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/file");
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/file");
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("protobuf/foo/runfile")).isEqualTo(dir + "/protobuf/foo/runfile");
- assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("_main/bar/runfile")).isEqualTo(dir + "/_main/bar/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
- .isEqualTo(dir + "/protobuf~3.19.2/foo/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo(dir + "/protobuf~3.19.2/bar/dir");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
+ .isEqualTo(dir + "/protobuf+3.19.2/foo/runfile");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo(dir + "/protobuf+3.19.2/bar/dir");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/file");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo(dir + "/config.json");
}
@@ -466,12 +466,12 @@ public void testDirectoryBasedRlocationUnmapped() throws Exception {
tempFile(
dir.resolve("_repo_mapping").toString(),
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Runfiles r = Runfiles.createDirectoryBasedForTesting(dir.toString()).unmapped();
assertThat(r.rlocation("my_module/bar/runfile")).isEqualTo(dir + "/my_module/bar/runfile");
@@ -481,21 +481,21 @@ public void testDirectoryBasedRlocationUnmapped() throws Exception {
assertThat(r.rlocation("my_protobuf/bar/dir")).isEqualTo(dir + "/my_protobuf/bar/dir");
assertThat(r.rlocation("my_protobuf/bar/dir/file"))
.isEqualTo(dir + "/my_protobuf/bar/dir/file");
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/my_protobuf/bar/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/my_protobuf/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("protobuf/foo/runfile")).isEqualTo(dir + "/protobuf/foo/runfile");
- assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf/bar/dir/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf/bar/dir/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("_main/bar/runfile")).isEqualTo(dir + "/_main/bar/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
- .isEqualTo(dir + "/protobuf~3.19.2/foo/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo(dir + "/protobuf~3.19.2/bar/dir");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
+ .isEqualTo(dir + "/protobuf+3.19.2/foo/runfile");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo(dir + "/protobuf+3.19.2/bar/dir");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/file");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo(dir + "/config.json");
}
@@ -507,35 +507,35 @@ public void testDirectoryBasedRlocationWithRepoMapping_fromOtherRepo() throws Ex
tempFile(
dir.resolve("_repo_mapping").toString(),
ImmutableList.of(
- ",config.json,config.json~1.2.3",
+ ",config.json,config.json+1.2.3",
",my_module,_main",
- ",my_protobuf,protobuf~3.19.2",
+ ",my_protobuf,protobuf+3.19.2",
",my_workspace,_main",
- "protobuf~3.19.2,config.json,config.json~1.2.3",
- "protobuf~3.19.2,protobuf,protobuf~3.19.2"));
+ "protobuf+3.19.2,config.json,config.json+1.2.3",
+ "protobuf+3.19.2,protobuf,protobuf+3.19.2"));
Runfiles r =
Runfiles.createDirectoryBasedForTesting(dir.toString())
- .withSourceRepository("protobuf~3.19.2");
+ .withSourceRepository("protobuf+3.19.2");
- assertThat(r.rlocation("protobuf/foo/runfile")).isEqualTo(dir + "/protobuf~3.19.2/foo/runfile");
- assertThat(r.rlocation("protobuf/bar/dir")).isEqualTo(dir + "/protobuf~3.19.2/bar/dir");
+ assertThat(r.rlocation("protobuf/foo/runfile")).isEqualTo(dir + "/protobuf+3.19.2/foo/runfile");
+ assertThat(r.rlocation("protobuf/bar/dir")).isEqualTo(dir + "/protobuf+3.19.2/bar/dir");
assertThat(r.rlocation("protobuf/bar/dir/file"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/file");
- assertThat(r.rlocation("protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/file");
+ assertThat(r.rlocation("protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("my_module/bar/runfile")).isEqualTo(dir + "/my_module/bar/runfile");
- assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/my_protobuf/bar/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("my_protobuf/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/my_protobuf/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("_main/bar/runfile")).isEqualTo(dir + "/_main/bar/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/foo/runfile"))
- .isEqualTo(dir + "/protobuf~3.19.2/foo/runfile");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir")).isEqualTo(dir + "/protobuf~3.19.2/bar/dir");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/file"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/file");
- assertThat(r.rlocation("protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le"))
- .isEqualTo(dir + "/protobuf~3.19.2/bar/dir/de eply/nes ted/fi~le");
+ assertThat(r.rlocation("protobuf+3.19.2/foo/runfile"))
+ .isEqualTo(dir + "/protobuf+3.19.2/foo/runfile");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir")).isEqualTo(dir + "/protobuf+3.19.2/bar/dir");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/file"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/file");
+ assertThat(r.rlocation("protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le"))
+ .isEqualTo(dir + "/protobuf+3.19.2/bar/dir/de eply/nes ted/fi+le");
assertThat(r.rlocation("config.json")).isEqualTo(dir + "/config.json");
}
diff --git a/tools/python/runfiles/runfiles.py b/tools/python/runfiles/runfiles.py
index 2af3efea353ec3..72de4da8f5174a 100644
--- a/tools/python/runfiles/runfiles.py
+++ b/tools/python/runfiles/runfiles.py
@@ -172,7 +172,7 @@ def CurrentRepository(self, frame=1):
"""Returns the canonical name of the caller's Bazel repository.
For example, this function returns '' (the empty string) when called from
- the main repository and a string of the form 'rules_python~0.13.0` when
+ the main repository and a string of the form 'rules_python+0.13.0` when
called from code in the repository corresponding to the rules_python Bazel
module.