aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppSemantics.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/proto/BazelCcProtoAspect.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/AspectLegalCppSemantics.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java5
4 files changed, 30 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppSemantics.java
index b67e4ab043..5b9547d171 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppSemantics.java
@@ -19,20 +19,20 @@ import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
+import com.google.devtools.build.lib.rules.cpp.AspectLegalCppSemantics;
import com.google.devtools.build.lib.rules.cpp.CppCompilationContext.Builder;
import com.google.devtools.build.lib.rules.cpp.CppCompileActionBuilder;
import com.google.devtools.build.lib.rules.cpp.CppCompileActionContext;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.HeadersCheckingMode;
-import com.google.devtools.build.lib.rules.cpp.CppSemantics;
import com.google.devtools.build.lib.rules.cpp.IncludeProcessing;
import com.google.devtools.build.lib.rules.cpp.NoProcessing;
/**
* C++ compilation semantics.
*/
-public class BazelCppSemantics implements CppSemantics {
- public static final CppSemantics INSTANCE = new BazelCppSemantics();
+public class BazelCppSemantics implements AspectLegalCppSemantics {
+ public static final BazelCppSemantics INSTANCE = new BazelCppSemantics();
private final IncludeProcessing includeProcessing;
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/proto/BazelCcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/proto/BazelCcProtoAspect.java
index f2b2cef1cc..d14d5386ad 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/proto/BazelCcProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/proto/BazelCcProtoAspect.java
@@ -17,7 +17,7 @@ package com.google.devtools.build.lib.bazel.rules.cpp.proto;
import static com.google.devtools.build.lib.rules.cpp.CppRuleClasses.ccToolchainAttribute;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
-import com.google.devtools.build.lib.rules.cpp.CppSemantics;
+import com.google.devtools.build.lib.rules.cpp.AspectLegalCppSemantics;
import com.google.devtools.build.lib.rules.cpp.proto.CcProtoAspect;
/**
@@ -26,7 +26,7 @@ import com.google.devtools.build.lib.rules.cpp.proto.CcProtoAspect;
* <p>This class is used to inject Bazel-specific constants into CcProtoAspect.
*/
public class BazelCcProtoAspect extends CcProtoAspect {
- public BazelCcProtoAspect(CppSemantics cppSemantics, RuleDefinitionEnvironment env) {
+ public BazelCcProtoAspect(AspectLegalCppSemantics cppSemantics, RuleDefinitionEnvironment env) {
super(cppSemantics, ccToolchainAttribute(env));
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/AspectLegalCppSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/AspectLegalCppSemantics.java
new file mode 100644
index 0000000000..040a316982
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/AspectLegalCppSemantics.java
@@ -0,0 +1,22 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.devtools.build.lib.rules.cpp;
+
+/**
+ * A marker for {@link CppSemantics} implementations that are legal as members of an aspect. These
+ * implementations must not be heavy to serialize (e.g. a singleton is fine), so as not to weigh
+ * down AspectKey.
+ */
+public interface AspectLegalCppSemantics extends CppSemantics {}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
index 1aa251c1db..2bd36280b4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
@@ -40,6 +40,7 @@ import com.google.devtools.build.lib.packages.AspectParameters;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.NativeAspectClass;
import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
+import com.google.devtools.build.lib.rules.cpp.AspectLegalCppSemantics;
import com.google.devtools.build.lib.rules.cpp.CcCommon;
import com.google.devtools.build.lib.rules.cpp.CcLibraryHelper;
import com.google.devtools.build.lib.rules.cpp.CcLibraryHelper.Info;
@@ -79,8 +80,8 @@ public class CcProtoAspect extends NativeAspectClass implements ConfiguredAspect
private final CppSemantics cppSemantics;
private final Attribute.LateBoundDefault<?, Label> ccToolchainAttrValue;
- public CcProtoAspect(
- CppSemantics cppSemantics, Attribute.LateBoundDefault<?, Label> ccToolchainAttrValue) {
+ public CcProtoAspect(AspectLegalCppSemantics cppSemantics,
+ Attribute.LateBoundDefault<?, Label> ccToolchainAttrValue) {
this.cppSemantics = cppSemantics;
this.ccToolchainAttrValue = ccToolchainAttrValue;
}