Skip to content

Commit

Permalink
Ignore missing source roots for incremental compilation
Browse files Browse the repository at this point in the history
Fixes #8194
  • Loading branch information
wolfs committed Jan 9, 2019
1 parent 7bd366f commit 0278359
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Expand Up @@ -569,6 +569,25 @@ sourceSets {
output.contains("Full recompilation is required because the source roots could not be inferred.")
}

def "missing files are ignored of source roots"() {
buildFile << "compileJava.source([file('extra-java'), file('other'), fileTree('missing-tree'), file('missing-file')])"

java("class A extends B {}")
file("extra-java/B.java") << "class B {}"
file("extra-java/C.java") << "class C {}"

outputs.snapshot { run "compileJava" }

when:
file("extra-java/B.java").text = "class B { String change; }"
executer.withArgument "--info"
run "compileJava"

then:
outputs.recompiledClasses("A", "B")
!output.contains("Full recompilation is required because the source roots could not be inferred.")
}

def "handles duplicate class across source directories"() {
//compiler does not allow this scenario, documenting it here
buildFile << "sourceSets.main.java.srcDir 'java'"
Expand Down
Expand Up @@ -78,10 +78,12 @@ public void visitGenericFileTree(FileTreeInternal fileTree) {

@Override
public void visitFileTree(File root, PatternSet patterns) {
if (root.isDirectory()) {
sourceRoots.add(root);
} else {
cannotInferSourceRoots("file '" + root + "'");
if (root.exists()) {
if (root.isDirectory()) {
sourceRoots.add(root);
} else {
cannotInferSourceRoots("file '" + root + "'");
}
}
}

Expand Down

0 comments on commit 0278359

Please sign in to comment.