aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax
diff options
context:
space:
mode:
authorGravatar brandjon <brandjon@google.com>2017-10-06 06:07:13 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-10-06 19:48:49 +0200
commit617f8ff0f502e911bba61d0c33390413bef9250c (patch)
treefbb7e2481dc85609f13ca8be207d01e6fa7a38fd /src/main/java/com/google/devtools/build/lib/syntax
parentb4d87b54ec6d4aa95d3b77f23aed2ad75619e968 (diff)
Pass SkylarkSemantics through Skyframe instead of the options class
Also remove the use of the @UsesOnlyCoreTypes annotation on SkylarkSemanticsOptions. It was only there to help mark that the options class was safe to put in Skyframe. RELNOTES: None PiperOrigin-RevId: 171248504
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/Environment.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java9
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemanticsOptions.java18
3 files changed, 13 insertions, 20 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
index 967f4b52d2..fcd0b23925 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
@@ -650,12 +650,6 @@ public final class Environment implements Freezable {
return this;
}
- // TODO(brandjon): Remove this overload.
- public Builder setSemantics(SkylarkSemanticsOptions semantics) {
- this.semantics = semantics.toSkylarkSemantics();
- return this;
- }
-
public Builder setSemantics(SkylarkSemantics semantics) {
this.semantics = semantics;
return this;
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
index 2273f7e8c7..4041a5bf3e 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
@@ -29,6 +29,15 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class SkylarkSemantics {
+ /**
+ * The AutoValue-generated concrete class implementing this one.
+ *
+ * <p>AutoValue implementation classes are usually package-private. We expose it here for the
+ * benefit of code that relies on reflection.
+ */
+ public static final Class<? extends SkylarkSemantics> IMPL_CLASS =
+ AutoValue_SkylarkSemantics.class;
+
// <== Add new options here in alphabetic order ==>
public abstract boolean incompatibleBzlDisallowLoadAfterStatement();
public abstract boolean incompatibleCheckedArithmetic();
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemanticsOptions.java
index 74f6db4f63..5da780209a 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemanticsOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemanticsOptions.java
@@ -19,21 +19,15 @@ import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionMetadataTag;
import com.google.devtools.common.options.OptionsBase;
-import com.google.devtools.common.options.UsesOnlyCoreTypes;
import java.io.Serializable;
/**
* Contains options that affect Skylark's semantics.
*
- * <p>These are injected into Skyframe when a new build invocation occurs. Changing these options
- * between builds will trigger a reevaluation of everything that depends on the Skylark interpreter
- * &mdash; in particular, processing BUILD and .bzl files.
- *
- * <p>Because these options are stored in Skyframe, they must be immutable and serializable, and so
- * are subject to the restrictions of {@link UsesOnlyCoreTypes}: No {@link Option#allowMultiple}
- * options, and no options with types not handled by the default converters. (Technically all
- * options classes are mutable because their fields are public and non-final, but we assume no one
- * is manipulating these fields by the time parsing is complete.)
+ * <p>These are injected into Skyframe (as an instance of {@link SkylarkSemantics}) when a new build
+ * invocation occurs. Changing these options between builds will therefore trigger a reevaluation of
+ * everything that depends on the Skylark interpreter &mdash; in particular, evaluation of all BUILD
+ * and .bzl files.
*
* <p><em>To add a new option, update the following:</em>
* <ul>
@@ -60,10 +54,6 @@ import java.io.Serializable;
* must be kept consistent; to make it easy we use alphabetic order. The parts that need updating
* are marked with the comment "<== Add new options here in alphabetic order ==>".
*/
-// TODO(brandjon): Do not store these options in Skyframe. Instead store SkylarkSemantics objects.
-// Eliminate use of UsesOnlyCoreTypes, and then we can remove UsesOnlyCoreTypes from the options
-// parser entirely.
-@UsesOnlyCoreTypes
public class SkylarkSemanticsOptions extends OptionsBase implements Serializable {
// <== Add new options here in alphabetic order ==>