diff options
Diffstat (limited to 'src/main/java/com/google/devtools')
3 files changed, 14 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeModule.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeModule.java index 014c180fa1..9fbd0ff7d8 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeModule.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeModule.java @@ -254,13 +254,6 @@ public abstract class BlazeModule { } /** - * Returns the extensions this module contributes to the global namespace of the BUILD language. - */ - public PackageFactory.EnvironmentExtension getPackageEnvironmentExtension() { - return new PackageFactory.EmptyEnvironmentExtension(); - } - - /** * Returns a helper that the {@link PackageFactory} will use during package loading. If the module * does not provide any helper, it should return null. Note that only one helper per Bazel/Blaze * runtime is allowed. diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index 5037ee6d3e..61a02ab506 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -1090,11 +1090,6 @@ public final class BlazeRuntime { ConfiguredRuleClassProvider ruleClassProvider = ruleClassBuilder.build(); - List<PackageFactory.EnvironmentExtension> extensions = new ArrayList<>(); - for (BlazeModule module : blazeModules) { - extensions.add(module.getPackageEnvironmentExtension()); - } - Package.Builder.Helper packageBuilderHelper = null; for (BlazeModule module : blazeModules) { Package.Builder.Helper candidateHelper = @@ -1114,7 +1109,7 @@ public final class BlazeRuntime { ruleClassProvider, ruleClassBuilder.getPlatformRegexps(), serverBuilder.getAttributeContainerFactory(), - extensions, + serverBuilder.getEnvironmentExtensions(), BlazeVersionInfo.instance().getVersion(), packageBuilderHelper); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java b/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java index 6b387f8afc..dde7062bd2 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java @@ -18,6 +18,7 @@ import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.packages.AttributeContainer; +import com.google.devtools.build.lib.packages.PackageFactory; import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.query2.AbstractBlazeQueryEnvironment; import com.google.devtools.build.lib.query2.QueryEnvironmentFactory; @@ -40,6 +41,8 @@ public final class ServerBuilder { private final ImmutableList.Builder<QueryFunction> queryFunctions = ImmutableList.builder(); private final ImmutableList.Builder<OutputFormatter> queryOutputFormatters = ImmutableList.builder(); + private final ImmutableList.Builder<PackageFactory.EnvironmentExtension> environmentExtensions = + ImmutableList.builder(); @VisibleForTesting public ServerBuilder() {} @@ -72,6 +75,11 @@ public final class ServerBuilder { return queryOutputFormatters.build(); } + // Visible for WorkspaceResolver. + public ImmutableList<PackageFactory.EnvironmentExtension> getEnvironmentExtensions() { + return environmentExtensions.build(); + } + @VisibleForTesting public ImmutableList<BlazeCommand> getCommands() { return commands.build(); @@ -158,4 +166,9 @@ public final class ServerBuilder { this.queryOutputFormatters.addAll(formatters); return this; } + + public ServerBuilder addEnvironmentExtension(PackageFactory.EnvironmentExtension extension) { + this.environmentExtensions.add(extension); + return this; + } } |