| 1 |
import org.gradle.configurationcache.extensions.capitalized |
| 2 |
|
| 3 |
plugins { |
| 4 |
id("junitbuild.java-library-conventions") |
| 5 |
} |
| 6 |
|
| 7 |
val mavenizedProjects: List<Project> by rootProject.extra |
| 8 |
|
| 9 |
listOf(9, 17).forEach { javaVersion -> |
| 10 |
val sourceSet = sourceSets.register("mainRelease${javaVersion}") { |
| 11 |
compileClasspath += sourceSets.main.get().output |
| 12 |
runtimeClasspath += sourceSets.main.get().output |
| 13 |
java { |
| 14 |
setSrcDirs(setOf("src/main/java${javaVersion}")) |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
configurations.named(sourceSet.get().compileClasspathConfigurationName).configure { |
| 19 |
extendsFrom(configurations.compileClasspath.get()) |
| 20 |
} |
| 21 |
|
| 22 |
tasks { |
| 23 |
|
| 24 |
named("allMainClasses").configure { |
| 25 |
dependsOn(sourceSet.get().classesTaskName) |
| 26 |
} |
| 27 |
|
| 28 |
named<JavaCompile>(sourceSet.get().compileJavaTaskName).configure { |
| 29 |
options.release = javaVersion |
| 30 |
} |
| 31 |
|
| 32 |
named<Checkstyle>("checkstyle${sourceSet.name.capitalized()}").configure { |
| 33 |
config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleMain.xml")) |
| 34 |
} |
| 35 |
|
| 36 |
if (project in mavenizedProjects) { |
| 37 |
javadoc { |
| 38 |
source(sourceSet.get().allJava) |
| 39 |
} |
| 40 |
named<Jar>("sourcesJar").configure { |
| 41 |
from(sourceSet.get().allSource) |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
} |