From fc9000d4609775367285f2856c50be144f1528f0 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Wed, 29 Dec 2021 18:47:28 +0100 Subject: [PATCH] Adopt Kotlin JPS plugin modules Gradle model to kotlin/master Recenlty, Kotlin repository started using Gradle 7.1. Deprecated `compile`/`testCompile` Gradle API were dropped in that release --- .../src/main/kotlin/intellijDependencies.kt | 3 + jps/jps-common/build.gradle.kts | 22 +++-- jps/jps-plugin/build.gradle.kts | 86 ++++++++++++------- 3 files changed, 69 insertions(+), 42 deletions(-) diff --git a/buildSrc/src/main/kotlin/intellijDependencies.kt b/buildSrc/src/main/kotlin/intellijDependencies.kt index fee0ea17af2..bc52ea5edc1 100644 --- a/buildSrc/src/main/kotlin/intellijDependencies.kt +++ b/buildSrc/src/main/kotlin/intellijDependencies.kt @@ -16,6 +16,9 @@ fun Project.jpsModel() = "com.jetbrains.intellij.platform:jps-model:$intellijVer fun Project.jpsModelSerialization() = "com.jetbrains.intellij.platform:jps-model-serialization:$intellijVersion" fun Project.jpsModelImpl() = "com.jetbrains.intellij.platform:jps-model-impl:$intellijVersion" fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:$intellijVersion" +fun Project.jpsBuild() = "com.jetbrains.intellij.platform:jps-build:$intellijVersion" +fun Project.testFramework() = "com.jetbrains.intellij.platform:test-framework:$intellijVersion" +fun Project.devKitJps() = "com.jetbrains.intellij.devkit:devkit-jps:$intellijVersion" fun Project.intellijPlatformUtil() = "com.jetbrains.intellij.platform:util:$intellijVersion" fun Project.intellijJavaRt() = "com.jetbrains.intellij.java:java-rt:$intellijVersion" fun Project.intellijAnalysis() = "com.jetbrains.intellij.platform:analysis:$intellijVersion" diff --git a/jps/jps-common/build.gradle.kts b/jps/jps-common/build.gradle.kts index 5c9a207ff09..3aef8c4f9c2 100644 --- a/jps/jps-common/build.gradle.kts +++ b/jps/jps-common/build.gradle.kts @@ -5,17 +5,21 @@ plugins { } dependencies { - compile(kotlinStdlib()) + api(kotlinStdlib()) compileOnly(project(":kotlin-reflect-api")) - compile(project(":compiler:util")) - compile(project(":compiler:cli-common")) - compile(project(":compiler:frontend.java")) - compile(project(":js:js.frontend")) - compile(project(":native:frontend.native")) - compileOnly(intellijDep()) - compileOnly(jpsStandalone()) { includeJars("jps-model") } + testImplementation(project(":kotlin-reflect")) + api(project(":compiler:util")) + api(project(":compiler:cli-common")) + api(project(":compiler:frontend.java")) + api(project(":js:js.frontend")) + api(project(":native:frontend.native")) + compileOnly(intellijCore()) + compileOnly(jpsModel()) + compileOnly(jpsModelImpl()) + compileOnly(jpsModelSerialization()) - testCompile(commonDep("junit:junit")) + testApi(jpsModelSerialization()) + testApi(commonDependency("junit:junit")) } sourceSets { diff --git a/jps/jps-plugin/build.gradle.kts b/jps/jps-plugin/build.gradle.kts index f75bee5d22a..3d1e382d781 100644 --- a/jps/jps-plugin/build.gradle.kts +++ b/jps/jps-plugin/build.gradle.kts @@ -15,48 +15,68 @@ val generateTests by generator("org.jetbrains.kotlin.jps.GenerateJpsPluginTestsK } dependencies { - compile(project(":kotlin-build-common")) - compile(project(":core:descriptors")) - compile(project(":core:descriptors.jvm")) - compile(project(":kotlin-compiler-runner")) - compile(project(":daemon-common")) - compile(project(":daemon-common-new")) - compile(projectRuntimeJar(":kotlin-daemon-client")) - compile(projectRuntimeJar(":kotlin-daemon")) + api(project(":kotlin-build-common")) + api(project(":core:descriptors")) + api(project(":core:descriptors.jvm")) + api(project(":kotlin-compiler-runner-unshaded")) + api(project(":kotlin-compiler-runner")) + api(project(":daemon-common")) + api(project(":daemon-common-new")) + api(project(":kotlin-daemon-client")) + api(project(":kotlin-daemon")) testImplementation(projectTests(":generators:test-generator")) - compile(project(":compiler:frontend.java")) - compile(project(":js:js.frontend")) - compile(projectRuntimeJar(":kotlin-preloader")) - compile(project(":jps:jps-common")) - compileOnly(intellijDep()) { - includeJars("jdom", "trove4j", "jps-model", "platform-api", "util", "asm-all", rootProject = rootProject) - } - compileOnly(jpsStandalone()) { includeJars("jps-builders", "jps-builders-6") } + api(project(":compiler:frontend.java")) + api(project(":js:js.frontend")) + api(project(":kotlin-preloader")) + api(project(":jps:jps-common")) + compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) + compileOnly(intellijCore()) + compileOnly(jpsModel()) + compileOnly(jpsModelImpl()) + compileOnly(jpsBuild()) + compileOnly(jpsModelSerialization()) + testApi(jpsModel()) + + // testFramework includes too many unnecessary dependencies. Here we manually list all we need to successfully run JPS tests + testApi(testFramework()) { isTransitive = false } + testApi("com.jetbrains.intellij.platform:test-framework-core:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:analysis-impl:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:boot:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:analysis:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:project-model:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:object-serializer:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:code-style:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:ide-impl:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:ide:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:util-ui:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:concurrency:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:editor:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:core-ui:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:lang:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:lang-impl:$intellijVersion") { isTransitive = false } + testRuntimeOnly("com.jetbrains.intellij.platform:util-ex:$intellijVersion") { isTransitive = false } + testCompileOnly(project(":kotlin-reflect-api")) - testCompile(project(":compiler:incremental-compilation-impl")) - testCompile(projectTests(":compiler:tests-common")) - testCompile(projectTests(":compiler:incremental-compilation-impl")) - testCompile(commonDep("junit:junit")) - testCompile(project(":kotlin-test:kotlin-test-jvm")) - testCompile(projectTests(":kotlin-build-common")) + testApi(project(":compiler:incremental-compilation-impl")) + testApi(projectTests(":compiler:tests-common")) + testApi(projectTests(":compiler:incremental-compilation-impl")) + testApi(commonDependency("junit:junit")) + testApi(project(":kotlin-test:kotlin-test-jvm")) + testApi(projectTests(":kotlin-build-common")) testApi(projectTests(":compiler:test-infrastructure-utils")) - testCompileOnly(jpsStandalone()) { includeJars("jps-builders", "jps-builders-6") } - Ide.IJ { - testCompile(intellijDep("devkit")) - } + testCompileOnly(jpsBuild()) + testApi(devKitJps()) - testCompile(intellijDep()) + testApi(intellijCore()) - testCompile(jpsBuildTest()) + testApi(jpsBuildTest()) compilerModules.forEach { - testRuntime(project(it)) + testRuntimeOnly(project(it)) } - testRuntimeOnly(intellijPluginDep("java")) - testRuntimeOnly(toolsJar()) - testRuntime(project(":kotlin-reflect")) - testRuntime(project(":kotlin-script-runtime")) + testRuntimeOnly(project(":kotlin-reflect")) + testRuntimeOnly(project(":kotlin-script-runtime")) } sourceSets {