Skip to content

Commit

Permalink
Correctly set up the conformanceTests task.
Browse files Browse the repository at this point in the history
  • Loading branch information
netdpb committed Dec 7, 2023
1 parent daf2802 commit 7f41155
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,36 @@ tasks.register('jspecifySamplesTest', Test) {
inputs.files("${jspecify.projectDir}/samples")
}

TaskProvider<Test> conformanceTest(String name, String testDirectory, String reportFile) {
check.dependsOn(name)
return tasks.register(name, Test) {
group = 'verification'
include '**/ConformanceTest.class'
inputs.dir(testDirectory)
inputs.files(reportFile)
systemProperty("JSpecifyConformanceTest.sourceDirectory", testDirectory)
systemProperty("JSpecifyConformanceTest.report", reportFile)
}
}

tasks.register('unzipConformanceTestAssertions', Copy) {
dependsOn configurations.conformanceTestAssertions
from zipTree(configurations.conformanceTestAssertions.singleFile)
exclude 'META-INF/'
into "${buildDir}/conformanceTests"
}

conformanceTest('conformanceTest', "${buildDir}/conformanceTests/org/jspecify/conformance/tests", 'tests/ConformanceTest-report.txt').configure {
tasks.register('conformanceTests', Test) {
group = 'verification'
dependsOn 'unzipConformanceTestAssertions', configurations.conformanceTestDeps
include '**/ConformanceTest.class'

// Conformance tests
inputs.dir("${buildDir}/conformanceTests")
inputs.files("tests/ConformanceTest-report.txt")
inputs.files(configurations.conformanceTestDeps)
systemProperty("JSpecifyConformanceTest.testDeps", configurations.conformanceTestDeps.join(":"))
systemProperty("JSpecifyConformanceTest.inputs", "${buildDir}/conformanceTests/org/jspecify/conformance/tests")
systemProperty("JSpecifyConformanceTest.report", "tests/ConformanceTest-report.txt")
systemProperty("JSpecifyConformanceTest.deps", configurations.conformanceTestDeps.join(":"))

// Conformance tests run on the samples directory
inputs.dir("${jspecify.projectDir}/samples")
inputs.files("tests/ConformanceTestOnSamples-report.txt")
systemProperty("JSpecifyConformanceTest.samples.inputs", "${jspecify.projectDir}/samples")
systemProperty("JSpecifyConformanceTest.samples.report", "tests/ConformanceTestOnSamples-report.txt")
}

conformanceTest('conformanceTestOnSamples', "${jspecify.projectDir}/samples", 'tests/ConformanceTestOnSamples-report.txt')
tasks.named('check').configure {
dependsOn('conformanceTests')
}

clean.doFirst {
delete "${rootDir}/tests/build/"
Expand Down

0 comments on commit 7f41155

Please sign in to comment.