Use rewriteDeps task on the projects with runtime dependency on embeddable compiler...

which are using shaded dependencies
This commit is contained in:
Ilya Chernikov
2017-10-12 14:07:18 +02:00
parent fb70227868
commit 050403d15b
7 changed files with 24 additions and 96 deletions
+7 -1
View File
@@ -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()
+2 -14
View File
@@ -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('(?<!\\.)com\\.intellij', 'org.jetbrains.kotlin.com.intellij') }
//}
//sourceSets.main.java.srcDirs += originalSrc
//compileKotlin.dependsOn preprocessSources
evaluationDependsOn(":kotlin-allopen-compiler-plugin")
jar {
// from(originalSrc) { include("META-INF/**") }
from(project(":kotlin-allopen-compiler-plugin").sourceSets.main.output.classesDirs)
from(project(":kotlin-allopen-compiler-plugin").sourceSets.main.output.resourcesDir)
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
artifacts {
archives sourcesJar
archives javadocJar
@@ -2,16 +2,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
description = "Annotation Processor wrapper for Kotlin"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
}
}
apply { plugin("kotlin") }
val packedJars by configurations.creating
@@ -25,16 +15,19 @@ dependencies {
testCompile("com.android.tools.build:gradle:1.1.0")
testCompile(commonDep("junit:junit"))
packedJars(project(":kotlin-annotation-processing")) { isTransitive = false }
runtime(projectRuntimeJar(":kotlin-compiler-embeddable"))
}
projectTest {
workingDir = projectDir
}
runtimeJar(task<ShadowJar>("shadowJar")) {
val originalJar by task<ShadowJar> {
from(packedJars)
from(the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
runtimeJar(rewriteDepsToShadedCompiler(originalJar))
sourcesJar()
javadocJar()
@@ -93,6 +93,8 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
artifacts {
archives sourcesJar
archives javadocJar
+2 -14
View File
@@ -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('(?<!\\.)com\\.intellij', 'org.jetbrains.kotlin.com.intellij') }
//}
//sourceSets.main.java.srcDirs += originalSrc
//compileKotlin.dependsOn preprocessSources
evaluationDependsOn(":kotlin-noarg-compiler-plugin")
jar {
// from(originalSrc) { include("META-INF/**") }
from(project(":kotlin-noarg-compiler-plugin").sourceSets.main.output.classesDirs)
from(project(":kotlin-noarg-compiler-plugin").sourceSets.main.output.resourcesDir)
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
artifacts {
archives sourcesJar
archives javadocJar
@@ -25,28 +25,16 @@ dependencies {
compileOnly 'org.jetbrains.kotlin:gradle-api:1.6'
}
def originalSrc = "$kotlin_root/plugins/sam-with-receiver/sam-with-receiver-cli/src"
//def targetSrc = file("$buildDir/sam-with-receiver-target-src")
//
//task preprocessSources(type: Copy) {
// from originalSrc
// into targetSrc
// filter { it.replaceAll('(?<!\\.)com\\.intellij', 'org.jetbrains.kotlin.com.intellij') }
//}
//sourceSets.main.java.srcDirs += originalSrc
//compileKotlin.dependsOn preprocessSources
evaluationDependsOn(":kotlin-sam-with-receiver-compiler-plugin")
jar {
// from(originalSrc) { include("META-INF/**") }
from(project(":kotlin-sam-with-receiver-compiler-plugin").sourceSets.main.output.classesDirs)
from(project(":kotlin-sam-with-receiver-compiler-plugin").sourceSets.main.output.resourcesDir)
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
artifacts {
archives sourcesJar
archives javadocJar
@@ -1,21 +1,5 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.jvm.tasks.Jar
description = "Kotlin Android Extensions Compiler"
@@ -33,39 +17,18 @@ dependencies {
runtime(commonDep("com.google.android", "android"))
}
//val originalSrc = "$projectDir/src"
//val targetSrc = file("$buildDir/embeddable-target-src")
//
//if (System.getProperty("idea.active") == null) {
//
// val prepareEmbeddableSources by task<Copy> {
// from(originalSrc)
// into(targetSrc)
// filter { it.replace(Regex("(?<!\\.)com\\.intellij"), "org.jetbrains.kotlin.com.intellij") }
// }
//
// tasks.withType<KotlinCompile> { dependsOn(prepareEmbeddableSources) }
// tasks.withType<JavaCompile> { 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()