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