@@ -5,10 +5,12 @@ plugins {
5
5
java
6
6
}
7
7
8
- val templates by sourceSets.registering
8
+ val templates by sourceSets.creating
9
+ val templatesCompileOnly = configurations[templates.compileOnlyConfigurationName]
10
+
9
11
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" )
12
14
}
13
15
14
16
val license: License by rootProject.extra
@@ -18,17 +20,16 @@ val generateCode by tasks.registering
18
20
sourceSets.named { it != templates.name }.configureEach {
19
21
20
22
val sourceSetName = name
21
- val sourceSetTargetDir = rootTargetDir.map { it.dir(sourceSetName) }
22
23
23
24
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)
26
27
}))
27
- targetDir.convention(sourceSetTargetDir )
28
+ targetDir.convention(rootTargetDir.map { it.dir(sourceSetName) } )
28
29
licenseHeaderFile.convention(license.headerFile)
29
30
}
30
31
31
- java.srcDir(files(sourceSetTargetDir).builtBy( task) )
32
+ java.srcDir(task.map { it.targetDir } )
32
33
33
34
generateCode {
34
35
dependsOn(task)
0 commit comments