From 0cb256a9996e5c778ff65c9d8d43d419c0405857 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Thu, 26 May 2022 21:02:21 +0200 Subject: [PATCH] JPS plugin: Cleanup dependencies - Some unnecessary dependencies are dropped - `api` is replaced with `implementation` when it's more appropriate (in our case more appropriate everywhere). `implementation` makes it easier to analyze dependencies because it doesn't export the dependencies - Regarding: `// Workaround for Gradle dependency resolution error`. Actually, it's not longer needed for the successful project import. Confirmed by Yahor and tested locally. --- .../compiler-runner-unshaded/build.gradle.kts | 5 +- jps/jps-common/build.gradle.kts | 20 ++++---- jps/jps-plugin/build.gradle.kts | 48 +++++++------------ 3 files changed, 30 insertions(+), 43 deletions(-) diff --git a/compiler/compiler-runner-unshaded/build.gradle.kts b/compiler/compiler-runner-unshaded/build.gradle.kts index 175b6adc1a2..13f5c257f32 100644 --- a/compiler/compiler-runner-unshaded/build.gradle.kts +++ b/compiler/compiler-runner-unshaded/build.gradle.kts @@ -6,9 +6,8 @@ plugins { } dependencies { - api(project(":kotlin-build-common")) - api(project(":kotlin-daemon-client")) - api(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } + implementation(project(":kotlin-daemon-client")) + implementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } compileOnly(project(":compiler:cli-common")) compileOnly(project(":kotlin-preloader")) diff --git a/jps/jps-common/build.gradle.kts b/jps/jps-common/build.gradle.kts index 311221f29c7..b65813762d8 100644 --- a/jps/jps-common/build.gradle.kts +++ b/jps/jps-common/build.gradle.kts @@ -5,22 +5,22 @@ plugins { } dependencies { - api(kotlinStdlib()) - compileOnly(project(":kotlin-reflect-api")) - 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")) + implementation(kotlinStdlib()) + implementation(project(":compiler:util")) + implementation(project(":compiler:cli-common")) + implementation(project(":compiler:frontend.java")) + implementation(project(":js:js.frontend")) + implementation(project(":kotlin-reflect")) compileOnly(intellijUtilRt()) compileOnly(intellijPlatformUtil()) compileOnly(jpsModel()) compileOnly(jpsModelImpl()) compileOnly(jpsModelSerialization()) - testApi(jpsModelSerialization()) - testApi(commonDependency("junit:junit")) + testImplementation(project(":compiler:cli-common")) + testImplementation(jpsModelSerialization()) + testImplementation(project(":kotlin-reflect")) + testImplementation(commonDependency("junit:junit")) } sourceSets { diff --git a/jps/jps-plugin/build.gradle.kts b/jps/jps-plugin/build.gradle.kts index 4a8ade8f8c4..01f6a0f0c06 100644 --- a/jps/jps-plugin/build.gradle.kts +++ b/jps/jps-plugin/build.gradle.kts @@ -15,31 +15,28 @@ val generateTests by generator("org.jetbrains.kotlin.jps.GenerateJpsPluginTestsK } dependencies { - 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")) + implementation(project(":kotlin-build-common")) + implementation(project(":core:descriptors")) + implementation(project(":core:descriptors.jvm")) + implementation(project(":kotlin-compiler-runner-unshaded")) + implementation(project(":daemon-common")) + implementation(project(":daemon-common-new")) + implementation(project(":kotlin-daemon-client")) compileOnly(project(":jps:jps-platform-api-signatures")) testImplementation(projectTests(":generators:test-generator")) - api(project(":compiler:frontend.java")) - api(project(":js:js.frontend")) - api(project(":kotlin-preloader")) - api(project(":jps:jps-common")) + implementation(project(":compiler:frontend.java")) + implementation(project(":js:js.frontend")) + implementation(project(":kotlin-preloader")) + implementation(project(":jps:jps-common")) compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) compileOnly(jpsModel()) - compileOnly(jpsModelImpl()) compileOnly(jpsBuild()) compileOnly(jpsModelSerialization()) - testApi(jpsModel()) + testRuntimeOnly(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 } + testImplementation(testFramework()) { isTransitive = false } + testImplementation("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 } @@ -55,29 +52,20 @@ dependencies { 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 } + testRuntimeOnly("com.google.code.gson:gson:2.8.9") testCompileOnly(project(":kotlin-reflect-api")) - 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")) + testImplementation(projectTests(":compiler:incremental-compilation-impl")) testCompileOnly(jpsBuild()) - testApi(devKitJps()) { + testImplementation(devKitJps()) { exclude(group = "com.google.code.gson", module = "gson") // Workaround for Gradle dependency resolution error } - implementation("com.google.code.gson:gson:2.8.9") // Workaround for Gradle dependency resolution error - testApi(jpsBuildTest()) + testImplementation(jpsBuildTest()) compilerModules.forEach { testRuntimeOnly(project(it)) } - testRuntimeOnly(toolsJar()) - testRuntimeOnly(project(":kotlin-reflect")) - testRuntimeOnly(project(":kotlin-script-runtime")) testImplementation("org.projectlombok:lombok:1.18.16") }