Create ValidationEnvironment from Environment
Allow ValidationEnvironment to be created from initial Environment so that
there is no need to manually keep two different sets of constructors in synch.
--
MOS_MIGRATED_REVID=101588695
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 543c71e..40253e5 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
@@ -229,7 +229,7 @@
* Used to make the label instances unique, so that we don't create a new
* instance for every rule.
*/
- private static LoadingCache<String, Label> LABELS = CacheBuilder.newBuilder().build(
+ private static final LoadingCache<String, Label> LABELS = CacheBuilder.newBuilder().build(
new CacheLoader<String, Label>() {
@Override
public Label load(String from) {
@@ -307,8 +307,9 @@
this.configurationCollectionFactory = configurationCollectionFactory;
this.prerequisiteValidator = prerequisiteValidator;
this.skylarkAccessibleJavaClasses = skylarkAccessibleJavaClasses;
- this.skylarkValidationEnvironment = SkylarkModules.getValidationEnvironment(
- skylarkAccessibleJavaClasses.keySet());
+ this.skylarkValidationEnvironment = new ValidationEnvironment(
+ // TODO(bazel-team): refactor constructors so we don't have those null-s
+ createSkylarkRuleClassEnvironment(null, null));
}
public PrerequisiteValidator getPrerequisiteValidator() {