[Build] Fix configuration cache issues (part 1)
* Make `clean` task compatible with configuration cache * Make Java compile instrumentation compatible with configuration cache * Make settings.gradle compatible with configuration cache * Initial work on making IntelliJInstrumentCodeTask compatible with configuration cache * Make writeStdlibVersion task compatible with configuration cache * Copy some properties to not capture it's owning object into lambda to support configuration cache Relates to #KT-44611
This commit is contained in:
@@ -24,42 +24,8 @@ fun Project.configureJavaInstrumentation() {
|
||||
includeJars("javac2", "jdom", "asm-all", rootProject = rootProject)
|
||||
}
|
||||
}
|
||||
|
||||
listOf(mainSourceSet, testSourceSet).forEach { sourceSet ->
|
||||
tasks.named<JavaCompile>(sourceSet.compileJavaTaskName) javaCompile@ {
|
||||
doLast {
|
||||
instrumentClasses(javaInstrumentator.asPath, this@javaCompile, sourceSet)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun instrumentClasses(
|
||||
instrumentatorClasspath: String,
|
||||
javaCompile: JavaCompile,
|
||||
sourceSet: SourceSet
|
||||
) {
|
||||
javaCompile.ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to instrumentatorClasspath,
|
||||
"loaderref" to "java2.loader",
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
}
|
||||
|
||||
val javaSourceDirectories = sourceSet.allJava.sourceDirectories.filter { it.exists() }
|
||||
|
||||
javaCompile.ant.withGroovyBuilder {
|
||||
javaSourceDirectories.forEach { directory ->
|
||||
"instrumentIdeaExtensions"(
|
||||
"srcdir" to directory,
|
||||
"destdir" to javaCompile.destinationDir,
|
||||
"classpath" to javaCompile.classpath.asPath,
|
||||
"includeantruntime" to false,
|
||||
"instrumentNotNull" to true
|
||||
)
|
||||
for (sourceSet in listOf(mainSourceSet, testSourceSet)) {
|
||||
tasks.named(sourceSet.compileJavaTaskName, InstrumentJava(javaInstrumentator, sourceSet))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user