Build compiler, plugin & stdlib with constructor call normalization
Required as a workaround for Proguard bug https://sourceforge.net/p/proguard/bugs/664/ When processing bytecode generated by Kotlin compiler for constructor call with stack spilling during arguments evaluation, ProGuard performs an equivalent transformation for the bytecode, but emits invalid stack frame information. In JVM 1.6, such invalid stack frames are ignored and re-evaluated by JVM during bytecode verification. In JVM 1.8, such invalid stack frames cause VerifyError.
This commit is contained in:
+1
-1
@@ -240,7 +240,7 @@ allprojects {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = kotlinLanguageVersion
|
languageVersion = kotlinLanguageVersion
|
||||||
apiVersion = kotlinLanguageVersion
|
apiVersion = kotlinLanguageVersion
|
||||||
freeCompilerArgs = listOf("-Xallow-kotlin-package")
|
freeCompilerArgs = listOf("-Xallow-kotlin-package", "-Xnormalize-constructor-calls=enable")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ dist {
|
|||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
// TODO: Why "-Xmulti-platfrom" ?
|
// TODO: Why "-Xmulti-platfrom" ?
|
||||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-Xmulti-platform", "-module-name", project.archivesBaseName]
|
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-Xnormalize-constructor-calls=enable",
|
||||||
|
"-Xmulti-platform", "-module-name", project.archivesBaseName]
|
||||||
}
|
}
|
||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ compileKotlin {
|
|||||||
"-version",
|
"-version",
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
"-Xmultifile-parts-inherit",
|
"-Xmultifile-parts-inherit",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json",
|
"-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json",
|
||||||
"-module-name", project.name
|
"-module-name", project.name
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ compileKotlin {
|
|||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
"-Xmultifile-parts-inherit",
|
"-Xmultifile-parts-inherit",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-Xdump-declarations-to", "${buildDir}/stdlib-jre7-declarations.json",
|
"-Xdump-declarations-to", "${buildDir}/stdlib-jre7-declarations.json",
|
||||||
"-module-name", project.name
|
"-module-name", project.name
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ compileKotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
|
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-Xnormalize-constructor-calls=enable"]
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin.experimental.coroutines 'enable'
|
kotlin.experimental.coroutines 'enable'
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def testCasesDeclarationsDump = "${buildDir}/cases-declarations.json".toString()
|
|||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = ["-Xdump-declarations-to=$testCasesDeclarationsDump"]
|
freeCompilerArgs = ["-Xdump-declarations-to=$testCasesDeclarationsDump", "-Xnormalize-constructor-calls=enable"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-module-name", project.name
|
"-module-name", project.name
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ compileKotlin {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = ["-version",
|
freeCompilerArgs = ["-version",
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-module-name", "kotlin-reflection",
|
"-module-name", "kotlin-reflection",
|
||||||
"-Xdump-declarations-to", "${buildDir}/reflect-declarations.json"]
|
"-Xdump-declarations-to", "${buildDir}/reflect-declarations.json"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ compileKotlin {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.1"
|
languageVersion = "1.1"
|
||||||
apiVersion = "1.1"
|
apiVersion = "1.1"
|
||||||
freeCompilerArgs = ["-version"]
|
freeCompilerArgs = ["-version", "-Xnormalize-constructor-calls=enable"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ compileKotlin {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = [
|
freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-Xdump-declarations-to", "${buildDir}/runtime-declarations.json",
|
"-Xdump-declarations-to", "${buildDir}/runtime-declarations.json",
|
||||||
"-cp", "${rootDir}/dist/builtins",
|
"-cp", "${rootDir}/dist/builtins",
|
||||||
"-module-name", project.name
|
"-module-name", project.name
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ dist {
|
|||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
|
"-Xnormalize-constructor-calls=enable",
|
||||||
"-module-name", project.name
|
"-module-name", project.name
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user