[repo] Migrate javaInstrumentation.gradle.kts into convention plugin

Otherwise, it could not find methods from buildsrc-compat.
This commit is contained in:
Yahor Berdnikau
2023-06-23 20:00:06 +02:00
committed by Space Team
parent d686cb1365
commit 8018b5f63b
2 changed files with 1 additions and 1 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
allprojects {
afterEvaluate {
configureJavaInstrumentation()
}
}
// Hide window of instrumentation tasks
val headlessOldValue: String? = System.setProperty("java.awt.headless", "true")
logger.info("Setting java.awt.headless=true, old value was $headlessOldValue")
/**
* Configures instrumentation for all JavaCompile tasks in project
*/
fun Project.configureJavaInstrumentation() {
if (plugins.hasPlugin("org.gradle.java")) {
val javaInstrumentator by configurations.creating
dependencies {
javaInstrumentator("com.jetbrains.intellij.java:java-compiler-ant-tasks:${rootProject.extra["versions.intellijSdk"]}")
}
for (sourceSet in listOf(mainSourceSet, testSourceSet)) {
tasks.named(sourceSet.compileJavaTaskName, InstrumentJava(javaInstrumentator))
}
}
}