diff options
author | 2017-08-30 21:50:41 +0200 | |
---|---|---|
committer | 2017-08-31 13:44:29 +0200 | |
commit | 50f46e290b7f52123d99edb125d7b53dbe2b7b4d (patch) | |
tree | b2efea6c88e54ad9ed5a94aa8f94452f38aa198c /src/main/java/com/google/devtools/build/lib/analysis | |
parent | e2ed2db016d8472dcd2ae97fde241cfa4374f2e6 (diff) |
android_test binary_under_test/deps must have the same flags if any are set.
After this CL, if the feature_flags attribute of android_test or
android_binary is not set, no transition takes place when entering that
rule. This means that if it is depended upon by another test or binary, it
will use the enclosing test or binary's flags.
This permits users of feature flags to depend on non-users of feature flags.
The opposite is still not permitted. If a dep sets feature flags, then the
target depending on it must have the exact same feature flags set.
This way, all targets used in an android_test are built the same way, but
it's possible to interoperate with targets which are agnostic to feature
flags.
Note that "not set" is different from "set to the empty dictionary"; the
former reuses the definitions set higher up in the build graph, while the
latter clears all feature flag values and resets them to their defaults.
RELNOTES: None.
PiperOrigin-RevId: 167035122
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/config/ComposingRuleTransitionFactory.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/ComposingRuleTransitionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/config/ComposingRuleTransitionFactory.java index 3cc2ff71f4..d8e1c55332 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/ComposingRuleTransitionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/ComposingRuleTransitionFactory.java @@ -38,6 +38,17 @@ public class ComposingRuleTransitionFactory implements RuleTransitionFactory { @Override public Attribute.Transition buildTransitionFor(Rule rule) { + PatchTransition transition1 = (PatchTransition) rtf1.buildTransitionFor(rule); + PatchTransition transition2 = (PatchTransition) rtf2.buildTransitionFor(rule); + + if (transition1 == null) { + return transition2; + } + + if (transition2 == null) { + return transition1; + } + return new ComposingPatchTransition( (PatchTransition) rtf1.buildTransitionFor(rule), (PatchTransition) rtf2.buildTransitionFor(rule)); |