diff options
Diffstat (limited to 'src')
4 files changed, 15 insertions, 17 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java index aee043ad5e..56170ba839 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java @@ -45,7 +45,6 @@ import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.In import com.google.devtools.build.lib.syntax.Environment; import com.google.devtools.build.lib.syntax.Environment.Extension; import com.google.devtools.build.lib.syntax.Mutability; -import com.google.devtools.build.lib.syntax.SkylarkType; import com.google.devtools.common.options.OptionsClassProvider; import java.lang.reflect.Constructor; @@ -105,7 +104,7 @@ public class ConfiguredRuleClassProvider implements RuleClassProvider { private ConfigurationCollectionFactory configurationCollectionFactory; private Class<? extends BuildConfiguration.Fragment> universalFragment; private PrerequisiteValidator prerequisiteValidator; - private ImmutableMap<String, SkylarkType> skylarkAccessibleJavaClasses = ImmutableMap.of(); + private ImmutableMap<String, Object> skylarkAccessibleTopLevels = ImmutableMap.of(); private ImmutableList.Builder<Class<?>> skylarkModules = ImmutableList.<Class<?>>builder().addAll(SkylarkModules.MODULES); private final List<Class<? extends FragmentOptions>> buildOptions = Lists.newArrayList(); @@ -193,8 +192,8 @@ public class ConfiguredRuleClassProvider implements RuleClassProvider { return this; } - public Builder setSkylarkAccessibleJavaClasses(ImmutableMap<String, SkylarkType> objects) { - this.skylarkAccessibleJavaClasses = objects; + public Builder setSkylarkAccessibleTopLevels(ImmutableMap<String, Object> objects) { + this.skylarkAccessibleTopLevels = objects; return this; } @@ -277,7 +276,7 @@ public class ConfiguredRuleClassProvider implements RuleClassProvider { configurationCollectionFactory, universalFragment, prerequisiteValidator, - skylarkAccessibleJavaClasses, + skylarkAccessibleTopLevels, skylarkModules.build(), buildOptions); } @@ -394,7 +393,7 @@ public class ConfiguredRuleClassProvider implements RuleClassProvider { ConfigurationCollectionFactory configurationCollectionFactory, Class<? extends BuildConfiguration.Fragment> universalFragment, PrerequisiteValidator prerequisiteValidator, - ImmutableMap<String, SkylarkType> skylarkAccessibleJavaClasses, + ImmutableMap<String, Object> skylarkAccessibleJavaClasses, ImmutableList<Class<?>> skylarkModules, List<Class<? extends FragmentOptions>> buildOptions) { this.preludeLabel = preludeLabel; @@ -514,13 +513,13 @@ public class ConfiguredRuleClassProvider implements RuleClassProvider { } private Environment.Frame createGlobals( - ImmutableMap<String, SkylarkType> skylarkAccessibleJavaClasses, + ImmutableMap<String, Object> skylarkAccessibleToplLevels, ImmutableList<Class<?>> modules) { try (Mutability mutability = Mutability.create("ConfiguredRuleClassProvider globals")) { Environment env = createSkylarkRuleClassEnvironment( mutability, SkylarkModules.getGlobals(modules), null, null, null); - for (Map.Entry<String, SkylarkType> entry : skylarkAccessibleJavaClasses.entrySet()) { - env.setup(entry.getKey(), entry.getValue().getType()); + for (Map.Entry<String, Object> entry : skylarkAccessibleToplLevels.entrySet()) { + env.setup(entry.getKey(), entry.getValue()); } return env.getGlobals(); } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java index ef0bca705c..61d5224b73 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java @@ -131,7 +131,6 @@ import com.google.devtools.build.lib.rules.repository.BindRule; import com.google.devtools.build.lib.rules.repository.LocalRepositoryRule; import com.google.devtools.build.lib.rules.repository.NewLocalRepositoryRule; import com.google.devtools.build.lib.rules.repository.WorkspaceBaseRule; -import com.google.devtools.build.lib.syntax.SkylarkType; import com.google.devtools.build.lib.util.ResourceFileLoader; import java.io.IOException; @@ -233,10 +232,10 @@ public class BazelRuleClassProvider { /** * Java objects accessible from Skylark rule implementations using this module. */ - public static final ImmutableMap<String, SkylarkType> skylarkBuiltinJavaObects = + public static final ImmutableMap<String, Object> skylarkBuiltinJavaObects = ImmutableMap.of( - "android_common", SkylarkType.of(AndroidSkylarkCommon.class), - "apple_common", SkylarkType.of(AppleSkylarkCommon.class)); + "android_common", new AndroidSkylarkCommon(), + "apple_common", new AppleSkylarkCommon()); public static void setup(ConfiguredRuleClassProvider.Builder builder) { builder @@ -248,7 +247,7 @@ public class BazelRuleClassProvider { .setRunfilesPrefix("") .setToolsRepository("@bazel_tools") .setPrerequisiteValidator(new BazelPrerequisiteValidator()) - .setSkylarkAccessibleJavaClasses(skylarkBuiltinJavaObects); + .setSkylarkAccessibleTopLevels(skylarkBuiltinJavaObects); builder.addBuildOptions(BUILD_OPTIONS); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java index 1724cfa4f8..462407bcdb 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java @@ -35,7 +35,7 @@ public class AndroidSkylarkCommon { + "a directory that designates resource kind (cf. " + "http://developer.android.com/guide/topics/resources/providing-resources.html)." ) - public static PathFragment getSourceDirectoryRelativePathFromResource(Artifact resource) { + public PathFragment getSourceDirectoryRelativePathFromResource(Artifact resource) { return AndroidCommon.getSourceDirectoryRelativePathFromResource(resource); } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleSkylarkCommon.java index 00b2c665d7..f77e8ba1b7 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleSkylarkCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleSkylarkCommon.java @@ -31,7 +31,7 @@ public class AppleSkylarkCommon { name = "apple_toolchain", doc = "Utilities for resolving items from the apple toolchain." ) - public static AppleToolchain getAppleToolchain() { + public AppleToolchain getAppleToolchain() { return new AppleToolchain(); } @@ -40,7 +40,7 @@ public class AppleSkylarkCommon { doc = "Retrieves ObjcProvider keys", structField = true ) - public static SkylarkKeyStore getKeys() { + public SkylarkKeyStore getKeys() { return new SkylarkKeyStore(); } } |