[Build] Handle renderDiagnosticNames build property in stdlib and dom-api-compat modules

This commit is contained in:
Dmitriy Novozhilov
2023-10-10 17:40:04 +03:00
committed by Space Team
parent 704e2ef5c5
commit 5602fcdf76
2 changed files with 19 additions and 8 deletions
@@ -36,6 +36,10 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile>().configureEa
"-opt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
) )
val renderDiagnosticNames by extra(project.kotlinBuildProperties.renderDiagnosticNames)
if (renderDiagnosticNames) {
compilerOptions.freeCompilerArgs.add("-Xrender-internal-diagnostic-names")
}
friendPaths.from(libraries) friendPaths.from(libraries)
compilerOptions.allWarningsAsErrors.set(true) compilerOptions.allWarningsAsErrors.set(true)
} }
@@ -61,4 +65,4 @@ publishing {
} }
} }
configureDefaultPublishing() configureDefaultPublishing()
+14 -7
View File
@@ -69,15 +69,19 @@ val commonTestOptIns = listOf(
) )
kotlin { kotlin {
val renderDiagnosticNames by extra(project.kotlinBuildProperties.renderDiagnosticNames)
val diagnosticNamesArg = if (renderDiagnosticNames) "-Xrender-internal-diagnostic-names" else null
metadata { metadata {
compilations { compilations {
all { all {
compileTaskProvider.configure { compileTaskProvider.configure {
kotlinOptions { kotlinOptions {
freeCompilerArgs = listOf( freeCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-module-name", "kotlin-stdlib-common", "-module-name", "kotlin-stdlib-common",
"-Xexpect-actual-classes", "-Xexpect-actual-classes",
diagnosticNamesArg,
) )
} }
// workaround for compiling legacy MPP metadata, remove when this compilation is not needed anymore // workaround for compiling legacy MPP metadata, remove when this compilation is not needed anymore
@@ -93,7 +97,7 @@ kotlin {
val compileOnlyDeclarations by creating { val compileOnlyDeclarations by creating {
compileTaskProvider.configure { compileTaskProvider.configure {
kotlinOptions { kotlinOptions {
freeCompilerArgs = listOf("-Xallow-kotlin-package") freeCompilerArgs = listOfNotNull("-Xallow-kotlin-package", diagnosticNamesArg)
} }
} }
} }
@@ -106,13 +110,14 @@ kotlin {
moduleName = "kotlin-stdlib" moduleName = "kotlin-stdlib"
jvmTarget = "1.8" jvmTarget = "1.8"
// providing exhaustive list of args here // providing exhaustive list of args here
freeCompilerArgs = listOf( freeCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes", "-Xexpect-actual-classes",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xuse-14-inline-classes-mangling-scheme", "-Xuse-14-inline-classes-mangling-scheme",
"-Xbuiltins-from-sources", "-Xbuiltins-from-sources",
"-Xno-new-java-annotation-targets", "-Xno-new-java-annotation-targets",
diagnosticNamesArg,
) )
} }
} }
@@ -130,10 +135,11 @@ kotlin {
kotlinOptions { kotlinOptions {
moduleName = "kotlin-stdlib-jdk7" moduleName = "kotlin-stdlib-jdk7"
jvmTarget = "1.8" jvmTarget = "1.8"
freeCompilerArgs = listOf( freeCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xno-new-java-annotation-targets" "-Xno-new-java-annotation-targets",
diagnosticNamesArg,
) )
} }
} }
@@ -144,10 +150,11 @@ kotlin {
compileTaskProvider.configure { compileTaskProvider.configure {
kotlinOptions { kotlinOptions {
moduleName = "kotlin-stdlib-jdk8" moduleName = "kotlin-stdlib-jdk8"
freeCompilerArgs = listOf( freeCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xno-new-java-annotation-targets" "-Xno-new-java-annotation-targets",
diagnosticNamesArg,
) )
} }
} }