Skip to content

Commit f8037e7

Browse files
committed
Clean up code-generator plugin
1 parent a797fd8 commit f8037e7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

gradle/plugins/code-generator/src/main/kotlin/junitbuild.code-generator.gradle.kts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ plugins {
55
java
66
}
77

8-
val templates by sourceSets.registering
8+
val templates by sourceSets.creating
9+
val templatesCompileOnly = configurations[templates.compileOnlyConfigurationName]
10+
911
dependencies {
10-
add(templates.get().compileOnlyConfigurationName, dependencyFromLibs("jte"))
11-
add(templates.get().compileOnlyConfigurationName, "junitbuild.base:code-generator-model")
12+
templatesCompileOnly(dependencyFromLibs("jte"))
13+
templatesCompileOnly("junitbuild.base:code-generator-model")
1214
}
1315

1416
val license: License by rootProject.extra
@@ -18,17 +20,16 @@ val generateCode by tasks.registering
1820
sourceSets.named { it != templates.name }.configureEach {
1921

2022
val sourceSetName = name
21-
val sourceSetTargetDir = rootTargetDir.map { it.dir(sourceSetName) }
2223

2324
val task = tasks.register(getTaskName("generateJreRelated", "SourceCode"), GenerateJreRelatedSourceCode::class) {
24-
templateDir.convention(layout.dir(templates.map {
25-
it.resources.srcDirs.single().resolve(sourceSetName)
25+
templateDir.convention(layout.dir(provider {
26+
templates.resources.srcDirs.single().resolve(sourceSetName)
2627
}))
27-
targetDir.convention(sourceSetTargetDir)
28+
targetDir.convention(rootTargetDir.map { it.dir(sourceSetName) })
2829
licenseHeaderFile.convention(license.headerFile)
2930
}
3031

31-
java.srcDir(files(sourceSetTargetDir).builtBy(task))
32+
java.srcDir(task.map { it.targetDir })
3233

3334
generateCode {
3435
dependsOn(task)

0 commit comments

Comments
 (0)