diff --git a/build.gradle.kts b/build.gradle.kts index afce18198a0..8b6bf23ef8f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -137,6 +137,20 @@ extra["versions.jflex"] = "1.7.0" val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin" extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])" +fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty("intellijUltimateEnabled")?.let { + val v = it.toString() + if (v.isBlank()) true + else v.toBoolean() +} + +val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") + ?: project.hasProperty("teamcity") + || System.getenv("TEAMCITY_VERSION") != null +val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false + +extra["intellijUltimateEnabled"] = intellijUltimateEnabled +extra["intellijSeparateSdks"] = intellijSeparateSdks + extra["IntellijCoreDependencies"] = listOf("annotations", "asm-all", diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index dbad2287e79..dfde645cdf1 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -31,7 +31,18 @@ plugins { `kotlin-dsl` } -extra["intellijUltimateEnabled"] = true +fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty("intellijUltimateEnabled")?.let { + val v = it.toString() + if (v.isBlank()) true + else v.toBoolean() +} + +val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") + ?: project.hasProperty("teamcity") + || System.getenv("TEAMCITY_VERSION") != null +val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false +extra["intellijUltimateEnabled"] = intellijUltimateEnabled +extra["intellijSeparateSdks"] = intellijSeparateSdks extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository" extra["intellijReleaseType"] = "releases" // or "snapshots" extra["versions.intellijSdk"] = "172.4343.14" diff --git a/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts b/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts index 8ef17369a3d..7ad80ef2972 100644 --- a/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts +++ b/buildSrc/prepare-deps/intellij-sdk/build.gradle.kts @@ -11,7 +11,9 @@ val intellijUltimateEnabled: Boolean by rootProject.extra val intellijRepo: String by rootProject.extra val intellijReleaseType: String by rootProject.extra val intellijVersion = rootProject.extra["versions.intellijSdk"] as String -val intellijFlavour = if (intellijUltimateEnabled) "ideaIU" else "ideaIC" +val intellijSeparateSdks: Boolean by rootProject.extra +val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks +val installIntellijUltimate = intellijUltimateEnabled repositories { maven { setUrl("$intellijRepo/$intellijReleaseType") } @@ -19,6 +21,7 @@ repositories { } val intellij by configurations.creating +val intellijUltimate by configurations.creating val sources by configurations.creating val `jps-standalone` by configurations.creating val `jps-build-test` by configurations.creating @@ -32,12 +35,19 @@ val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDe val repoDir = customDepsRepoModulesDir dependencies { - intellij("com.jetbrains.intellij.idea:$intellijFlavour:$intellijVersion") + if (installIntellijCommunity) { + intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion") + } + if (installIntellijUltimate) { + intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion") + } sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar") `jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion") `jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion") `intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion") - `plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip") + if (intellijUltimateEnabled) { + `plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip") + } } fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration, extractor: (Configuration) -> Any) { @@ -55,6 +65,8 @@ fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration, extr val unzipIntellijSdk by tasks.creating { configureExtractFromConfigurationTask(intellij) { zipTree(it.singleFile) } } +val unzipIntellijUltimateSdk by tasks.creating { configureExtractFromConfigurationTask(intellijUltimate) { zipTree(it.singleFile) } } + val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } } val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } } @@ -81,12 +93,23 @@ fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection, } } -val prepareIvyXml by tasks.creating { - dependsOn(unzipIntellijSdk, unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest) +val prepareIvyXmls by tasks.creating { + dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest) val intellijSdkDir = File(repoDir, intellij.name) - inputs.dir(intellijSdkDir) - outputs.file(File(repoDir, "${intellij.name}.ivy.xml")) + val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name) + + if (installIntellijCommunity) { + dependsOn(unzipIntellijSdk) + inputs.dir(intellijSdkDir) + outputs.file(File(repoDir, "${intellij.name}.ivy.xml")) + } + + if (installIntellijUltimate) { + dependsOn(unzipIntellijUltimateSdk) + inputs.dir(intellijUltimateSdkDir) + outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml")) + } val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`) flatDeps.forEach { @@ -103,12 +126,25 @@ val prepareIvyXml by tasks.creating { doFirst { val sourcesFile = File(repoDir, "${sources.name}/${sources.singleFile.name}") - writeIvyXml(intellij.name, intellij.name, - files("$intellijSdkDir/lib/").filter { !it.name.startsWith("kotlin-") }, - File(intellijSdkDir, "lib"), - sourcesFile) - File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach { - writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile) + + if (installIntellijCommunity) { + writeIvyXml(intellij.name, intellij.name, + files("$intellijSdkDir/lib/").filter { !it.name.startsWith("kotlin-") }, + File(intellijSdkDir, "lib"), + sourcesFile) + File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach { + writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile) + } + } + + if (installIntellijUltimate) { + writeIvyXml(intellij.name /* important! the module name should be "intellij" */ , intellijUltimate.name, + files("$intellijUltimateSdkDir/lib/").filter { !it.name.startsWith("kotlin-") }, + File(intellijUltimateSdkDir, "lib"), + sourcesFile) + File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach { + writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile) + } } flatDeps.forEach { @@ -123,7 +159,7 @@ val prepareIvyXml by tasks.creating { } val build by tasks.creating { - dependsOn(prepareIvyXml) + dependsOn(prepareIvyXmls) } val clean by tasks.creating(Delete::class) { diff --git a/buildSrc/src/main/kotlin/intellijDependencies.kt b/buildSrc/src/main/kotlin/intellijDependencies.kt index a46553ecd98..9c5ba34cc0b 100644 --- a/buildSrc/src/main/kotlin/intellijDependencies.kt +++ b/buildSrc/src/main/kotlin/intellijDependencies.kt @@ -1,5 +1,6 @@ @file:Suppress("unused") // usages in build scripts are not tracked properly +import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.api.artifacts.ModuleDependency import org.gradle.kotlin.dsl.extra @@ -11,9 +12,13 @@ private fun Project.intellijRepoDir() = File("${project.rootDir.absoluteFile}/bu fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = ivy { val baseDir = project.intellijRepoDir() setUrl(baseDir) + ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate.ivy.xml") ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module].ivy.xml") + ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate.plugin.[module].ivy.xml") ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij.plugin.[module].ivy.xml") + artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate/lib/[artifact](-[classifier]).jar") artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/lib/[artifact](-[classifier]).jar") + artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate/plugins/[module]/lib/[artifact](-[classifier]).jar") artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij/plugins/[module]/lib/[artifact](-[classifier]).jar") artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module]/[module]/lib/[artifact](-[classifier]).jar") artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact].jar") @@ -27,6 +32,10 @@ fun Project.intellijCoreDep() = intellijDep("intellij-core") fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin) +fun Project.intellijUltimateDep() = intellijDep("intellij") + +fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin) + fun ModuleDependency.includeJars(vararg names: String) { names.forEach { artifact { @@ -43,5 +52,16 @@ fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) = fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) = includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List).filter { jarsFilterPredicate(it) }.toTypedArray()) -fun Project.intellijRootDir() = File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellij") +fun Project.isIntellijCommunityAvailable() = !(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean + +fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean) + +fun Project.intellijRootDir() = + File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellij${if (isIntellijCommunityAvailable()) "" else "Ultimate"}") + +fun Project.intellijUltimateRootDir() = + if (isIntellijUltimateSdkAvailable()) + File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate") + else + throw GradleException("intellij ultimate SDK is not available") diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 1c9b00d5728..93b013252e5 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -40,6 +40,7 @@ val testJvm6ServerRuntime by configurations.creating val antLauncherJar by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) // Should come before compiler, because of "progarded" stuff needed for tests depDistProjects.forEach { diff --git a/compiler/incremental-compilation-impl/build.gradle.kts b/compiler/incremental-compilation-impl/build.gradle.kts index 7d234ab6bcd..99a0151508c 100644 --- a/compiler/incremental-compilation-impl/build.gradle.kts +++ b/compiler/incremental-compilation-impl/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { testCompile(projectTests(":kotlin-build-common")) testCompile(projectTests(":compiler:tests-common")) testCompile(intellijCoreDep()) { includeJars("intellij-core") } - testCompile(intellijDep()) { includeJars("annotations.jar") } + testCompile(intellijDep()) { includeJars("annotations", "log4j", "jdom") } } sourceSets { diff --git a/generators/build.gradle.kts b/generators/build.gradle.kts index 94c95d5870c..6829b17225a 100644 --- a/generators/build.gradle.kts +++ b/generators/build.gradle.kts @@ -4,6 +4,7 @@ apply { plugin("kotlin") } dependencies { compile(protobufFull()) compile(project(":idea")) + compile(project(":idea:idea-jvm")) compile(project(":j2k")) compile(project(":compiler:util")) compile(project(":compiler:cli")) diff --git a/idea/build.gradle.kts b/idea/build.gradle.kts index 01a70e1f399..6f5474dc673 100644 --- a/idea/build.gradle.kts +++ b/idea/build.gradle.kts @@ -118,7 +118,7 @@ sourceSets { projectTest { dependsOnTaskIfExistsRec("dist", project = rootProject) workingDir = rootDir - afterEvaluate { + doFirst { systemProperty("idea.home.path", intellijRootDir().canonicalPath) } } diff --git a/idea/idea-android/build.gradle.kts b/idea/idea-android/build.gradle.kts index 62ea18e4333..b920043dc6e 100644 --- a/idea/idea-android/build.gradle.kts +++ b/idea/idea-android/build.gradle.kts @@ -5,6 +5,9 @@ apply { plugin("kotlin") } val androidSdk by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijDep()) + compileOnly(project(":kotlin-reflect-api")) compile(project(":compiler:util")) compile(project(":compiler:light-classes")) @@ -45,8 +48,6 @@ dependencies { testRuntime(project(":noarg-ide-plugin")) testRuntime(project(":allopen-ide-plugin")) - testRuntime(intellijCoreDep()) { includeJars("intellij-core") } - testRuntime(intellijDep()) testRuntime(intellijPluginDep("android")) testRuntime(intellijPluginDep("copyright")) testRuntime(intellijPluginDep("coverage")) @@ -72,6 +73,7 @@ projectTest { workingDir = rootDir doFirst { systemProperty("android.sdk", androidSdk.singleFile.canonicalPath) + systemProperty("idea.home.path", intellijRootDir().canonicalPath) } } diff --git a/idea/idea-gradle/build.gradle.kts b/idea/idea-gradle/build.gradle.kts index e49c511e70d..ce5db43631d 100644 --- a/idea/idea-gradle/build.gradle.kts +++ b/idea/idea-gradle/build.gradle.kts @@ -3,6 +3,7 @@ apply { plugin("kotlin") } val androidSdk by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) compileOnly(project(":idea")) @@ -64,6 +65,7 @@ projectTest { dependsOn(androidSdk) doFirst { systemProperty("android.sdk", androidSdk.singleFile.canonicalPath) + systemProperty("idea.home.path", intellijRootDir().canonicalPath) } } diff --git a/idea/idea-maven/build.gradle.kts b/idea/idea-maven/build.gradle.kts index f3aaf309160..b193e94d1f4 100644 --- a/idea/idea-maven/build.gradle.kts +++ b/idea/idea-maven/build.gradle.kts @@ -55,4 +55,7 @@ testsJar() projectTest { workingDir = rootDir + doFirst { + systemProperty("idea.home.path", intellijRootDir().canonicalPath) + } } diff --git a/j2k/build.gradle.kts b/j2k/build.gradle.kts index c1582fb1f92..ca44fb19155 100644 --- a/j2k/build.gradle.kts +++ b/j2k/build.gradle.kts @@ -18,6 +18,7 @@ val usedIntellijPlugins = arrayOf( "java-decompiler") dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) compile(projectDist(":kotlin-stdlib")) @@ -53,6 +54,9 @@ sourceSets { projectTest { dependsOnTaskIfExistsRec("dist", project = rootProject) workingDir = rootDir + doFirst { + systemProperty("idea.home.path", intellijRootDir().canonicalPath) + } } testsJar() diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index a8441c348bf..9177bfea6c5 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -15,6 +15,7 @@ apply { plugin("kotlin") } val antLauncherJar by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) testCompile(protobufFull()) diff --git a/plugins/allopen/allopen-cli/build.gradle.kts b/plugins/allopen/allopen-cli/build.gradle.kts index 8ba0f4436ca..b0741435ee4 100644 --- a/plugins/allopen/allopen-cli/build.gradle.kts +++ b/plugins/allopen/allopen-cli/build.gradle.kts @@ -4,6 +4,7 @@ description = "Kotlin AllOpen Compiler Plugin" apply { plugin("kotlin") } dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) compileOnly(project(":compiler:plugin-api")) diff --git a/plugins/allopen/allopen-ide/build.gradle.kts b/plugins/allopen/allopen-ide/build.gradle.kts index 1a230334c97..bbdbf9c23fa 100644 --- a/plugins/allopen/allopen-ide/build.gradle.kts +++ b/plugins/allopen/allopen-ide/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { compile(project(":compiler:frontend")) compile(project(":compiler:cli-common")) compile(project(":idea")) + compile(project(":idea:idea-jvm")) compile(project(":idea:idea-jps-common")) compile(project(":plugins:annotation-based-compiler-plugins-ide-support")) compileOnly(intellijDep()) { includeJars("openapi", "idea") } diff --git a/plugins/android-extensions/android-extensions-idea/build.gradle.kts b/plugins/android-extensions/android-extensions-idea/build.gradle.kts index c5cca0e0dc3..aa5a3c9fd1d 100644 --- a/plugins/android-extensions/android-extensions-idea/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-idea/build.gradle.kts @@ -9,10 +9,14 @@ val androidSdk by configurations.creating val androidJar by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijDep()) + compile(project(":compiler:util")) compile(project(":compiler:light-classes")) compile(project(":idea:idea-core")) compile(project(":idea")) + compile(project(":idea:idea-jvm")) compile(project(":idea:idea-gradle")) compile(project(":plugins:android-extensions-compiler")) compileOnly(project(":kotlin-android-extensions-runtime")) @@ -31,9 +35,9 @@ dependencies { testCompile(projectDist(":kotlin-test:kotlin-test-jvm")) testCompile(commonDep("junit:junit")) testRuntime(projectDist(":kotlin-reflect")) - testCompile(intellijPluginDep("android")) { includeJars("android.jar", "android-common.jar", "sdk-common.jar", "sdk-tools.jar") } - testCompile(intellijPluginDep("Groovy")) { includeJars("Groovy.jar") } - testCompile(intellijDep()) { includeJars("extensions.jar") } + testCompile(intellijPluginDep("android")) { includeJars("android", "android-common", "sdk-common", "sdk-tools") } + testCompile(intellijPluginDep("Groovy")) { includeJars("Groovy") } + testCompile(intellijDep()) { includeJars("extensions") } testRuntime(project(":idea:idea-jvm")) testRuntime(project(":plugins:android-extensions-jps")) @@ -41,7 +45,6 @@ dependencies { testRuntime(project(":noarg-ide-plugin")) testRuntime(project(":allopen-ide-plugin")) testRuntime(project(":plugins:lint")) - testRuntime(intellijDep()) testRuntime(intellijPluginDep("junit")) testRuntime(intellijPluginDep("IntelliLang")) testRuntime(intellijPluginDep("properties")) @@ -70,6 +73,7 @@ projectTest { doFirst { systemProperty("android.sdk", androidSdk.singleFile.canonicalPath) systemProperty("android.jar", androidJar.singleFile.canonicalPath) + systemProperty("idea.home.path", intellijRootDir().canonicalPath) } } diff --git a/plugins/android-extensions/android-extensions-jps/build.gradle.kts b/plugins/android-extensions/android-extensions-jps/build.gradle.kts index 19329945a2b..527204471e8 100644 --- a/plugins/android-extensions/android-extensions-jps/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-jps/build.gradle.kts @@ -4,6 +4,9 @@ apply { plugin("kotlin") } val androidSdk by configurations.creating dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijDep()) + compile(project(":compiler:util")) compile(project(":jps-plugin")) compile(project(":plugins:android-extensions-compiler")) @@ -18,10 +21,9 @@ dependencies { testCompile(projectTests(":kotlin-build-common")) testCompileOnly(intellijDep()) { includeJars("openapi", "jps-builders") } testCompileOnly(intellijDep("jps-build-test")) { includeJars("jps-build-test") } + testCompileOnly(intellijDep()) { includeJars("jps-model") } testRuntime(intellijPluginDep("android")) - testRuntime(intellijCoreDep()) { includeJars("intellij-core") } - testRuntime(intellijDep()) testRuntime(intellijDep("jps-build-test")) testRuntime(intellijDep("jps-standalone")) @@ -37,6 +39,7 @@ projectTest { workingDir = rootDir doFirst { systemProperty("android.sdk", androidSdk.singleFile.canonicalPath) + systemProperty("idea.home.path", intellijRootDir().canonicalPath) } } diff --git a/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts b/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts index 8ca4c204dc0..c0fd396b9a9 100644 --- a/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts +++ b/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts @@ -8,6 +8,7 @@ dependencies { compile(project(":compiler:frontend")) compile(project(":compiler:cli-common")) compile(project(":idea")) + compile(project(":idea:idea-jvm")) compile(project(":idea:idea-jps-common")) compile(project(":idea:idea-gradle")) compile(project(":idea:idea-maven")) diff --git a/plugins/kapt3/kapt3-compiler/build.gradle.kts b/plugins/kapt3/kapt3-compiler/build.gradle.kts index c9d3eb7a10f..d25235185d5 100644 --- a/plugins/kapt3/kapt3-compiler/build.gradle.kts +++ b/plugins/kapt3/kapt3-compiler/build.gradle.kts @@ -4,8 +4,8 @@ description = "Annotation Processor for Kotlin" apply { plugin("kotlin") } dependencies { - testRuntime(intellijDep()) testCompile(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijDep()) testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "openapi") } compile(project(":compiler:util")) diff --git a/plugins/lint/build.gradle.kts b/plugins/lint/build.gradle.kts index 5809a439dda..540cf0b9efc 100644 --- a/plugins/lint/build.gradle.kts +++ b/plugins/lint/build.gradle.kts @@ -7,6 +7,7 @@ apply { dependencies { compile(project(":compiler:frontend")) compile(project(":idea")) + compile(project(":idea:idea-jvm")) compile(project(":idea:idea-core")) compile(project(":idea:idea-android")) compile(project(":plugins:uast-kotlin")) diff --git a/plugins/noarg/noarg-cli/build.gradle.kts b/plugins/noarg/noarg-cli/build.gradle.kts index 61f3e092a54..62d4387c1a1 100644 --- a/plugins/noarg/noarg-cli/build.gradle.kts +++ b/plugins/noarg/noarg-cli/build.gradle.kts @@ -4,6 +4,7 @@ description = "Kotlin NoArg Compiler Plugin" apply { plugin("kotlin") } dependencies { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijDep()) compileOnly(project(":compiler:frontend")) diff --git a/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts b/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts index c97d0c5656d..e3afbfb4526 100644 --- a/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts +++ b/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts @@ -4,22 +4,22 @@ description = "Kotlin SamWithReceiver Compiler Plugin" apply { plugin("kotlin") } dependencies { - testRuntime(intellijCoreDep()) { includeJars("intellij-core") } - testRuntime(intellijDep()) - compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:plugin-api")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } - runtime(projectRuntimeJar(":kotlin-compiler")) runtime(projectDist(":kotlin-stdlib")) runtime(projectDist(":kotlin-reflect")) + // TODO: find out whether it is important, and if yes - why it breaks tests and how to fix it +// runtime(projectRuntimeJar(":kotlin-compiler")) testCompile(project(":compiler:backend")) testCompile(project(":compiler:cli")) testCompile(project(":compiler:tests-common")) testCompile(projectTests(":compiler:tests-common")) testCompile(commonDep("junit:junit")) + testCompile(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijDep()) } sourceSets { @@ -46,5 +46,6 @@ ideaPlugin { } projectTest { + dependsOn(":prepare:mock-runtime-for-test:dist") workingDir = rootDir } diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts b/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts index 22b4e4bfdf8..1763d861588 100644 --- a/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts +++ b/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts @@ -14,6 +14,8 @@ dependencies { compile(project(":idea:idea-core")) compile(project(":idea:idea-android")) compile(project(":idea")) + compile(project(":idea:idea-jvm")) + compile(intellijDep()) { includeJars("openapi", "extensions", "util") } } sourceSets { diff --git a/plugins/uast-kotlin/build.gradle.kts b/plugins/uast-kotlin/build.gradle.kts index 023049e97c0..3ceae66fe09 100644 --- a/plugins/uast-kotlin/build.gradle.kts +++ b/plugins/uast-kotlin/build.gradle.kts @@ -43,4 +43,7 @@ testsJar {} projectTest { workingDir = rootDir + doFirst { + systemProperty("idea.home.path", intellijRootDir().canonicalPath) + } } diff --git a/ultimate/build.gradle.kts b/ultimate/build.gradle.kts index 997641014fa..bc134b9f979 100644 --- a/ultimate/build.gradle.kts +++ b/ultimate/build.gradle.kts @@ -12,9 +12,16 @@ val ideaProjectResources = project(":idea").the().sourceS evaluationDependsOn(":prepare:idea-plugin") +val intellijUltimateEnabled = true // : Boolean by rootProject.extra + val springClasspath by configurations.creating dependencies { + if (intellijUltimateEnabled) { + testRuntime(intellijCoreDep()) { includeJars("intellij-core") } + testRuntime(intellijUltimateDep()) + } + compileOnly(project(":kotlin-reflect-api")) compile(projectDist(":kotlin-stdlib")) compile(project(":core:descriptors")) { isTransitive = false } @@ -30,31 +37,37 @@ dependencies { compile(project(":idea:ide-common")) { isTransitive = false } compile(project(":idea:idea-gradle")) { isTransitive = false } compileOnly(intellijCoreDep()) { includeJars("intellij-core") } - compileOnly(intellijDep()) { includeJars("annotations", "trove4j", "openapi", "idea", "util", "jdom") } - compileOnly(intellijPluginDep("CSS")) - compileOnly(intellijPluginDep("DatabaseTools")) - compileOnly(intellijPluginDep("JavaEE")) - compileOnly(intellijPluginDep("jsp")) - compileOnly(intellijPluginDep("PersistenceSupport")) - compileOnly(intellijPluginDep("Spring")) - compileOnly(intellijPluginDep("properties")) - compileOnly(intellijPluginDep("java-i18n")) - compileOnly(intellijPluginDep("gradle")) - compileOnly(intellijPluginDep("Groovy")) - compileOnly(intellijPluginDep("junit")) - compileOnly(intellijPluginDep("uml")) - compileOnly(intellijPluginDep("JavaScriptLanguage")) - compileOnly(intellijPluginDep("JavaScriptDebugger")) - compileOnly(intellijPluginDep("NodeJS")) + + if (intellijUltimateEnabled) { + compileOnly(intellijUltimatePluginDep("NodeJS")) + compileOnly(intellijUltimateDep()) { includeJars("annotations", "trove4j", "openapi", "idea", "util", "jdom") } + compileOnly(intellijUltimatePluginDep("CSS")) + compileOnly(intellijUltimatePluginDep("DatabaseTools")) + compileOnly(intellijUltimatePluginDep("JavaEE")) + compileOnly(intellijUltimatePluginDep("jsp")) + compileOnly(intellijUltimatePluginDep("PersistenceSupport")) + compileOnly(intellijUltimatePluginDep("Spring")) + compileOnly(intellijUltimatePluginDep("properties")) + compileOnly(intellijUltimatePluginDep("java-i18n")) + compileOnly(intellijUltimatePluginDep("gradle")) + compileOnly(intellijUltimatePluginDep("Groovy")) + compileOnly(intellijUltimatePluginDep("junit")) + compileOnly(intellijUltimatePluginDep("uml")) + compileOnly(intellijUltimatePluginDep("JavaScriptLanguage")) + compileOnly(intellijUltimatePluginDep("JavaScriptDebugger")) + } testCompile(projectDist(":kotlin-test:kotlin-test-jvm")) - testCompileOnly(project(":idea:idea-test-framework")) { isTransitive = false } - testCompileOnly(project(":plugins:lint")) { isTransitive = false } - testCompileOnly(project(":idea:idea-jvm")) { isTransitive = false } + testCompile(project(":idea:idea-test-framework")) { isTransitive = false } + testCompile(project(":plugins:lint")) { isTransitive = false } + testCompile(project(":idea:idea-jvm")) { isTransitive = false } testCompile(projectTests(":compiler:tests-common")) testCompile(projectTests(":idea")) { isTransitive = false } testCompile(projectTests(":generators:test-generator")) testCompile(commonDep("junit:junit")) + if (intellijUltimateEnabled) { + testCompileOnly(intellijUltimateDep()) { includeJars("gson-2.5", "annotations", "trove4j", "openapi", "idea", "util", "jdom") } + } testCompile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } testRuntime(projectDist(":kotlin-reflect")) @@ -76,42 +89,39 @@ dependencies { testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false } testRuntime(project(":plugins:uast-kotlin")) testRuntime(project(":plugins:uast-kotlin-idea")) + + if (intellijUltimateEnabled) { + testCompile(intellijUltimatePluginDep("CSS")) + testCompile(intellijUltimatePluginDep("DatabaseTools")) + testCompile(intellijUltimatePluginDep("JavaEE")) + testCompile(intellijUltimatePluginDep("jsp")) + testCompile(intellijUltimatePluginDep("PersistenceSupport")) + testCompile(intellijUltimatePluginDep("Spring")) + testCompile(intellijUltimatePluginDep("uml")) + testCompile(intellijUltimatePluginDep("JavaScriptLanguage")) + testCompile(intellijUltimatePluginDep("JavaScriptDebugger")) + testCompile(intellijUltimatePluginDep("NodeJS")) + testCompile(intellijUltimatePluginDep("properties")) + testCompile(intellijUltimatePluginDep("java-i18n")) + testCompile(intellijUltimatePluginDep("gradle")) + testCompile(intellijUltimatePluginDep("Groovy")) + testCompile(intellijUltimatePluginDep("junit")) + testRuntime(intellijUltimatePluginDep("coverage")) + testRuntime(intellijUltimatePluginDep("maven")) + testRuntime(intellijUltimatePluginDep("android")) + testRuntime(intellijUltimatePluginDep("testng")) + testRuntime(intellijUltimatePluginDep("IntelliLang")) + testRuntime(intellijUltimatePluginDep("copyright")) + testRuntime(intellijUltimatePluginDep("java-decompiler")) + } + testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar")) - testRuntime(project(":plugins:kapt3-idea")) - testRuntime(project(":idea:idea-test-framework")) - testRuntime(project(":plugins:lint")) - testRuntime(project(":idea:idea-jvm")) springClasspath(commonDep("org.springframework", "spring-core")) springClasspath(commonDep("org.springframework", "spring-beans")) springClasspath(commonDep("org.springframework", "spring-context")) springClasspath(commonDep("org.springframework", "spring-tx")) springClasspath(commonDep("org.springframework", "spring-web")) - - testCompileOnly(intellijDep()) { includeJars("gson-2.5", "annotations", "trove4j", "openapi", "idea", "util", "jdom") } - testRuntime(intellijDep()) - testCompile(intellijPluginDep("CSS")) - testCompile(intellijPluginDep("DatabaseTools")) - testCompile(intellijPluginDep("JavaEE")) - testCompile(intellijPluginDep("jsp")) - testCompile(intellijPluginDep("PersistenceSupport")) - testCompile(intellijPluginDep("Spring")) - testCompile(intellijPluginDep("properties")) - testCompile(intellijPluginDep("java-i18n")) - testCompile(intellijPluginDep("gradle")) - testCompile(intellijPluginDep("Groovy")) - testCompile(intellijPluginDep("junit")) - testCompile(intellijPluginDep("uml")) - testCompile(intellijPluginDep("JavaScriptLanguage")) - testCompile(intellijPluginDep("JavaScriptDebugger")) - testCompile(intellijPluginDep("NodeJS")) - testRuntime(intellijPluginDep("coverage")) - testRuntime(intellijPluginDep("maven")) - testRuntime(intellijPluginDep("android")) - testRuntime(intellijPluginDep("testng")) - testRuntime(intellijPluginDep("IntelliLang")) - testRuntime(intellijPluginDep("copyright")) - testRuntime(intellijPluginDep("java-decompiler")) } val preparedResources = File(buildDir, "prepResources") @@ -187,7 +197,7 @@ projectTest { dependsOn(preparePluginXml) workingDir = rootDir doFirst { - systemProperty("idea.home.path", intellijRootDir().canonicalPath) + systemProperty("idea.home.path", intellijUltimateRootDir().canonicalPath) systemProperty("spring.classpath", springClasspath.asPath) } } diff --git a/ultimate/ultimate-runner/build.gradle.kts b/ultimate/ultimate-runner/build.gradle.kts index 01618ab09c5..f9b5f129939 100644 --- a/ultimate/ultimate-runner/build.gradle.kts +++ b/ultimate/ultimate-runner/build.gradle.kts @@ -45,7 +45,7 @@ afterEvaluate { dependsOn(prepareSandbox) group = "intellij" description = "Runs Intellij IDEA Ultimate with installed plugin." - setIdeaDirectory(intellijRootDir()) + setIdeaDirectory(intellijUltimateRootDir()) setConfigDirectory(File(ideaUltimateSandboxDir, "config")) setSystemDirectory(ideaUltimateSandboxDir) setPluginsDirectory(ideaUltimatePluginDir.parent)