diff options
author | 2016-03-18 15:44:28 +0000 | |
---|---|---|
committer | 2016-03-21 09:33:23 +0000 | |
commit | a9b88ae448644137c0b15d83e117b84072a80d2f (patch) | |
tree | 29ef454c0f94fdb5ce5e238113a489003c49f7e7 /src/main/java/com/google/devtools/build/lib/rules | |
parent | f0cc5b838b851d3f2872492ce5e1441738c29105 (diff) |
RELNOTES: Bazel warns if a cc rule's includes attribute contains up-level references that escape its package.
--
MOS_MIGRATED_REVID=117550535
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java | 12 |
1 files changed, 12 insertions, 0 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 b4ded0ef29..851aaf25a9 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,6 +408,18 @@ public final class CcCommon { ruleContext.attributeError("includes", "Path references a path above the execution root."); } + if (!includesPath.startsWith(packageFragment)) { + ruleContext.attributeWarning( + "includes", + "'" + + includesAttr + + "' resolves to '" + + includesPath + + "' not below the relative path of its package '" + + packageFragment + + "'. This will be an error in the future"); + // TODO(janakr): Add a link to a page explaining the problem and fixes? + } result.add(includesPath); result.add(ruleContext.getConfiguration().getGenfilesFragment().getRelative(includesPath)); } |