aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-10-04 18:58:18 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-10-05 12:26:01 +0000
commitc2bcf1cd7bfb7ad70baf87eb943964657b9c6f4a (patch)
tree89159fce36b87eb0ccfedf8fd8886b2466391bdb /src/main/java/com/google/devtools
parent7479f67eaf56ab99cb0a5f39b93a89df1bd4f028 (diff)
Make .d file analysis properly mark used module (.pcm) files.
Previously, we thought this wouldn't be necessary, as a change in .pcm would always be accompanied by a corresponding change in a header. However, in the current compile module this isn't true. Modules currently require all transitive modules as inputs even though they might not use a single header from them. Thus, if a module //a depends on a module //b, any change to //b's headers will currently require //a to be rebuilt unless those headers are actually included by //a. This leads to false positive cache results. -- MOS_MIGRATED_REVID=135134348
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index 373574fe24..1d06026c93 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -813,8 +813,10 @@ public class CppCompileAction extends AbstractAction
Set<PathFragment> declaredIncludeDirs = Sets.newHashSet(context.getDeclaredIncludeDirs());
Set<PathFragment> warnIncludeDirs = Sets.newHashSet(context.getDeclaredIncludeWarnDirs());
Set<Artifact> declaredIncludeSrcs = Sets.newHashSet(getDeclaredIncludeSrcs());
+ Set<Artifact> transitiveModules = Sets.newHashSet(context.getTransitiveModules(usePic));
for (Artifact input : inputsForValidation) {
if (context.getTransitiveCompilationPrerequisites().contains(input)
+ || transitiveModules.contains(input)
|| allowedIncludes.contains(input)) {
continue; // ignore our fixed source in mandatoryInput: we just want includes
}
@@ -1014,6 +1016,7 @@ public class CppCompileAction extends AbstractAction
addToMap(allowedDerivedInputMap, mandatoryInputs);
addToMap(allowedDerivedInputMap, getDeclaredIncludeSrcs());
addToMap(allowedDerivedInputMap, context.getTransitiveCompilationPrerequisites());
+ addToMap(allowedDerivedInputMap, context.getTransitiveModules(usePic));
Artifact artifact = getSourceFile();
if (!artifact.isSourceArtifact()) {
allowedDerivedInputMap.put(artifact.getExecPath(), artifact);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
index e80856b7c2..5b59a0601f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
@@ -103,10 +103,6 @@ public class HeaderDiscovery {
// Check inclusions.
IncludeProblems problems = new IncludeProblems();
for (Path execPath : depSet.getDependencies()) {
- // Module .pcm files are generated and thus aren't declared inputs.
- if (execPath.getBaseName().endsWith(".pcm")) {
- continue;
- }
PathFragment execPathFragment = execPath.asFragment();
if (execPathFragment.isAbsolute()) {
// Absolute includes from system paths are ignored.