From d2515e36351911ebae4d267c1d8adfc7c72bad19 Mon Sep 17 00:00:00 2001 From: Janak Ramakrishnan Date: Mon, 11 Apr 2016 19:25:23 +0000 Subject: RELNOTES[INC]: It is now an error for a cc rule's includes attribute to point to the workspace root. -- MOS_MIGRATED_REVID=119558172 --- .../java/com/google/devtools/build/lib/rules/cpp/CcCommon.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/google/devtools/build') 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", "'" -- cgit v1.2.3