[Gradle, JS] Deprecate only deprecated properties in compiler arguments copy
This commit is contained in:
committed by
Space Team
parent
d02be30e3b
commit
12cd9c4530
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
@@ -44,12 +44,14 @@ fun copyK2JSCompilerArguments(from: K2JSCompilerArguments, to: K2JSCompilerArgum
|
||||
to.irSafeExternalBooleanDiagnostic = from.irSafeExternalBooleanDiagnostic
|
||||
to.libraries = from.libraries
|
||||
to.main = from.main
|
||||
@Suppress("DEPRECATION")
|
||||
to.metaInfo = from.metaInfo
|
||||
to.moduleKind = from.moduleKind
|
||||
to.moduleName = from.moduleName
|
||||
to.noStdlib = from.noStdlib
|
||||
to.optimizeGeneratedJs = from.optimizeGeneratedJs
|
||||
to.outputDir = from.outputDir
|
||||
@Suppress("DEPRECATION")
|
||||
to.outputFile = from.outputFile
|
||||
to.partialLinkageLogLevel = from.partialLinkageLogLevel
|
||||
to.partialLinkageMode = from.partialLinkageMode
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
+17
-6
@@ -10,10 +10,9 @@ import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.config.JpsPluginSettings
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KClassifier
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
import kotlin.reflect.full.hasAnnotation
|
||||
import kotlin.reflect.full.superclasses
|
||||
|
||||
private val CLASSES_TO_PROCESS: List<KClass<*>> = listOf(
|
||||
@@ -52,7 +51,7 @@ private fun generateRec(
|
||||
withPrinterToFile(destDir.resolve(klassName + "CopyGenerated.kt")) {
|
||||
println(
|
||||
"""
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
@@ -106,12 +105,18 @@ private fun generateRec(
|
||||
val arrayElementType = type.arguments.single().type!!
|
||||
val nullableMarker = if (type.isMarkedNullable) "?" else ""
|
||||
when (arrayElementType.classifier) {
|
||||
String::class -> println("to.${property.name} = from.${property.name}${nullableMarker}.copyOf()")
|
||||
String::class -> {
|
||||
deprecatePropertyIfNecessary(property)
|
||||
println("to.${property.name} = from.${property.name}${nullableMarker}.copyOf()")
|
||||
}
|
||||
else -> error("Unsupported array element type $arrayElementType (member '${property.name}' of $fqn)")
|
||||
}
|
||||
}
|
||||
|
||||
isSupportedImmutable(type) -> println("to.${property.name} = from.${property.name}")
|
||||
isSupportedImmutable(type) -> {
|
||||
deprecatePropertyIfNecessary(property)
|
||||
println("to.${property.name} = from.${property.name}")
|
||||
}
|
||||
|
||||
else -> error("Unsupported type to copy: $type (member '${property.name}' of $fqn)")
|
||||
}
|
||||
@@ -124,6 +129,12 @@ private fun generateRec(
|
||||
}
|
||||
}
|
||||
|
||||
private fun Printer.deprecatePropertyIfNecessary(property: KProperty1<*, *>) {
|
||||
if (property.hasAnnotation<Deprecated>()) {
|
||||
println("@Suppress(\"DEPRECATION\")")
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
generateCompilerArgumentsCopy(::getPrinterToFile)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@file:Suppress("unused", "DuplicatedCode", "DEPRECATION")
|
||||
@file:Suppress("unused", "DuplicatedCode")
|
||||
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateCompilerArgumentsCopy.kt
|
||||
|
||||
Reference in New Issue
Block a user