diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages/RuleClass.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/RuleClass.java | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java index 7846250ae8..e3a673fc37 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java @@ -572,12 +572,10 @@ public final class RuleClass { } /** - * Declares that the implementation of this rule class requires the given configuration - * fragments to be present in the configuration. The value is inherited by subclasses. + * Declares that the implementation of the associated rule class requires the given + * fragments to be present in this rule's host and target configurations. * - * <p>For backwards compatibility, if the set is empty, all fragments may be accessed. But note - * that this is only enforced in the {@link com.google.devtools.build.lib.analysis.RuleContext} - * class. + * <p>The value is inherited by subclasses. */ public Builder requiresConfigurationFragments(Class<?>... configurationFragments) { configurationFragmentPolicy.requiresConfigurationFragments(configurationFragments); @@ -585,20 +583,24 @@ public final class RuleClass { } /** - * Sets the policy for the case where the configuration is missing required fragments (see - * {@link #requiresConfigurationFragments}). + * Declares that the implementation of the associated rule class requires the given + * fragments to be present in the host configuration. + * + * <p>The value is inherited by subclasses. */ - public Builder setMissingFragmentPolicy(MissingFragmentPolicy missingFragmentPolicy) { - configurationFragmentPolicy.setMissingFragmentPolicy(missingFragmentPolicy); + public Builder requiresHostConfigurationFragments(Class<?>... configurationFragments) { + configurationFragmentPolicy + .requiresConfigurationFragments(ConfigurationTransition.HOST, configurationFragments); return this; } /** - * Declares the configuration fragments that are required by this rule. + * Declares the configuration fragments that are required by this rule for the specified + * configuration. Valid transition values are HOST for the host configuration and NONE for + * the target configuration. * - * <p>In contrast to {@link #requiresConfigurationFragments(Class...)}, this method a) takes the - * names of fragments instead of their classes and b) distinguishes whether the fragments can be - * accessed in host (HOST) or target (NONE) configuration. + * <p>In contrast to {@link #requiresConfigurationFragments(Class...)}, this method takes the + * names of fragments instead of their classes. */ public Builder requiresConfigurationFragments( FragmentClassNameResolver fragmentNameResolver, @@ -608,6 +610,15 @@ public final class RuleClass { return this; } + /** + * Sets the policy for the case where the configuration is missing required fragments (see + * {@link #requiresConfigurationFragments}). + */ + public Builder setMissingFragmentPolicy(MissingFragmentPolicy missingFragmentPolicy) { + configurationFragmentPolicy.setMissingFragmentPolicy(missingFragmentPolicy); + return this; + } + public Builder setUndocumented() { documented = false; return this; |