Build: Use embedded configuration for compiler plugins
This commit is contained in:
@@ -1,15 +1,8 @@
|
|||||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.tasks.SourceSet
|
||||||
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
|
|
||||||
import org.gradle.api.*
|
inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) = SourceSetsBuilder(this).body()
|
||||||
import org.gradle.api.plugins.JavaPluginConvention
|
|
||||||
import org.gradle.api.tasks.*
|
|
||||||
import org.gradle.kotlin.dsl.*
|
|
||||||
import org.gradle.language.jvm.tasks.ProcessResources
|
|
||||||
|
|
||||||
//import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
|
||||||
|
|
||||||
inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) =
|
|
||||||
SourceSetsBuilder(this).body()
|
|
||||||
|
|
||||||
class SourceSetsBuilder(val project: Project) {
|
class SourceSetsBuilder(val project: Project) {
|
||||||
|
|
||||||
@@ -40,23 +33,6 @@ val SourceSet.projectDefault: Project.() -> Unit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: adding KotlinSourceSet dep to the plugin breaks the build unexpectedly, resolve and uncomment
|
|
||||||
//val SourceSet.kotlin: SourceDirectorySet
|
|
||||||
// get() =
|
|
||||||
// (this as HasConvention)
|
|
||||||
// .convention
|
|
||||||
// .getPlugin(KotlinSourceSet::class.java)
|
|
||||||
// .kotlin
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//fun SourceSet.kotlin(action: SourceDirectorySet.() -> Unit) =
|
|
||||||
// kotlin.action()
|
|
||||||
|
|
||||||
fun Project.getSourceSetsFrom(projectPath: String): SourceSetContainer {
|
|
||||||
evaluationDependsOn(projectPath)
|
|
||||||
return project(projectPath).sourceSets
|
|
||||||
}
|
|
||||||
|
|
||||||
val Project.sourceSets: SourceSetContainer
|
val Project.sourceSets: SourceSetContainer
|
||||||
get() = javaPluginConvention().sourceSets
|
get() = javaPluginConvention().sourceSets
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,6 @@ apply plugin: 'jps-compatible'
|
|||||||
configureJvmProject(project)
|
configureJvmProject(project)
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
pill {
|
pill {
|
||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
@@ -25,9 +20,9 @@ dependencies {
|
|||||||
|
|
||||||
testCompile gradleApi()
|
testCompile gradleApi()
|
||||||
testCompile "junit:junit:4.12"
|
testCompile "junit:junit:4.12"
|
||||||
}
|
|
||||||
|
|
||||||
evaluationDependsOn(":kotlin-allopen-compiler-plugin")
|
embedded(project(":kotlin-allopen-compiler-plugin")) { transitive = false }
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(project.compileKotlin.class) {
|
tasks.withType(project.compileKotlin.class) {
|
||||||
kotlinOptions.languageVersion = "1.2"
|
kotlinOptions.languageVersion = "1.2"
|
||||||
@@ -36,8 +31,6 @@ tasks.withType(project.compileKotlin.class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from(project(":kotlin-allopen-compiler-plugin").sourceSets.main.output.classesDirs)
|
|
||||||
from(project(":kotlin-allopen-compiler-plugin").sourceSets.main.output.resourcesDir)
|
|
||||||
manifestAttributes(manifest, project)
|
manifestAttributes(manifest, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ compileJava {
|
|||||||
options.fork = false
|
options.fork = false
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
pill {
|
pill {
|
||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
@@ -31,9 +26,9 @@ dependencies {
|
|||||||
|
|
||||||
testCompile gradleApi()
|
testCompile gradleApi()
|
||||||
testCompile "junit:junit:4.12"
|
testCompile "junit:junit:4.12"
|
||||||
}
|
|
||||||
|
|
||||||
evaluationDependsOn(":kotlin-noarg-compiler-plugin")
|
embedded(project(":kotlin-noarg-compiler-plugin")) { transitive = false }
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(project.compileKotlin.class) {
|
tasks.withType(project.compileKotlin.class) {
|
||||||
kotlinOptions.languageVersion = "1.2"
|
kotlinOptions.languageVersion = "1.2"
|
||||||
@@ -42,8 +37,6 @@ tasks.withType(project.compileKotlin.class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from(project(":kotlin-noarg-compiler-plugin").sourceSets.main.output.classesDirs)
|
|
||||||
from(project(":kotlin-noarg-compiler-plugin").sourceSets.main.output.resourcesDir)
|
|
||||||
manifestAttributes(manifest, project)
|
manifestAttributes(manifest, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ pill {
|
|||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':kotlin-gradle-plugin-api')
|
compile project(':kotlin-gradle-plugin-api')
|
||||||
compile project(':kotlin-gradle-plugin-model')
|
compile project(':kotlin-gradle-plugin-model')
|
||||||
@@ -31,9 +26,9 @@ dependencies {
|
|||||||
|
|
||||||
testCompile gradleApi()
|
testCompile gradleApi()
|
||||||
testCompile "junit:junit:4.12"
|
testCompile "junit:junit:4.12"
|
||||||
}
|
|
||||||
|
|
||||||
evaluationDependsOn(":kotlin-sam-with-receiver-compiler-plugin")
|
embedded(project(":kotlin-sam-with-receiver-compiler-plugin")) { transitive = false }
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(project.compileKotlin.class) {
|
tasks.withType(project.compileKotlin.class) {
|
||||||
kotlinOptions.languageVersion = "1.2"
|
kotlinOptions.languageVersion = "1.2"
|
||||||
@@ -42,8 +37,6 @@ tasks.withType(project.compileKotlin.class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
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)
|
manifestAttributes(manifest, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@ apply plugin: 'kotlin'
|
|||||||
configureJvmProject(project)
|
configureJvmProject(project)
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
|
||||||
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
options.fork = false
|
options.fork = false
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluationDependsOn(":kotlinx-serialization-compiler-plugin")
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.classesDirs)
|
|
||||||
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.resourcesDir)
|
|
||||||
manifestAttributes(manifest, project)
|
manifestAttributes(manifest, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,11 @@ dependencies {
|
|||||||
|
|
||||||
compileOnly kotlinStdlib()
|
compileOnly kotlinStdlib()
|
||||||
compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
||||||
|
|
||||||
|
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluationDependsOn(":kotlinx-serialization-compiler-plugin")
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.classesDirs)
|
|
||||||
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.resourcesDir)
|
|
||||||
manifestAttributes(manifest, project)
|
manifestAttributes(manifest, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ dependencies {
|
|||||||
runtime(projectRuntimeJar(":kotlin-compiler-embeddable"))
|
runtime(projectRuntimeJar(":kotlin-compiler-embeddable"))
|
||||||
compileOnly(commonDep("com.google.android", "android"))
|
compileOnly(commonDep("com.google.android", "android"))
|
||||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||||
|
|
||||||
|
embedded(project(":plugins:android-extensions-compiler")) { isTransitive = false }
|
||||||
|
embedded(project(":kotlin-android-extensions-runtime")) { isTransitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -24,16 +27,12 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jar: Jar by tasks
|
|
||||||
jar.apply {
|
|
||||||
from(getSourceSetsFrom(":plugins:android-extensions-compiler")["main"].output)
|
|
||||||
from(getSourceSetsFrom(":kotlin-android-extensions-runtime")["main"].output)
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
|
||||||
}
|
|
||||||
|
|
||||||
publish()
|
publish()
|
||||||
|
|
||||||
|
val jar: Jar by tasks
|
||||||
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
||||||
|
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
|
|
||||||
javadocJar()
|
javadocJar()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user