JPS build: move idea configuration to separate script
This commit is contained in:
+1
-128
@@ -6,8 +6,6 @@ import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import proguard.gradle.ProGuardTask
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.buildUtils.idea.*
|
||||
import org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.*
|
||||
|
||||
buildscript {
|
||||
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
|
||||
@@ -80,7 +78,6 @@ val appcodeKotlinPlugin by configurations.creating
|
||||
val clionKotlinPlugin by configurations.creating
|
||||
|
||||
val includeCidr by extra(project.getBooleanProperty("cidrPluginsEnabled") ?: false)
|
||||
val isJpsBuildEnabled = findProperty("jpsBuild")?.toString() == "true"
|
||||
val jpsBootstrap by configurations.creating
|
||||
|
||||
dependencies {
|
||||
@@ -151,6 +148,7 @@ rootProject.apply {
|
||||
from(rootProject.file("gradle/versions.gradle.kts"))
|
||||
from(rootProject.file("gradle/report.gradle.kts"))
|
||||
from(rootProject.file("gradle/javaInstrumentation.gradle.kts"))
|
||||
from(rootProject.file("gradle/jps.gradle.kts"))
|
||||
}
|
||||
|
||||
IdeVersionConfigurator.setCurrentIde(this)
|
||||
@@ -811,129 +809,4 @@ allprojects {
|
||||
repositories.redirect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
if (isJpsBuildEnabled && System.getProperty("idea.active") != null) {
|
||||
allprojects {
|
||||
apply(mapOf("plugin" to "idea"))
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
allprojects {
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.idea {
|
||||
project {
|
||||
settings {
|
||||
ideArtifacts {
|
||||
generateIdeArtifacts(rootProject, this@ideArtifacts)
|
||||
}
|
||||
|
||||
compiler {
|
||||
processHeapSize = 2000
|
||||
addNotNullAssertions = true
|
||||
parallelCompilation = true
|
||||
}
|
||||
|
||||
delegateActions {
|
||||
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,3 +1,6 @@
|
||||
@file:Suppress("PackageDirectoryMismatch")
|
||||
package org.jetbrains.kotlin.ideaExt
|
||||
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.plugins.ExtensionAware
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
@@ -9,6 +12,9 @@ import org.jetbrains.gradle.ext.*
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun org.gradle.api.Project.idea(configure: org.gradle.plugins.ide.idea.model.IdeaModel.() -> Unit): Unit =
|
||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("idea", configure)
|
||||
|
||||
fun IdeaProject.settings(block: ProjectSettings.() -> Unit) =
|
||||
(this@settings as ExtensionAware).extensions.configure(block)
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
import org.jetbrains.gradle.ext.*
|
||||
import org.jetbrains.kotlin.ideaExt.*
|
||||
import org.jetbrains.kotlin.buildUtils.idea.*
|
||||
|
||||
val isJpsBuildEnabled = findProperty("jpsBuild")?.toString() == "true"
|
||||
val ideaPluginDir: File by extra
|
||||
val ideaSandboxDir: File by extra
|
||||
val ideaSdkPath: String
|
||||
get() = IntellijRootUtils.getIntellijRootDir(rootProject).absolutePath
|
||||
|
||||
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.absolutePath}",
|
||||
"-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()
|
||||
}
|
||||
|
||||
if (isJpsBuildEnabled && System.getProperty("idea.active") != null) {
|
||||
allprojects {
|
||||
apply(mapOf("plugin" to "idea"))
|
||||
}
|
||||
|
||||
rootProject.afterEvaluate {
|
||||
allprojects {
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.idea {
|
||||
project {
|
||||
settings {
|
||||
ideArtifacts {
|
||||
generateIdeArtifacts(rootProject, this@ideArtifacts)
|
||||
}
|
||||
|
||||
compiler {
|
||||
processHeapSize = 2000
|
||||
addNotNullAssertions = true
|
||||
parallelCompilation = true
|
||||
}
|
||||
|
||||
delegateActions {
|
||||
delegateBuildRunToGradle = false
|
||||
testRunner = ActionDelegationConfig.TestRunner.PLATFORM
|
||||
}
|
||||
|
||||
runConfigurations {
|
||||
application("[JPS] IDEA") {
|
||||
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.absolutePath}",
|
||||
"-Didea.config.path=${ideaSandboxDir.absolutePath}/config",
|
||||
"-Dapple.laf.useScreenMenuBar=true",
|
||||
"-Dapple.awt.graphics.UseQuartz=true",
|
||||
"-Dsun.io.useCanonCaches=false",
|
||||
"-Dplugin.path=${ideaPluginDir.absolutePath}"
|
||||
).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,4 +1,4 @@
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.ideaExt.*
|
||||
import org.jetbrains.gradle.ext.TopLevelArtifact
|
||||
import java.util.regex.Pattern
|
||||
|
||||
|
||||
Reference in New Issue
Block a user