JPS build: add JUnit run configuration and defaults
#KT-29335 Fixed #KT-29211 Fixed
This commit is contained in:
+91
-3
@@ -811,12 +811,36 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply(mapOf("plugin" to "idea"))
|
||||
val ideaSdkPath: String
|
||||
get() = IntellijRootUtils.getIntellijRootDir(rootProject).absolutePath
|
||||
|
||||
// todo: use buildsrc/tasks.kt
|
||||
fun org.jetbrains.gradle.ext.JUnit.configureForKotlin() {
|
||||
vmParameters = listOf(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-Xmx1600m",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=128m",
|
||||
"-Djna.nosys=true",
|
||||
"-Didea.is.unit.test=true",
|
||||
"-Didea.home.path=$ideaSdkPath",
|
||||
"-Djps.kotlin.home=$ideaPluginDir",
|
||||
"-Dkotlin.ni=" + if (rootProject.hasProperty("newInferenceTests")) "true" else "false"
|
||||
).joinToString(" ")
|
||||
envs = mapOf(
|
||||
"NO_FS_ROOTS_ACCESS_CHECK" to "true",
|
||||
"PROJECT_CLASSES_DIRS" to "out/test/org.jetbrains.kotlin.compiler.test"
|
||||
)
|
||||
workingDirectory = rootDir.toString()
|
||||
}
|
||||
|
||||
val isJpsBuildEnabled = findProperty("jpsBuild")?.toString() == "true"
|
||||
if (isJpsBuildEnabled) {
|
||||
if (isJpsBuildEnabled && System.getProperty("idea.active") != null) {
|
||||
allprojects {
|
||||
apply(mapOf("plugin" to "idea"))
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
allprojects {
|
||||
idea {
|
||||
@@ -839,6 +863,70 @@ if (isJpsBuildEnabled) {
|
||||
delegateBuildRunToGradle = false
|
||||
testRunner = PLATFORM
|
||||
}
|
||||
|
||||
runConfigurations {
|
||||
application("[JPS] IDEA") {
|
||||
// todo: use buildsrc/intellijDependencies.kt
|
||||
moduleName = "org.jetbrains.kotlin.idea-runner.main"
|
||||
workingDirectory = File(intellijRootDir(), "bin").toString()
|
||||
mainClass = "com.intellij.idea.Main"
|
||||
jvmArgs = listOf(
|
||||
"-Xmx1250m",
|
||||
"-XX:ReservedCodeCacheSize=240m",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-ea",
|
||||
"-Didea.is.internal=true",
|
||||
"-Didea.debug.mode=true",
|
||||
"-Didea.system.path=$ideaSandboxDir",
|
||||
"-Didea.config.path=$ideaSandboxDir/config",
|
||||
"-Dapple.laf.useScreenMenuBar=true",
|
||||
"-Dapple.awt.graphics.UseQuartz=true",
|
||||
"-Dsun.io.useCanonCaches=false",
|
||||
"-Dplugin.path=${ideaPluginDir}"
|
||||
).joinToString(" ")
|
||||
}
|
||||
|
||||
application("[JPS] Generate All Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.generate-all-tests.test"
|
||||
workingDirectory = rootDir.toString()
|
||||
mainClass = "org.jetbrains.kotlin.pill.generateAllTests.Main"
|
||||
}
|
||||
|
||||
defaults<org.jetbrains.gradle.ext.JUnit> {
|
||||
configureForKotlin()
|
||||
}
|
||||
|
||||
// todo: replace `pattern` with `package`, when `com.intellij.execution.junit.JUnitRunConfigurationImporter#process` will be fixed
|
||||
junit("[JPS] All IDEA Plugin Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.idea.test"
|
||||
pattern = "org.jetbrains.kotlin.*"
|
||||
configureForKotlin()
|
||||
}
|
||||
|
||||
junit("[JPS] Compiler Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.compiler.test"
|
||||
pattern = "org.jetbrains.kotlin.*"
|
||||
configureForKotlin()
|
||||
}
|
||||
|
||||
junit("[JPS] JVM Backend Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.idea.test"
|
||||
pattern = "org.jetbrains.kotlin.codegen.*"
|
||||
configureForKotlin()
|
||||
}
|
||||
|
||||
junit("[JPS] JS Backend Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.js.tests.test"
|
||||
pattern = "org.jetbrains.kotlin.js.test.*"
|
||||
configureForKotlin()
|
||||
}
|
||||
|
||||
junit("[JPS] Java 8 Tests") {
|
||||
moduleName = "org.jetbrains.kotlin.tests-java8.test"
|
||||
pattern = "org.jetbrains.kotlin.*"
|
||||
configureForKotlin()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
import org.gradle.api.plugins.ExtensionAware
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.plugins.ide.idea.model.IdeaProject
|
||||
import org.jetbrains.gradle.ext.*
|
||||
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun org.gradle.plugins.ide.idea.model.IdeaProject.settings(block: org.jetbrains.gradle.ext.ProjectSettings.() -> Unit) =
|
||||
fun IdeaProject.settings(block: ProjectSettings.() -> Unit) =
|
||||
(this@settings as ExtensionAware).extensions.configure(block)
|
||||
|
||||
fun org.jetbrains.gradle.ext.ProjectSettings.compiler(block: org.jetbrains.gradle.ext.IdeaCompilerConfiguration.() -> Unit) =
|
||||
fun ProjectSettings.compiler(block: IdeaCompilerConfiguration.() -> Unit) =
|
||||
(this@compiler as ExtensionAware).extensions.configure(block)
|
||||
|
||||
fun org.jetbrains.gradle.ext.ProjectSettings.delegateActions(block: org.jetbrains.gradle.ext.ActionDelegationConfig.() -> Unit) =
|
||||
fun ProjectSettings.delegateActions(block: ActionDelegationConfig.() -> Unit) =
|
||||
(this@delegateActions as ExtensionAware).extensions.configure(block)
|
||||
|
||||
fun org.jetbrains.gradle.ext.ProjectSettings.runConfigurations(block: org.jetbrains.gradle.ext.DefaultRunConfigurationContainer.() -> Unit) =
|
||||
(this@runConfigurations as ExtensionAware).extensions.configure(block)
|
||||
fun ProjectSettings.runConfigurations(block: DefaultRunConfigurationContainer.() -> Unit) =
|
||||
(this@runConfigurations as ExtensionAware).extensions.configure("runConfigurations", block)
|
||||
|
||||
inline fun <reified T: org.jetbrains.gradle.ext.RunConfiguration> org.jetbrains.gradle.ext.DefaultRunConfigurationContainer.defaults(noinline block: T.() -> Unit) =
|
||||
inline fun <reified T: RunConfiguration> DefaultRunConfigurationContainer.defaults(noinline block: T.() -> Unit) =
|
||||
defaults(T::class.java, block)
|
||||
|
||||
fun org.jetbrains.gradle.ext.DefaultRunConfigurationContainer.junit(name: String, block: org.jetbrains.gradle.ext.JUnit.() -> Unit) =
|
||||
create(name, org.jetbrains.gradle.ext.JUnit::class.java, block)
|
||||
|
||||
fun org.jetbrains.gradle.ext.DefaultRunConfigurationContainer.application(name: String, block: org.jetbrains.gradle.ext.Application.() -> Unit) =
|
||||
create(name, org.jetbrains.gradle.ext.Application::class.java, block)
|
||||
fun DefaultRunConfigurationContainer.junit(name: String, block: JUnit.() -> Unit) =
|
||||
create(name, JUnit::class.java, block)
|
||||
|
||||
fun DefaultRunConfigurationContainer.application(name: String, block: Application.() -> Unit) =
|
||||
create(name, Application::class.java, block)
|
||||
|
||||
Reference in New Issue
Block a user