From 050403d15b89fc82577bcab819ee537842f951c3 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Thu, 12 Oct 2017 14:07:18 +0200 Subject: [PATCH] Use rewriteDeps task on the projects with runtime dependency on embeddable compiler... which are using shaded dependencies --- compiler/compiler-runner/build.gradle.kts | 8 +++- libraries/tools/kotlin-allopen/build.gradle | 16 +------ .../build.gradle.kts | 15 ++---- .../tools/kotlin-gradle-plugin/build.gradle | 2 + libraries/tools/kotlin-noarg/build.gradle | 16 +------ .../kotlin-sam-with-receiver/build.gradle | 16 +------ .../build.gradle.kts | 47 ++----------------- 7 files changed, 24 insertions(+), 96 deletions(-) diff --git a/compiler/compiler-runner/build.gradle.kts b/compiler/compiler-runner/build.gradle.kts index 139b0ff58ee..2a487ae5fa6 100644 --- a/compiler/compiler-runner/build.gradle.kts +++ b/compiler/compiler-runner/build.gradle.kts @@ -1,4 +1,6 @@ +import org.gradle.jvm.tasks.Jar + description = "Compiler runner + daemon client" apply { plugin("kotlin") } @@ -13,6 +15,7 @@ dependencies { compileOnly(project(":compiler:daemon-common")) compile(project(":kotlin-daemon-client")) compileOnly(project(":compiler:util")) + runtime(projectRuntimeJar(":kotlin-compiler-embeddable")) } sourceSets { @@ -20,10 +23,13 @@ sourceSets { "test" {} } -runtimeJar { +val jar: Jar by tasks +jar.apply { from(getSourceSetsFrom(":kotlin-daemon-client")["main"].output.classesDirs) from(getSourceSetsFrom(":compiler:daemon-common")["main"].output.classesDirs) } + +runtimeJar(rewriteDepsToShadedCompiler(jar)) sourcesJar() javadocJar() diff --git a/libraries/tools/kotlin-allopen/build.gradle b/libraries/tools/kotlin-allopen/build.gradle index 0ce41176cbd..11460392f32 100644 --- a/libraries/tools/kotlin-allopen/build.gradle +++ b/libraries/tools/kotlin-allopen/build.gradle @@ -19,28 +19,16 @@ dependencies { compileOnly 'org.jetbrains.kotlin:gradle-api:1.6' } -def originalSrc = "$kotlin_root/plugins/allopen/allopen-cli/src" -//def targetSrc = file("$buildDir/allopen-target-src") -// -//task preprocessSources(type: Copy) { -// from originalSrc -// into targetSrc -// filter { it.replaceAll('(?("shadowJar")) { +val originalJar by task { from(packedJars) from(the().sourceSets.getByName("main").output) } + +runtimeJar(rewriteDepsToShadedCompiler(originalJar)) sourcesJar() javadocJar() diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle b/libraries/tools/kotlin-gradle-plugin/build.gradle index a32636a6141..c3a8c8d4f60 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle @@ -93,6 +93,8 @@ jar { manifestAttributes(manifest, project) } +ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {}) + artifacts { archives sourcesJar archives javadocJar diff --git a/libraries/tools/kotlin-noarg/build.gradle b/libraries/tools/kotlin-noarg/build.gradle index 2792ccab169..9cd87e93131 100644 --- a/libraries/tools/kotlin-noarg/build.gradle +++ b/libraries/tools/kotlin-noarg/build.gradle @@ -25,28 +25,16 @@ dependencies { compileOnly 'org.jetbrains.kotlin:gradle-api:1.6' } -def originalSrc = "$kotlin_root/plugins/noarg/noarg-cli/src" -//def targetSrc = file("$buildDir/noarg-target-src") -// -//task preprocessSources(type: Copy) { -// from originalSrc -// into targetSrc -// filter { it.replaceAll('(? { -// from(originalSrc) -// into(targetSrc) -// filter { it.replace(Regex("(? { dependsOn(prepareEmbeddableSources) } -// tasks.withType { dependsOn(prepareEmbeddableSources) } -//} - sourceSets { - "main" { -// if (System.getProperty("idea.active") == null) { -// java.srcDir(targetSrc) -// resources.srcDir("src").apply { include("META-INF/**", "**/*.properties") } -// } -// else { - projectDefault() -// } - } + "main" { projectDefault() } "test" {} } -runtimeJar { +val jar: Jar by tasks +jar.apply { from(getSourceSetsFrom(":kotlin-android-extensions-runtime")["main"].output.classesDirs) } +runtimeJar(rewriteDepsToShadedCompiler(jar)) sourcesJar() javadocJar()