Skip to content

Commit

Permalink
build: Handle test folders as task inputs
Browse files Browse the repository at this point in the history
The test folders are not jar task inputs. But they are test task inputs
except for content created by the test execution. We exclude that by
excluding empty folders and git ignored content.

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
  • Loading branch information
bjhargrave committed May 4, 2016
1 parent b1a0d7b commit 3bf874d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,29 @@ subprojects {
if (JavaVersion.current().isJava8Compatible()) {
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
}
/* test folders are not part of jar but used by unit tests */
def testfolders = ['testresources/', 'testdata/']
jar {
projectDirInputsExcludes << '.*'
projectDirInputsExcludes += testfolders
}
test {
testLogging {
exceptionFormat 'full'
}
inputs.files fileTree(projectDir) {
include 'testresources/**'
include 'testdata/**'
include testfolders
exclude {
def f = it.file
if (f.directory && f.list().length == 0) {
return true
}
try {
return "git check-ignore ${f}".execute().waitFor() == 0
} catch (Exception e) {
return false
}
}
}
}
}
Expand Down

0 comments on commit 3bf874d

Please sign in to comment.