Stop double null instrumentation for modules with several source roots
KTI-754 For instrumentation only destination directory is relevant. So each execution did own instrumentation, and there no internal mechanism for preventing re-instrumentation included. Replace InstrumentIdeaExtensions with Javac2 because areJavaClassesCompiled=true in the base class. https://github.com/JetBrains/intellij-community/blob/9c40bdd/java/compiler/javac2/src/com/intellij/ant/InstrumentIdeaExtensions.java https://github.com/JetBrains/intellij-community/blob/9c40bdd/java/compiler/javac2/src/com/intellij/ant/Javac2.java
This commit is contained in:
committed by
TeamCityServer
parent
59173baf5a
commit
22b5d86656
@@ -24,21 +24,20 @@ class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transien
|
|||||||
override fun execute(task: Task) {
|
override fun execute(task: Task) {
|
||||||
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
|
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
|
||||||
task.doLast {
|
task.doLast {
|
||||||
task.ant.withGroovyBuilder {
|
val anySrcDir = srcDirs.filter { it.exists() }.firstOrNull()
|
||||||
"taskdef"(
|
if (anySrcDir != null) {
|
||||||
"name" to "instrumentIdeaExtensions",
|
task.ant.withGroovyBuilder {
|
||||||
"classpath" to instrumentatorClasspath,
|
"taskdef"(
|
||||||
"loaderref" to "java2.loader",
|
"name" to "instrumentIdeaExtensions",
|
||||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
"classpath" to instrumentatorClasspath,
|
||||||
)
|
"loaderref" to "java2.loader",
|
||||||
}
|
"classname" to "com.intellij.ant.Javac2"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val javaSourceDirectories = srcDirs.filter { it.exists() }
|
task.ant.withGroovyBuilder {
|
||||||
|
|
||||||
task.ant.withGroovyBuilder {
|
|
||||||
javaSourceDirectories.forEach { directory ->
|
|
||||||
"instrumentIdeaExtensions"(
|
"instrumentIdeaExtensions"(
|
||||||
"srcdir" to directory,
|
"srcdir" to anySrcDir, // No code should actually be compiled because of areJavaClassesCompiled==true in Javac2 - so any src folder will do.
|
||||||
"destdir" to task.destinationDirectory.asFile.get(),
|
"destdir" to task.destinationDirectory.asFile.get(),
|
||||||
"classpath" to task.classpath.asPath,
|
"classpath" to task.classpath.asPath,
|
||||||
"includeantruntime" to false,
|
"includeantruntime" to false,
|
||||||
|
|||||||
Reference in New Issue
Block a user