aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-04-11 19:25:23 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-04-12 13:58:51 +0000
commitd2515e36351911ebae4d267c1d8adfc7c72bad19 (patch)
tree0a056d3c5b3c49fe80455d3f37094cd18920f19a /src/main/java/com/google/devtools/build/lib/rules/cpp
parenta419f488fa358608dbfa9e771711e07af95922a9 (diff)
RELNOTES[INC]: It is now an error for a cc rule's includes attribute to point to the workspace root.
-- MOS_MIGRATED_REVID=119558172
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
index b1639ea9a2..69763d4513 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
@@ -408,7 +408,15 @@ public final class CcCommon {
ruleContext.attributeError("includes",
"Path references a path above the execution root.");
}
- if (!includesPath.startsWith(packageFragment)) {
+ if (includesPath.segmentCount() == 0) {
+ ruleContext.attributeError(
+ "includes",
+ "'"
+ + includesAttr
+ + "' resolves to the workspace root, which would allow this rule and all of its "
+ + "transitive dependents to include any file in your workspace. Please include only"
+ + " what you need");
+ } else if (!includesPath.startsWith(packageFragment)) {
ruleContext.attributeWarning(
"includes",
"'"