From 94d58c714a461514ab5033cd855e80a9be32db73 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 28 Aug 2020 15:27:01 +0300 Subject: [PATCH] [FIR] Cleanup dependencies for fir modules --- buildSrc/src/main/kotlin/localDependencies.kt | 2 ++ compiler/fir/analysis-tests/build.gradle.kts | 12 +++++------ compiler/fir/checkers/build.gradle.kts | 10 ++++++++-- compiler/fir/dump/build.gradle.kts | 20 +++++++++---------- .../fir/fir-serialization/build.gradle.kts | 9 +++++---- compiler/fir/fir2ir/build.gradle.kts | 13 ++++++------ compiler/fir/java/build.gradle.kts | 10 +++++----- compiler/fir/jvm/build.gradle.kts | 5 +---- .../fir/modularized-tests/build.gradle.kts | 16 +++++++-------- .../raw-fir/light-tree2fir/build.gradle.kts | 2 ++ compiler/fir/raw-fir/psi2fir/build.gradle.kts | 2 ++ .../raw-fir/raw-fir.common/build.gradle.kts | 5 +++-- compiler/fir/resolve/build.gradle.kts | 12 +++++------ compiler/tests-spec/build.gradle.kts | 3 +++ .../tools/new-project-wizard/build.gradle.kts | 2 +- prepare/idea-plugin/build.gradle.kts | 2 +- 16 files changed, 69 insertions(+), 56 deletions(-) diff --git a/buildSrc/src/main/kotlin/localDependencies.kt b/buildSrc/src/main/kotlin/localDependencies.kt index 490d7509202..249d37369b7 100644 --- a/buildSrc/src/main/kotlin/localDependencies.kt +++ b/buildSrc/src/main/kotlin/localDependencies.kt @@ -80,6 +80,8 @@ fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extr fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}" +fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}" + /** * Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one). * diff --git a/compiler/fir/analysis-tests/build.gradle.kts b/compiler/fir/analysis-tests/build.gradle.kts index 4b93180d189..419c899a894 100644 --- a/compiler/fir/analysis-tests/build.gradle.kts +++ b/compiler/fir/analysis-tests/build.gradle.kts @@ -11,14 +11,14 @@ plugins { dependencies { compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } - testCompile(intellijDep()) + testApi(intellijDep()) - testCompile(commonDep("junit:junit")) + testApi(commonDep("junit:junit")) testCompileOnly(project(":kotlin-test:kotlin-test-jvm")) testCompileOnly(project(":kotlin-test:kotlin-test-junit")) - testCompile(projectTests(":compiler:tests-common")) - testCompile(project(":compiler:fir:checkers")) - testCompile(project(":compiler:frontend")) + testApi(projectTests(":compiler:tests-common")) + testApi(project(":compiler:fir:checkers")) + testApi(project(":compiler:frontend")) testCompileOnly(project(":kotlin-reflect-api")) testRuntime(project(":kotlin-reflect")) @@ -42,4 +42,4 @@ projectTest(parallel = true) { maxHeapSize = "3g" } -testsJar() \ No newline at end of file +testsJar() diff --git a/compiler/fir/checkers/build.gradle.kts b/compiler/fir/checkers/build.gradle.kts index bafe965f593..ea17634f54c 100644 --- a/compiler/fir/checkers/build.gradle.kts +++ b/compiler/fir/checkers/build.gradle.kts @@ -4,8 +4,14 @@ plugins { } dependencies { - compile(project(":compiler:fir:resolve")) - api(project(":compiler:frontend")) + api(project(":compiler:fir:resolve")) + + /* + * We can't remove this dependency until we use + * diagnostics framework from FE 1.0 + */ + implementation(project(":compiler:frontend")) + implementation(project(":compiler:psi")) compileOnly(project(":kotlin-reflect-api")) compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } diff --git a/compiler/fir/dump/build.gradle.kts b/compiler/fir/dump/build.gradle.kts index cdb57677e1f..6aef039669c 100644 --- a/compiler/fir/dump/build.gradle.kts +++ b/compiler/fir/dump/build.gradle.kts @@ -13,23 +13,23 @@ repositories { } dependencies { - compile(project(":core:descriptors")) - compile(project(":core:deserialization")) - compile(project(":compiler:fir:cones")) - compile(project(":compiler:fir:tree")) - compile(project(":compiler:fir:resolve")) - compile(project(":compiler:fir:java")) - compile(project(":compiler:cli")) + implementation(project(":core:descriptors")) + implementation(project(":core:deserialization")) + implementation(project(":compiler:fir:cones")) + implementation(project(":compiler:fir:tree")) + implementation(project(":compiler:fir:resolve")) + implementation(project(":compiler:fir:java")) + implementation(project(":compiler:cli")) + + implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12") compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijDep()) { includeJars("commons-lang-2.4") } - compile("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12") } sourceSets { "main" { projectDefault() } } - -testsJar() \ No newline at end of file +testsJar() diff --git a/compiler/fir/fir-serialization/build.gradle.kts b/compiler/fir/fir-serialization/build.gradle.kts index 59269c80e89..cc8a1c9caba 100644 --- a/compiler/fir/fir-serialization/build.gradle.kts +++ b/compiler/fir/fir-serialization/build.gradle.kts @@ -4,13 +4,14 @@ plugins { } dependencies { - compile(project(":core:descriptors")) - compile(project(":compiler:fir:cones")) - compile(project(":compiler:fir:tree")) - compile(project(":compiler:fir:resolve")) + implementation(project(":core:descriptors")) implementation(project(":compiler:fir:fir-deserialization")) implementation(project(":core:deserialization")) + api(project(":compiler:fir:cones")) + api(project(":compiler:fir:tree")) + api(project(":compiler:fir:resolve")) + compileOnly(intellijCoreDep()) { includeJars("intellij-core", rootProject = rootProject) } } diff --git a/compiler/fir/fir2ir/build.gradle.kts b/compiler/fir/fir2ir/build.gradle.kts index 7dc2a4730f6..dd3163d91c0 100644 --- a/compiler/fir/fir2ir/build.gradle.kts +++ b/compiler/fir/fir2ir/build.gradle.kts @@ -5,6 +5,7 @@ plugins { dependencies { compileOnly(project(":core:descriptors")) + compileOnly(project(":core:descriptors.jvm")) compileOnly(project(":compiler:fir:cones")) compileOnly(project(":compiler:fir:resolve")) compileOnly(project(":compiler:fir:tree")) @@ -16,18 +17,18 @@ dependencies { testCompileOnly(intellijDep()) - testRuntime(intellijDep()) + testRuntimeOnly(intellijDep()) - testCompile(commonDep("junit:junit")) + testApi(commonDep("junit:junit")) testCompileOnly(project(":kotlin-test:kotlin-test-jvm")) testCompileOnly(project(":kotlin-test:kotlin-test-junit")) - testCompile(projectTests(":compiler:tests-common")) - testCompile(projectTests(":compiler:fir:analysis-tests")) + testApi(projectTests(":compiler:tests-common")) + testApi(projectTests(":compiler:fir:analysis-tests")) testApi(project(":compiler:resolution.common")) testCompileOnly(project(":kotlin-reflect-api")) - testRuntime(project(":kotlin-reflect")) - testRuntime(project(":core:descriptors.runtime")) + testRuntimeOnly(project(":kotlin-reflect")) + testRuntimeOnly(project(":core:descriptors.runtime")) Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } diff --git a/compiler/fir/java/build.gradle.kts b/compiler/fir/java/build.gradle.kts index a07e1f6e618..b2b7e85421c 100644 --- a/compiler/fir/java/build.gradle.kts +++ b/compiler/fir/java/build.gradle.kts @@ -5,12 +5,12 @@ plugins { } dependencies { - compile(project(":compiler:frontend.common")) - compile(project(":compiler:frontend.java")) - compile(project(":compiler:fir:resolve")) - compile(project(":compiler:fir:checkers")) - implementation(project(":compiler:fir:jvm")) + api(project(":compiler:frontend.common")) + api(project(":compiler:fir:resolve")) + api(project(":compiler:fir:checkers")) + api(project(":compiler:fir:jvm")) api(project(":compiler:fir:fir-deserialization")) + implementation(project(":compiler:frontend.java")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } } diff --git a/compiler/fir/jvm/build.gradle.kts b/compiler/fir/jvm/build.gradle.kts index b44f2f63121..20d74ae7f39 100644 --- a/compiler/fir/jvm/build.gradle.kts +++ b/compiler/fir/jvm/build.gradle.kts @@ -4,16 +4,13 @@ plugins { } dependencies { - implementation(project(":compiler:fir:cones")) implementation(project(":compiler:fir:tree")) implementation(project(":compiler:fir:resolve")) implementation(project(":compiler:frontend.java")) } - - sourceSets { "main" { projectDefault() } "test" {} -} \ No newline at end of file +} diff --git a/compiler/fir/modularized-tests/build.gradle.kts b/compiler/fir/modularized-tests/build.gradle.kts index bb82f6a3225..b6e13a1aa74 100644 --- a/compiler/fir/modularized-tests/build.gradle.kts +++ b/compiler/fir/modularized-tests/build.gradle.kts @@ -22,19 +22,19 @@ dependencies { testRuntimeOnly(intellijPluginDep("java")) } - testRuntime(intellijDep()) + testRuntimeOnly(intellijDep()) - testCompile(commonDep("junit:junit")) + testApi(commonDep("junit:junit")) testCompileOnly(project(":kotlin-test:kotlin-test-jvm")) testCompileOnly(project(":kotlin-test:kotlin-test-junit")) - testCompile(projectTests(":compiler:tests-common")) + testApi(projectTests(":compiler:tests-common")) testCompileOnly(project(":kotlin-reflect-api")) - testRuntime(project(":kotlin-reflect")) - testRuntime(project(":core:descriptors.runtime")) - testCompile(projectTests(":compiler:fir:analysis-tests")) - testCompile(project(":compiler:fir:resolve")) - testCompile(project(":compiler:fir:dump")) + testRuntimeOnly(project(":kotlin-reflect")) + testRuntimeOnly(project(":core:descriptors.runtime")) + testApi(projectTests(":compiler:fir:analysis-tests")) + testApi(project(":compiler:fir:resolve")) + testApi(project(":compiler:fir:dump")) val asyncProfilerClasspath = project.findProperty("fir.bench.async.profiler.classpath") as? String if (asyncProfilerClasspath != null) { diff --git a/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts b/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts index 61f9d606fa1..1e8e9182803 100644 --- a/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts +++ b/compiler/fir/raw-fir/light-tree2fir/build.gradle.kts @@ -16,6 +16,8 @@ repositories { dependencies { api(project(":compiler:fir:raw-fir:raw-fir.common")) + implementation(project(":compiler:psi")) + implementation(kotlinxCollectionsImmutable()) compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } diff --git a/compiler/fir/raw-fir/psi2fir/build.gradle.kts b/compiler/fir/raw-fir/psi2fir/build.gradle.kts index 0dcb1be4193..975bfb1dd4d 100644 --- a/compiler/fir/raw-fir/psi2fir/build.gradle.kts +++ b/compiler/fir/raw-fir/psi2fir/build.gradle.kts @@ -10,6 +10,8 @@ plugins { dependencies { api(project(":compiler:fir:raw-fir:raw-fir.common")) + implementation(project(":compiler:psi")) + implementation(kotlinxCollectionsImmutable()) compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } diff --git a/compiler/fir/raw-fir/raw-fir.common/build.gradle.kts b/compiler/fir/raw-fir/raw-fir.common/build.gradle.kts index f2ce9f1f3d7..73568a6026e 100644 --- a/compiler/fir/raw-fir/raw-fir.common/build.gradle.kts +++ b/compiler/fir/raw-fir/raw-fir.common/build.gradle.kts @@ -10,8 +10,9 @@ plugins { dependencies { api(project(":compiler:fir:tree")) - api(project(":compiler:psi")) - api("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.2") + + implementation(kotlinxCollectionsImmutable()) + implementation(project(":compiler:psi")) compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } diff --git a/compiler/fir/resolve/build.gradle.kts b/compiler/fir/resolve/build.gradle.kts index a2ab6744f3f..16a0cb9f451 100644 --- a/compiler/fir/resolve/build.gradle.kts +++ b/compiler/fir/resolve/build.gradle.kts @@ -8,13 +8,11 @@ repositories { } dependencies { - compile(project(":core:compiler.common")) - compile(project(":core:descriptors.jvm")) - compile(project(":core:deserialization")) - compile(project(":compiler:fir:cones")) - compile(project(":compiler:fir:tree")) - compile(project(":compiler:resolution.common")) - compile("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${property("versions.kotlinx-collections-immutable")}") + api(project(":core:compiler.common")) + api(project(":compiler:resolution.common")) + api(project(":compiler:fir:cones")) + api(project(":compiler:fir:tree")) + api(kotlinxCollectionsImmutable()) implementation(project(":core:util.runtime")) compileOnly(project(":kotlin-reflect-api")) diff --git a/compiler/tests-spec/build.gradle.kts b/compiler/tests-spec/build.gradle.kts index 66947ed4c63..4a4af27fdaa 100644 --- a/compiler/tests-spec/build.gradle.kts +++ b/compiler/tests-spec/build.gradle.kts @@ -6,6 +6,9 @@ plugins { dependencies { testCompile(projectTests(":compiler")) Platform[192].orHigher { + testCompileOnly(intellijDep()) { + includeJars("gson", "groovy-all", rootProject = rootProject) + } testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijPluginDep("java")) } diff --git a/libraries/tools/new-project-wizard/build.gradle.kts b/libraries/tools/new-project-wizard/build.gradle.kts index e769beb2b54..f2b780da3bf 100644 --- a/libraries/tools/new-project-wizard/build.gradle.kts +++ b/libraries/tools/new-project-wizard/build.gradle.kts @@ -13,7 +13,7 @@ dependencies { testImplementation(intellijDep()) { includeJars("trove4j") } //needed only for message bundles testImplementation(project(":kotlin-test:kotlin-test-junit")) - implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${property("versions.kotlinx-collections-immutable")}") + implementation(kotlinxCollectionsImmutable()) } sourceSets { diff --git a/prepare/idea-plugin/build.gradle.kts b/prepare/idea-plugin/build.gradle.kts index b5094636b05..8688684b386 100644 --- a/prepare/idea-plugin/build.gradle.kts +++ b/prepare/idea-plugin/build.gradle.kts @@ -166,7 +166,7 @@ dependencies { embedded(protobufFull()) embedded(kotlinBuiltins(forJvm = true)) - libraries(commonDep("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${property("versions.kotlinx-collections-immutable")}")) + libraries(commonDep(kotlinxCollectionsImmutable())) libraries(commonDep("javax.inject")) libraries(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8")) libraries(commonDep("org.jetbrains", "markdown"))