From a9b88ae448644137c0b15d83e117b84072a80d2f Mon Sep 17 00:00:00 2001 From: Janak Ramakrishnan Date: Fri, 18 Mar 2016 15:44:28 +0000 Subject: RELNOTES: Bazel warns if a cc rule's includes attribute contains up-level references that escape its package. -- MOS_MIGRATED_REVID=117550535 --- .../com/google/devtools/build/lib/rules/cpp/CcCommon.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/com') 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)); } -- cgit v1.2.3