From 3ee4868345cc68bbfa228d6ad678603a01648d27 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Mon, 17 May 2021 13:11:10 +0200 Subject: [PATCH] Support using %workspace% in registry URL %workspace% in the URL will be replaced with the current workspace root --- .../devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java index 9eac3c8c86d800..0fd2f279476378 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileFunction.java @@ -199,7 +199,8 @@ private Optional getModuleFile(ModuleKey key, StarlarkOverr ImmutableList.Builder registryObjects = new ImmutableList.Builder<>(); for (String registryUrl : registries) { try { - registryObjects.add(registryFactory.getRegistryWithUrl(registryUrl)); + registryObjects.add(registryFactory.getRegistryWithUrl( + registryUrl.replace("%workspace%", workspaceRoot.getPathString()))); } catch (URISyntaxException e) { throw new ModuleFileFunctionException(e); }