Build: Use fake ideaHome for tests with intellij build number only
#KTI-82
This commit is contained in:
committed by
teamcity
parent
516e54a434
commit
944c7990a1
@@ -74,14 +74,17 @@ tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
|
||||
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
|
||||
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
|
||||
this as JavaExec
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
systemProperty("idea.home.path", ideaHomePathForTests().canonicalPath)
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("runBenchmark") {
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
|
||||
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
|
||||
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
|
||||
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
|
||||
val ideaHome = intellijRootDir().canonicalPath
|
||||
val ideaHome = ideaHomePathForTests().canonicalPath
|
||||
|
||||
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
|
||||
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
|
||||
|
||||
@@ -627,6 +627,13 @@ val syncMutedTests = tasks.register("syncMutedTests") {
|
||||
dependsOn(":compiler:tests-mutes:tc-integration:run")
|
||||
}
|
||||
|
||||
tasks.register("createIdeaHomeForTests") {
|
||||
outputs.file(ideaBuildNumberFileForTests())
|
||||
doFirst {
|
||||
writeIdeaBuildNumberForTests()
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<Delete>("clean") {
|
||||
delete += setOf("$buildDir/repo", distDir)
|
||||
|
||||
@@ -113,4 +113,11 @@ object IntellijRootUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
|
||||
fun Project.ideaHomePathForTests() = rootProject.buildDir.resolve("ideaHomeForTests")
|
||||
|
||||
fun Project.ideaBuildNumberFileForTests() = File(ideaHomePathForTests(), "build.txt")
|
||||
|
||||
fun Project.writeIdeaBuildNumberForTests() {
|
||||
ideaHomePathForTests().mkdirs()
|
||||
ideaBuildNumberFileForTests().writeText("IC-${rootProject.extra["versions.intellijSdk"]}")
|
||||
}
|
||||
@@ -110,6 +110,8 @@ fun Project.projectTest(
|
||||
evaluationDependsOn(":test-instrumenter")
|
||||
}
|
||||
return getOrCreateTask<Test>(taskName) {
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
|
||||
doFirst {
|
||||
if (jUnitMode == JUnitMode.JUnit5) return@doFirst
|
||||
|
||||
@@ -177,7 +179,7 @@ fun Project.projectTest(
|
||||
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
|
||||
systemProperty("idea.home.path", project.ideaHomePathForTests().canonicalPath)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
|
||||
|
||||
@@ -108,7 +108,9 @@ val jmhCompile by tasks.registering(JavaCompile::class) {
|
||||
}
|
||||
|
||||
val jmhExec by tasks.registering(JavaExec::class) {
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
dependsOn(tasks["compileTestJava"])
|
||||
|
||||
doFirst {
|
||||
classpath = files(
|
||||
tasks["compactClasspath"].outputs.files.singleFile.absolutePath,
|
||||
@@ -120,7 +122,7 @@ val jmhExec by tasks.registering(JavaExec::class) {
|
||||
main = "org.openjdk.jmh.Main"
|
||||
|
||||
workingDir = rootDir
|
||||
systemProperty("idea.home.path", project.intellijRootDir().absolutePath)
|
||||
systemProperty("idea.home.path", project.ideaHomePathForTests().absolutePath)
|
||||
systemProperty("idea.max.intellisense.filesize", 5000 * 1024)
|
||||
configurations.plusAssign(project.configurations["api"])
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ projectTest(parallel = true) {
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJava8TestsKt")
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.ideaExt.*
|
||||
val ideaPluginDir: File by extra
|
||||
val ideaSandboxDir: File by extra
|
||||
val ideaSdkPath: String
|
||||
get() = IntellijRootUtils.getIntellijRootDir(rootProject).absolutePath
|
||||
get() = rootProject.ideaHomePathForTests().absolutePath
|
||||
|
||||
fun JUnit.configureForKotlin(xmx: String = "1600m") {
|
||||
vmParameters = listOf(
|
||||
@@ -135,6 +135,8 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
|
||||
rootProject.afterEvaluate {
|
||||
|
||||
writeIdeaBuildNumberForTests()
|
||||
|
||||
setupFirRunConfiguration()
|
||||
setupGenerateAllTestsRunConfiguration()
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.ideaExt.*
|
||||
val ideaPluginDir: File by extra
|
||||
val ideaSandboxDir: File by extra
|
||||
val ideaSdkPath: String
|
||||
get() = IntellijRootUtils.getIntellijRootDir(rootProject).absolutePath
|
||||
get() = rootProject.ideaHomePathForTests().absolutePath
|
||||
|
||||
fun MutableList<String>.addModularizedTestArgs(prefix: String, path: String, additionalParameters: Map<String, String>, benchFilter: String?) {
|
||||
add("-${prefix}fir.bench.prefix=$path")
|
||||
|
||||
@@ -62,15 +62,14 @@ projectTest {
|
||||
workingDir = rootDir
|
||||
useAndroidJar()
|
||||
|
||||
val androidPluginPath = File(intellijRootDir(), "plugins/android/lib").canonicalPath
|
||||
systemProperty("ideaSdk.androidPlugin.path", androidPluginPath)
|
||||
|
||||
val androidExtensionsRuntimeProvider = project.provider {
|
||||
androidExtensionsRuntimeForTests.asPath
|
||||
}
|
||||
|
||||
val robolectricClasspathProvider = project.provider {
|
||||
robolectricClasspath.asPath
|
||||
}
|
||||
|
||||
doFirst {
|
||||
systemProperty("androidExtensionsRuntime.classpath", androidExtensionsRuntimeProvider.get())
|
||||
systemProperty("robolectric.classpath", robolectricClasspathProvider.get())
|
||||
|
||||
@@ -106,9 +106,6 @@ projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
workingDir = rootDir
|
||||
useAndroidJar()
|
||||
|
||||
val androidPluginPath = File(intellijRootDir(), "plugins/android/lib").canonicalPath
|
||||
systemProperty("ideaSdk.androidPlugin.path", androidPluginPath)
|
||||
|
||||
val parcelizeRuntimeForTestsProvider = project.provider { parcelizeRuntimeForTests.asPath }
|
||||
val robolectricClasspathProvider = project.provider { robolectricClasspath.asPath }
|
||||
doFirst {
|
||||
|
||||
Reference in New Issue
Block a user