aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2018-04-24 01:07:53 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-24 01:09:03 -0700
commitce2aa957c89ea7d7850aae767733f4e1f7c73e95 (patch)
tree7741daeb2baf2a6eef548cd971c8ec13a3cc9da9 /src/main/java/com/google/devtools/build
parente6febea501c0763b18e31fd2094aab928faf53e5 (diff)
Allow feature configuration to be created from skylark
Working towards #4571. RELNOTES: CppRules: Feature configuration can be created from Skylark PiperOrigin-RevId: 194048906
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java
index 938c361c67..c578bcf801 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java
@@ -39,6 +39,8 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.CToolchain;
@@ -928,11 +930,11 @@ public class CcToolchainFeatures implements Serializable {
}
/**
- * An executable to be invoked by a blaze action. Can carry information on its platform
+ * An executable to be invoked by a blaze action. Can carry information on its platform
* restrictions.
*/
@Immutable
- static class Tool {
+ public static class Tool {
private final PathFragment toolPathFragment;
private final ImmutableSet<String> executionRequirements;
private final ImmutableSet<WithFeatureSet> withFeatureSetSets;
@@ -957,7 +959,7 @@ public class CcToolchainFeatures implements Serializable {
}
/** Returns the path to this action's tool relative to the provided crosstool path. */
- PathFragment getToolPathFragment() {
+ public PathFragment getToolPathFragment() {
return toolPathFragment;
}
@@ -2054,6 +2056,12 @@ public class CcToolchainFeatures implements Serializable {
/** Captures the set of enabled features and action configs for a rule. */
@Immutable
@AutoCodec
+ @SkylarkModule(
+ name = "feature_configuration",
+ documented = false,
+ category = SkylarkModuleCategory.BUILTIN,
+ doc = "Class used to construct command lines from CROSSTOOL features."
+ )
public static class FeatureConfiguration {
private final ImmutableSet<String> enabledFeatureNames;
private final ImmutableList<Feature> enabledFeatures;
@@ -2161,10 +2169,8 @@ public class CcToolchainFeatures implements Serializable {
return envBuilder.build();
}
- /**
- * Returns a given action's tool under this FeatureConfiguration.
- */
- Tool getToolForAction(String actionName) {
+ /** Returns a given action's tool under this FeatureConfiguration. */
+ public Tool getToolForAction(String actionName) {
Preconditions.checkArgument(
actionConfigByActionName.containsKey(actionName),
"Action %s does not have an enabled configuration in the toolchain.",