Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class JavaBasePluginTest extends AbstractProjectBuilderSpec {
when:
project.pluginManager.apply(JavaBasePlugin)
project.sourceSets.create('custom')
project.sourceSets.custom.java.outputDir = classesDir
project.sourceSets.custom.java.destinationDirectory.set(classesDir)
project.sourceSets.custom.output.resourcesDir = resourcesDir

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ abstract class TestLauncherSpec extends ToolingApiSpecification implements WithO
settingsFile << "rootProject.name = 'testproject'\n"
buildFile.text = simpleJavaProject()

def classesDir = 'file("build/classes/moreTests")'
buildFile << """
sourceSets {
moreTests {
java.srcDir "src/test"
${separateClassesDirs(targetVersion) ? "java.outputDir" : "output.classesDir"} = file("build/classes/moreTests")
${destinationDirectoryCode(classesDir)}
compileClasspath = compileClasspath + sourceSets.test.compileClasspath
runtimeClasspath = runtimeClasspath + sourceSets.test.runtimeClasspath
}
Expand Down Expand Up @@ -226,6 +227,17 @@ abstract class TestLauncherSpec extends ToolingApiSpecification implements WithO
version.baseVersion >= GradleVersion.version("4.0")
}

String destinationDirectoryCode(String destinationDirectory) {
//${separateClassesDirs(targetVersion) ? "java.outputDir" : "output.classesDir"} = file("build/classes/moreTests")
if (!separateClassesDirs(targetVersion)) {
return "output.classesDir = $destinationDirectory"
}
if (targetVersion.baseVersion < GradleVersion.version("6.1")) {
return "java.outputDir = $destinationDirectory"
}
return "java.destinationDirectory.set($destinationDirectory)"
}

def changeTestSource() {
// adding two more test methods
file("src/test/java/example/MyTest.java").text = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,12 @@ class TestLauncherCrossVersionSpec extends TestLauncherSpec {
settingsFile << "rootProject.name = 'testproject'\n"
buildFile.text = simpleJavaProject()

def classesDir = 'file("build/classes/moreTests")'
buildFile << """
sourceSets {
moreTests {
java.srcDir "src/test"
${separateClassesDirs(targetVersion) ? "java.outputDir" : "output.classesDir"} = file("build/classes/moreTests")
${destinationDirectoryCode(classesDir)}
compileClasspath = compileClasspath + sourceSets.test.compileClasspath
runtimeClasspath = runtimeClasspath + sourceSets.test.runtimeClasspath
}
Expand Down