aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar juliexxia <juliexxia@google.com>2017-10-17 19:05:43 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-10-18 10:28:20 +0200
commit85b7af7dd58d331667205dfa7ea8a0f221218bea (patch)
tree1ea25367074948d87298224a9a2493f5985f1f1d /src/main/java/com/google/devtools/build/lib
parent87a5fa9d05dec29d92dd008a4f8fa725181b1d03 (diff)
PiperOrigin-RevId: 172480513
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/config/ConfigRuleClasses.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/config/ConfigRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/config/ConfigRuleClasses.java
index 6d6701f35b..7ba3611dad 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/config/ConfigRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/config/ConfigRuleClasses.java
@@ -228,6 +228,54 @@ public class ConfigRuleClasses {
.allowedFileTypes()
.mandatoryProviders(ImmutableList.of(ConfigFeatureFlagProvider.id()))
.nonconfigurable(NONCONFIGURABLE_ATTRIBUTE_REASON))
+ /* <!-- #BLAZE_RULE(config_setting).ATTRIBUTE(constraint_values) -->
+ The set of <code>constraint_values</code> that match this rule.
+
+ <p>A <a href="platform.html#constraint_value">constraint_value</a> is composed of a name
+ and a corresponding <a href="platform.html#constraint_setting">constraint_setting</a>
+ which classifies the value. A <a href=""platform.html#platform>platform</a> consists of a
+ collection of <code>constraint_value</code> labels which describes target itself and/or
+ how its environment.
+ </p>
+
+ <pre class="code">
+ constraint_setting(name = "rock_type")
+ constraint_value(name = metamorphic, constraint_setting = "rock_type")
+ platform(
+ name = "my_platform_rocks",
+ constraint_values = [":metamorphic"]
+ )
+ </pre>
+
+ <p>As mentioned above, this rule inherits the configuration of the configured target that
+ references it in a <code>select</code> statement. This <code>constraint_values</code>
+ attribute is considered to "match" a Blaze invocation if it includes each
+ <code>constraint_value</code> specified in the configuration's target platform which is
+ set with the command line flag <code>--experimental_platforms</code>. If it contains
+ extra <code>constraint_values</code> not included in the target platform, it is still
+ considered a match. In this example, both <code>slate</code> and
+ <code>marble</code> would be considered matches for a blaze invocation which
+ uses <code>--experimental_platforms=my_platform_rocks</code>. Multiple matches like this
+ may lead to ambiguous select resolves and are not allowed.
+ </p>
+ <pre class = "code">
+ constraint_setting(name = "color")
+ constraint_value(name = "white", constraint_setting = "color")
+
+ config_setting(
+ name = "slate",
+ constraint_values = [":metamorphic"]
+ )
+
+ config_setting(
+ name = "marble",
+ constraint_values = [
+ ":metamorphic",
+ ":white"
+ ]
+ )
+ </pre>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(CONSTRAINT_VALUES_ATTRIBUTE, LABEL_LIST)
.nonconfigurable(NONCONFIGURABLE_ATTRIBUTE_REASON)
@@ -292,6 +340,28 @@ config_setting(
)
</pre>
+<p>The following config_setting matches any Blaze invocation that builds a platform which contains
+ exactly the same or a subset of its constraint_values (like the example below).
+</p>
+
+<pre class=""code">
+config_setting(
+ name = "marble",
+ constraint_values = [
+ "white",
+ "metamorphic",
+ ]
+)
+
+platform(
+ name = "marble_platform",
+ constraint_values = [
+ "white",
+ "metamorphic"
+ ]
+)
+</pre>
+
<h4 id="config_setting_notes">Notes</h4>
<p>See <a href="${link select}">select</a> for policies on what happens depending on how
@@ -316,6 +386,13 @@ config_setting(
same thing.
</p>
+<p><a href="general.html#config_setting.values"><code>values</code></a>,
+ <a href="general.html#config_setting.define_values"><code>define_values</code></a>, and
+ <a href=general.html#config_setting.constraint_values"><code>constraint_values</code></a>
+ can be used in any combination in the same config_setting but at least one must be set for any
+ given config_setting.
+</p>
+
<!-- #END_BLAZE_RULE -->*/
/** Rule definition for Android's config_feature_flag rule. */