Build reflection classes with gradle: all from main sourceSet
This commit is contained in:
@@ -20,7 +20,7 @@ def annotationsSrc = "${buildDir}/annotations"
|
|||||||
def relocatedCoreSrc = "${buildDir}/core-relocated"
|
def relocatedCoreSrc = "${buildDir}/core-relocated"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
reflectMain {
|
main {
|
||||||
java {
|
java {
|
||||||
srcDir annotationsSrc
|
srcDir annotationsSrc
|
||||||
srcDir "${core}/descriptor.loader.java/src"
|
srcDir "${core}/descriptor.loader.java/src"
|
||||||
@@ -38,13 +38,14 @@ sourceSets {
|
|||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
proguardDeps
|
proguardDeps
|
||||||
|
shadowes
|
||||||
|
compileOnly.extendsFrom(shadowes)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
proguardDeps project(':kotlin-stdlib')
|
proguardDeps project(':kotlin-stdlib')
|
||||||
reflectMainCompileOnly project(':kotlin-stdlib')
|
shadowes 'javax.inject:javax.inject:1'
|
||||||
reflectMainCompile 'javax.inject:javax.inject:1'
|
shadowes files("${depDir}/protobuf-2.6.1-lite.jar")
|
||||||
reflectMainCompile files("${depDir}/protobuf-2.6.1-lite.jar")
|
|
||||||
|
|
||||||
compile project(':kotlin-stdlib')
|
compile project(':kotlin-stdlib')
|
||||||
|
|
||||||
@@ -63,12 +64,12 @@ task copyAnnotations(type: Sync) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
compileReflectMainJava {
|
compileJava {
|
||||||
dependsOn copyAnnotations
|
dependsOn copyAnnotations
|
||||||
// options.compilerArgs.addAll(["-Xlint:unchecked"])
|
// options.compilerArgs.addAll(["-Xlint:unchecked"])
|
||||||
}
|
}
|
||||||
|
|
||||||
compileReflectMainKotlin {
|
compileKotlin {
|
||||||
dependsOn copyAnnotations
|
dependsOn copyAnnotations
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = ["-version",
|
freeCompilerArgs = ["-version",
|
||||||
@@ -84,12 +85,12 @@ kotlin.experimental.coroutines "enable"
|
|||||||
task reflectShadowJar(type: ShadowJar) {
|
task reflectShadowJar(type: ShadowJar) {
|
||||||
classifier = 'shadow'
|
classifier = 'shadow'
|
||||||
version = null
|
version = null
|
||||||
from (sourceSets.reflectMain.output)
|
from (sourceSets.main.output)
|
||||||
from ("${core}/descriptor.loader.java/src") {
|
from ("${core}/descriptor.loader.java/src") {
|
||||||
include 'META-INF/services/**'
|
include 'META-INF/services/**'
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations = [project.configurations.reflectMainRuntime]
|
configurations = [project.configurations.shadowes]
|
||||||
relocate 'org.jetbrains.kotlin', 'kotlin.reflect.jvm.internal.impl'
|
relocate 'org.jetbrains.kotlin', 'kotlin.reflect.jvm.internal.impl'
|
||||||
relocate 'javax.inject', 'kotlin.reflect.jvm.internal.impl.javax.inject'
|
relocate 'javax.inject', 'kotlin.reflect.jvm.internal.impl.javax.inject'
|
||||||
}
|
}
|
||||||
@@ -162,6 +163,10 @@ task relocatedSourcesJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
it.default(file("${buildDir}/libs/${mainArchiveName}")) {
|
||||||
|
builtBy proguard
|
||||||
|
}
|
||||||
|
|
||||||
archives(file("${buildDir}/libs/${mainArchiveName}")) {
|
archives(file("${buildDir}/libs/${mainArchiveName}")) {
|
||||||
name archivesBaseName
|
name archivesBaseName
|
||||||
builtBy proguard
|
builtBy proguard
|
||||||
|
|||||||
Reference in New Issue
Block a user