Provide the ability to declare host config fragments for
native rules (which already exists for Skylark rules).

Don't actually distinguish between host and target fragments
on the consuming end yet, though. That'll be a subsequent
fine-tuning in constructing dynamic host / target configurations.

So this cl may overapproximate actual needs, but that puts us
in a better state than underapproximating, which just breaks builds.

Also add one instance: Jvm.class, which gets used by java_library
to find the java executable for compilation
(in BaseJavaCompilationHelper).

--
MOS_MIGRATED_REVID=107237470
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 7846250..e3a673f 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 @@
     }
 
     /**
-     * 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,6 +583,34 @@
     }
 
     /**
+     * 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 requiresHostConfigurationFragments(Class<?>... configurationFragments) {
+      configurationFragmentPolicy
+          .requiresConfigurationFragments(ConfigurationTransition.HOST, configurationFragments);
+      return this;
+    }
+
+    /**
+     * 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 takes the
+     * names of fragments instead of their classes.
+     */
+    public Builder requiresConfigurationFragments(
+        FragmentClassNameResolver fragmentNameResolver,
+        Map<ConfigurationTransition, ImmutableSet<String>> configurationFragmentNames) {
+      configurationFragmentPolicy.requiresConfigurationFragments(
+          fragmentNameResolver, configurationFragmentNames);
+      return this;
+    }
+
+    /**
      * Sets the policy for the case where the configuration is missing required fragments (see
      * {@link #requiresConfigurationFragments}).
      */
@@ -593,21 +619,6 @@
       return this;
     }
 
-    /**
-     * Declares the configuration fragments that are required by this rule.
-     *
-     * <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.
-     */
-    public Builder requiresConfigurationFragments(
-        FragmentClassNameResolver fragmentNameResolver,
-        Map<ConfigurationTransition, ImmutableSet<String>> configurationFragmentNames) {
-      configurationFragmentPolicy.requiresConfigurationFragments(
-          fragmentNameResolver, configurationFragmentNames);
-      return this;
-    }
-
     public Builder setUndocumented() {
       documented = false;
       return this;