Move strip-kotlin-annotations script to buildSrc

... and invoke it directly in kotlin-reflect's build file, instead of
running another instance of compiler to evaluate a script. Also only
strip kotlin.Metadata, since it's the only annotation with heavy
metadata on Kotlin-generated class files
This commit is contained in:
Alexander Udalov
2017-11-07 17:27:54 +01:00
parent 38bee07fd0
commit 208e68a968
7 changed files with 24 additions and 73 deletions
-19
View File
@@ -206,22 +206,3 @@ ext.createPreprocessorTask = { Project project, def name, def sourceDir, def tar
args = [sourceDir, targetDir, profile]
}
}
ext.createScriptTask = { Project project, def name, Closure<JavaExec> configureClosure = null ->
JavaExec task = project.tasks.create(name, JavaExec)
return project.configure(task) {
// dependsOn(rootProject.prepareBootstrap)
classpath = rootProject.configurations.scriptCompile
main = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
args = [
"-script",
"-version",
"-no-stdlib",
"-cp", rootProject.configurations.scriptRuntime.asPath]
if (configureClosure != null) {
configureClosure.delegate = it
configureClosure.call()
}
}
}
+8 -12
View File
@@ -89,11 +89,11 @@ task reflectShadowJar(type: ShadowJar) {
version = null
manifestAttributes(manifest, project, 'Main')
from (sourceSets.main.output)
from ("${core}/descriptors.jvm/src") {
from(sourceSets.main.output)
from(project(":core:descriptors.jvm").sourceSets.main.resources) {
include 'META-INF/services/**'
}
from ("${core}/deserialization/src") {
from(project(":core:deserialization").sourceSets.main.resources) {
include 'META-INF/services/**'
}
@@ -103,19 +103,15 @@ task reflectShadowJar(type: ShadowJar) {
mergeServiceFiles()
}
createScriptTask(project, "stripMetadata") {
task stripMetadata {
dependsOn reflectShadowJar
def inputJar = reflectShadowJar.archivePath
def outputJar = "${libsDir}/kotlin-reflect-stripped.jar"
def outputJar = new File("${libsDir}/kotlin-reflect-stripped.jar")
inputs.file(inputJar)
outputs.file(outputJar)
args += [
"${rootDir}/generators/infrastructure/strip-kotlin-annotations.kts",
"kotlin/Metadata",
"kotlin/reflect/jvm/internal/impl/.*",
inputJar,
outputJar
]
doLast {
StripMetadataKt.stripMetadata(logger, "kotlin/reflect/jvm/internal/impl/.*", inputJar, outputJar)
}
}
def mainArchiveName = "${archivesBaseName}-${project.version}.jar"