[K/JS] Remove the ability to run Legacy JS backend from the Gradle Plugin

This commit is contained in:
Artem Kobzar
2023-03-28 12:47:04 +00:00
committed by Space Team
parent ae32eff543
commit c6e4858bc9
53 changed files with 239 additions and 43 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ compileKotlin2Js {
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xforce-deprecated-legacy-compiler-usage"
] ]
kotlinOptions { kotlinOptions {
moduleKind = "umd" moduleKind = "umd"
@@ -29,10 +30,10 @@ compileKotlin2Js {
} }
compileTestKotlin2Js { compileTestKotlin2Js {
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
kotlinOptions { kotlinOptions {
metaInfo = false metaInfo = false
moduleKind = "umd" moduleKind = "umd"
freeCompilerArgs = ["-Xallow-kotlin-package", "-Xforce-deprecated-legacy-compiler-usage"]
} }
} }
+4 -1
View File
@@ -28,7 +28,10 @@ buildDir = "$projectDir/build"
["compileKotlin2Js", "compileTestKotlin2Js"].forEach { ["compileKotlin2Js", "compileTestKotlin2Js"].forEach {
tasks.named(it).configure { tasks.named(it).configure {
kotlinOptions.moduleKind = "commonjs" kotlinOptions {
moduleKind = "commonjs"
freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
} }
} }
+5
View File
@@ -135,6 +135,7 @@ compileKotlin2Js {
"-opt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-XXLanguage:+RangeUntilOperator", "-XXLanguage:+RangeUntilOperator",
"-Xforce-deprecated-legacy-compiler-usage"
] ]
} }
} }
@@ -364,3 +365,7 @@ task runMocha(type: NodeTask, dependsOn: [testClasses, installMocha, ':kotlin-te
} }
test.dependsOn runMocha test.dependsOn runMocha
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -492,6 +492,7 @@ class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) {
|afterEvaluate { |afterEvaluate {
| tasks.named('compileKotlinJs') { | tasks.named('compileKotlinJs') {
| kotlinOptions.outputFile = "${'$'}{project.projectDir}/out/out.js" | kotlinOptions.outputFile = "${'$'}{project.projectDir}/out/out.js"
| kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
| } | }
|} |}
| |
@@ -26,3 +26,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -33,3 +33,7 @@ kotlin {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -41,3 +41,7 @@ publishing {
maven { setUrl("file://${projectDir.absolutePath.replace('\\', '/')}/repo") } maven { setUrl("file://${projectDir.absolutePath.replace('\\', '/')}/repo") }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -54,3 +54,7 @@ publishing {
maven { url "file://${projectDir.absolutePath.replace('\\', '/')}/repo" } maven { url "file://${projectDir.absolutePath.replace('\\', '/')}/repo" }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -28,3 +28,7 @@ if (project.findProperty("mppProjectDependency") == "true") {
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -40,3 +40,7 @@ publishing {
maven { setUrl("${rootProject.buildDir}/repo") } maven { setUrl("${rootProject.buildDir}/repo") }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -58,3 +58,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -87,3 +87,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -94,3 +94,7 @@ publishing {
maven("<localRepo>") maven("<localRepo>")
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -106,3 +106,7 @@ publishing {
maven("<localRepo>") maven("<localRepo>")
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -55,3 +55,7 @@ publishing {
maven("<localRepo>") maven("<localRepo>")
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -41,3 +41,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -27,3 +27,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -36,3 +36,7 @@ publishing {
maven("<localRepo>") maven("<localRepo>")
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -38,3 +38,7 @@ publishing {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -26,6 +26,8 @@ tasks.named("compileKotlinJs", Kotlin2JsCompile) {
it.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js" it.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js"
if (jsUseIrBackend) { if (jsUseIrBackend) {
it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir", "-Xir-only"] it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir", "-Xir-only"]
} else {
it.kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
} }
} }
@@ -33,5 +35,7 @@ tasks.named("compileTestKotlinJs", Kotlin2JsCompile) {
it.kotlinOptions.outputFile = "${buildDir}/kotlin2js/test/module-tests.js" it.kotlinOptions.outputFile = "${buildDir}/kotlin2js/test/module-tests.js"
if (jsUseIrBackend) { if (jsUseIrBackend) {
it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-js"] it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-js"]
} else {
it.kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
} }
} }
@@ -34,3 +34,6 @@ tasks.named("browserTest") {
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack> { tasks.withType<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack> {
dependsOn("foo") dependsOn("foo")
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -17,3 +17,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -68,3 +68,10 @@ rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJ
args("./${project.name}.js") args("./${project.name}.js")
} }
} }
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileKotlinJs") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileTestKotlinJs") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -18,3 +18,10 @@ kotlin {
} }
} }
} }
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileKotlinJsLegacy") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileTestKotlinJsLegacy") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -14,3 +14,10 @@ kotlin {
} }
} }
} }
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileKotlinJs") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
tasks.named<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>("compileTestKotlinJs") {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -28,3 +28,6 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -36,3 +36,6 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -25,3 +25,7 @@ kotlin {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -20,3 +20,10 @@ kotlin {
} }
} }
} }
tasks.named("compileKotlinJs", org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
tasks.named("compileTestKotlinJs", org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -57,3 +57,7 @@ publishing {
maven("$buildDir/repo") maven("$buildDir/repo")
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -65,3 +65,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -20,3 +20,7 @@ kotlin {
binaries.executable() binaries.executable()
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -18,3 +18,7 @@ kotlin {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -26,3 +26,7 @@ kotlin {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -61,4 +61,8 @@ build.doLast {
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
runRhino.dependsOn build runRhino.dependsOn build
@@ -35,6 +35,10 @@ project("lib") {
browser() browser()
} }
} }
tasks.withType<KotlinJsCompile>() {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
} }
project("app") { project("app") {
@@ -49,6 +53,9 @@ project("app") {
} }
tasks.withType<KotlinJsCompile>() { tasks.withType<KotlinJsCompile>() {
kotlinOptions.sourceMap = true kotlinOptions {
sourceMap = true
freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
} }
} }
@@ -36,4 +36,6 @@ if (project.findProperty("kotlin.js.useIrBackend")?.toBoolean() == true) {
compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/" compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/"
} else { } else {
compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js" compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js"
compileKotlin2Js.kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
compileTestKotlin2Js.kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
} }
@@ -43,3 +43,7 @@ publishing {
maven { setUrl("${rootProject.buildDir}/repo") } maven { setUrl("${rootProject.buildDir}/repo") }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -40,3 +40,7 @@ publishing {
maven { setUrl("${rootProject.buildDir}/repo") } maven { setUrl("${rootProject.buildDir}/repo") }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -75,3 +75,7 @@ task printCompilerPluginOptions {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -93,3 +93,7 @@ publishing {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -33,3 +33,8 @@ nodeJsJar {
} }
nodeJsJar.dependsOn(compileKotlinNodeJs) nodeJsJar.dependsOn(compileKotlinNodeJs)
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -42,6 +42,10 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinJsDce).configureEach {
destinationDirectory = project.layout.buildDirectory.dir("kotlin-js-min") destinationDirectory = project.layout.buildDirectory.dir("kotlin-js-min")
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
task runRhino(type: JavaExec) { task runRhino(type: JavaExec) {
dependsOn(tasks.named('processDceBrowserKotlinJs')) dependsOn(tasks.named('processDceBrowserKotlinJs'))
classpath = kotlin.targets.browser.compilations.main.runtimeDependencyFiles classpath = kotlin.targets.browser.compilations.main.runtimeDependencyFiles
@@ -24,3 +24,7 @@ kotlin {
js("server") js("server")
js("client") js("client")
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -92,3 +92,7 @@ task resolveRuntimeDependencies(type: DefaultTask) {
configurations[configName].resolve() configurations[configName].resolve()
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -65,3 +65,7 @@ afterEvaluate {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -121,3 +121,7 @@ afterEvaluate {
} }
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -37,3 +37,7 @@ kotlin.sourceSets {
kotlin.target { kotlin.target {
nodejs() nodejs()
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -16,3 +16,7 @@ kotlin {
nodejs() nodejs()
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -24,3 +24,7 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
@@ -274,10 +274,6 @@ abstract class Kotlin2JsCompile @Inject constructor(
args.friendModules = friendDependencies.files.joinToString(File.pathSeparator) { it.absolutePath } args.friendModules = friendDependencies.files.joinToString(File.pathSeparator) { it.absolutePath }
if (!isIrBackendEnabled()) {
args.forceDeprecatedLegacyCompilerUsage = true
}
logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}") logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}")
val gradlePrintingMessageCollector = GradlePrintingMessageCollector(logger, args.allWarningsAsErrors) val gradlePrintingMessageCollector = GradlePrintingMessageCollector(logger, args.allWarningsAsErrors)
@@ -2,4 +2,4 @@ kotlin.build.gradlePlugin.version=0.0.39
kotlin.options.suppressFreeCompilerArgsModificationWarning=true kotlin.options.suppressFreeCompilerArgsModificationWarning=true
cacheRedirectorEnabled=true cacheRedirectorEnabled=true
# Should be in sync with ":kotlin-daemon-config" project convention script configuration # Should be in sync with ":kotlin-daemon-config" project convention script configuration
kotlin.daemon.jvmargs=-Xmx3g -Dkotlin.js.compiler.legacy.force_enabled=true kotlin.daemon.jvmargs=-Xmx3g
@@ -5,12 +5,7 @@ gradle.afterProject {
plugins.withType<KotlinBasePlugin> { plugins.withType<KotlinBasePlugin> {
tasks.withType<CompileUsingKotlinDaemon>().configureEach { tasks.withType<CompileUsingKotlinDaemon>().configureEach {
// Should be in sync with 'gradle-settings-conventions/gradle.properties' // Should be in sync with 'gradle-settings-conventions/gradle.properties'
kotlinDaemonJvmArguments.set( kotlinDaemonJvmArguments.set(listOf("-Xmx3g"))
listOf(
"-Xmx3g",
"-Dkotlin.js.compiler.legacy.force_enabled=true"
)
)
} }
} }
} }