aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-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",
"'"