diff options
author | 2017-05-03 22:58:50 +0200 | |
---|---|---|
committer | 2017-05-04 13:13:54 +0200 | |
commit | d746655be6a46ac05252cf460dfed14d1f7ca120 (patch) | |
tree | 46f2e7da93f68844b1e92b58bb0072f67b9712ee /src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java | |
parent | 5f1d88646b35625aa90a178efb8ef8ca4b736a00 (diff) |
BuildOptions cleanup:
1) Remove obsolete originalOptions field. This was originally added to
support "parent" transitions, which supported config1 -> config2 -> config1
transitions by having config2 store config1's options.
The purpose of this feature was to support LIPO (which has a DATA -> TARGET
transition). But https://github.com/bazelbuild/bazel/commit/ff29c0b39cf936a2699b05edd54f483f1a037d93
makes this unnecessary.
2) Support the "disable actions" feature of the LIPO context collector configuration.
Putting this in BuildOptions make this dynamic config-compatible.
This change intentionally doesn't add disableOptions to BuildOptions.equals() or
BuildOptions.hashCode(). It'd be great to do that. But that has semantic consequences.
And we've run into really tricky bugs in the past with dynamic configurations and
BuildOptions.equals / BuildConfiguration.equals. So it's best to experiment with
that in its own change.
PiperOrigin-RevId: 154999718
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java index 85b97de04d..92565f84ec 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildConfigurationValue.java @@ -52,22 +52,7 @@ public class BuildConfigurationValue implements SkyValue { public static SkyKey key(Set<Class<? extends BuildConfiguration.Fragment>> fragments, BuildOptions buildOptions) { return LegacySkyKey.create( - SkyFunctions.BUILD_CONFIGURATION, new Key(fragments, buildOptions, true)); - } - - /** - * Returns the key for a requested action-disabled configuration (actions generated by rules - * under the configuration are ignored). - * - * @param fragments the fragments the configuration should contain - * @param buildOptions the build options the fragments should be built from - */ - @ThreadSafe - public static SkyKey disabledActionsKey( - Set<Class<? extends BuildConfiguration.Fragment>> fragments, - BuildOptions buildOptions) { - return LegacySkyKey.create( - SkyFunctions.BUILD_CONFIGURATION, new Key(fragments, buildOptions, false)); + SkyFunctions.BUILD_CONFIGURATION, new Key(fragments, buildOptions)); } static final class Key implements Serializable { @@ -76,10 +61,13 @@ public class BuildConfigurationValue implements SkyValue { private final boolean enableActions; Key(Set<Class<? extends BuildConfiguration.Fragment>> fragments, - BuildOptions buildOptions, boolean enableActions) { + BuildOptions buildOptions) { this.fragments = fragments; this.buildOptions = Preconditions.checkNotNull(buildOptions); - this.enableActions = enableActions; + // Cache this value for quicker access on .equals() / .hashCode(). We don't cache it inside + // BuildOptions because BuildOptions is mutable, so a cached value there could fall out of + // date while the BuildOptions is being prepared for this key. + this.enableActions = buildOptions.enableActions(); } Set<Class<? extends BuildConfiguration.Fragment>> getFragments() { @@ -90,10 +78,6 @@ public class BuildConfigurationValue implements SkyValue { return buildOptions; } - boolean actionsEnabled() { - return enableActions; - } - @Override public boolean equals(Object o) { if (!(o instanceof Key)) { @@ -102,7 +86,7 @@ public class BuildConfigurationValue implements SkyValue { Key otherConfig = (Key) o; return Objects.equals(fragments, otherConfig.fragments) && Objects.equals(buildOptions, otherConfig.buildOptions) - && otherConfig.actionsEnabled() == enableActions; + && enableActions == otherConfig.enableActions; } @Override |