Introduce Kotlin compiler options with Gradle Properties API types

Old one is deprecated and delegates to new options. All new options
are marked with task input types, so they could be used as `@Nested`
input.

Generated options are using specific types in generated
compiler options. This should simplify code completion and provide
meaningful hints to user.

At this point repository compilation will fail.

^KT-27301 In Progress
This commit is contained in:
Yahor Berdnikau
2022-07-22 16:57:44 +02:00
parent 28dd3d4e71
commit 286d0d56af
47 changed files with 1453 additions and 742 deletions
+1
View File
@@ -14,6 +14,7 @@ dependencies {
compileOnly(intellijCore()) compileOnly(intellijCore())
compileOnly(commonDependency("com.google.guava:guava")) compileOnly(commonDependency("com.google.guava:guava"))
compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all")) compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all"))
compileOnly(project(":kotlin-gradle-compiler-types"))
} }
sourceSets { sourceSets {
@@ -31,7 +31,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
@get:Transient @get:Transient
var autoAdvanceLanguageVersion: Boolean by FreezableVar(true) var autoAdvanceLanguageVersion: Boolean by FreezableVar(true)
@GradleOption(DefaultValues.LanguageVersions::class) @GradleOption(
value = DefaultValues.LanguageVersions::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-language-version", value = "-language-version",
valueDescription = "<version>", valueDescription = "<version>",
@@ -42,7 +45,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
@get:Transient @get:Transient
var autoAdvanceApiVersion: Boolean by FreezableVar(true) var autoAdvanceApiVersion: Boolean by FreezableVar(true)
@GradleOption(DefaultValues.ApiVersions::class) @GradleOption(
value = DefaultValues.ApiVersions::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-api-version", value = "-api-version",
valueDescription = "<version>", valueDescription = "<version>",
@@ -296,7 +302,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
) )
var checkStickyPhaseConditions: Boolean by FreezableVar(false) var checkStickyPhaseConditions: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-Xuse-k2", value = "-Xuse-k2",
deprecatedName = "-Xuse-fir", deprecatedName = "-Xuse-fir",
@@ -38,15 +38,24 @@ abstract class CommonToolArguments : Freezable(), Serializable {
@Argument(value = "-version", description = "Display compiler version") @Argument(value = "-version", description = "Display compiler version")
var version: Boolean by FreezableVar(false) var version: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INTERNAL
)
@Argument(value = "-verbose", description = "Enable verbose logging output") @Argument(value = "-verbose", description = "Enable verbose logging output")
var verbose: Boolean by FreezableVar(false) var verbose: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INTERNAL
)
@Argument(value = "-nowarn", description = "Generate no warnings") @Argument(value = "-nowarn", description = "Generate no warnings")
var suppressWarnings: Boolean by FreezableVar(false) var suppressWarnings: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-Werror", description = "Report an error if there are any warnings") @Argument(value = "-Werror", description = "Report an error if there are any warnings")
var allWarningsAsErrors: Boolean by FreezableVar(false) var allWarningsAsErrors: Boolean by FreezableVar(false)
@@ -10,57 +10,124 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL
import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.JvmTarget import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion as KotlinVersionDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget as JvmTargetDsl
import kotlin.reflect.KType
import kotlin.reflect.typeOf
open class DefaultValues(val defaultValue: String, val possibleValues: List<String>? = null) { open class DefaultValues(
object BooleanFalseDefault : DefaultValues("false") val defaultValue: String,
val type: KType,
val kotlinOptionsType: KType,
val possibleValues: List<String>? = null,
val fromKotlinOptionConverterProp: String? = null,
val toKotlinOptionConverterProp: String? = null,
val toArgumentConverter: String? = toKotlinOptionConverterProp
) {
open class DefaultBoolean(defaultValue: Boolean) : DefaultValues(defaultValue.toString(), typeOf<Boolean>(), typeOf<Boolean>())
object BooleanTrueDefault : DefaultValues("true") object BooleanFalseDefault : DefaultBoolean(false)
object StringNullDefault : DefaultValues("null") object BooleanTrueDefault : DefaultBoolean(true)
object ListEmptyDefault : DefaultValues("<empty list>") object StringNullDefault : DefaultValues("null", typeOf<String?>(), typeOf<String?>())
object EmptyStringListDefault : DefaultValues("emptyList<String>()", typeOf<List<String>>(), typeOf<List<String>>())
object LanguageVersions : DefaultValues( object LanguageVersions : DefaultValues(
"null", "null",
LanguageVersion.values() typeOf<KotlinVersionDsl?>(),
typeOf<String?>(),
possibleValues = LanguageVersion.values()
.filterNot { it.isUnsupported } .filterNot { it.isUnsupported }
.map { "\"${it.description}\"" } .map { "\"${it.description}\"" },
fromKotlinOptionConverterProp = """
if (this != null) ${typeOf<KotlinVersionDsl>()}.fromVersion(this) else null
""".trimIndent(),
toKotlinOptionConverterProp = """
this?.version
""".trimIndent()
) )
object ApiVersions : DefaultValues( object ApiVersions : DefaultValues(
"null", "null",
LanguageVersion.values() typeOf<KotlinVersionDsl?>(),
typeOf<String?>(),
possibleValues = LanguageVersion.values()
.map(ApiVersion.Companion::createByLanguageVersion) .map(ApiVersion.Companion::createByLanguageVersion)
.filterNot { it.isUnsupported } .filterNot { it.isUnsupported }
.map { "\"${it.description}\"" } .map { "\"${it.description}\"" },
fromKotlinOptionConverterProp = """
if (this != null) ${typeOf<KotlinVersionDsl>()}.fromVersion(this) else null
""".trimIndent(),
toKotlinOptionConverterProp = """
this?.version
""".trimIndent()
) )
object JvmTargetVersions : DefaultValues( object JvmTargetVersions : DefaultValues(
"null", "null",
JvmTarget.supportedValues().map { "\"${it.description}\"" } typeOf<JvmTargetDsl?>(),
typeOf<String?>(),
possibleValues = JvmTarget.supportedValues().map { "\"${it.description}\"" },
fromKotlinOptionConverterProp = """
if (this != null) ${typeOf<JvmTargetDsl>()}.fromTarget(this) else null
""".trimIndent(),
toKotlinOptionConverterProp = """
this?.target
""".trimIndent()
) )
object JsEcmaVersions : DefaultValues( object JsEcmaVersions : DefaultValues(
"\"v5\"", "\"v5\"",
listOf("\"v5\"") typeOf<String>(),
typeOf<String>(),
possibleValues = listOf("\"v5\"")
) )
object JsModuleKinds : DefaultValues( object JsModuleKinds : DefaultValues(
"\"plain\"", "${typeOf<JsModuleKind>()}.${JsModuleKind.MODULE_PLAIN.name}",
listOf("\"plain\"", "\"amd\"", "\"commonjs\"", "\"umd\"") typeOf<JsModuleKind>(),
typeOf<String>(),
possibleValues = listOf("\"plain\"", "\"amd\"", "\"commonjs\"", "\"umd\""),
fromKotlinOptionConverterProp = """
${typeOf<JsModuleKind>()}.fromKind(this)
""".trimIndent(),
toKotlinOptionConverterProp = """
this.kind
""".trimIndent()
) )
object JsSourceMapContentModes : DefaultValues( object JsSourceMapContentModes : DefaultValues(
"null", "null",
listOf( typeOf<JsSourceMapEmbedMode?>(),
typeOf<String?>(),
possibleValues = listOf(
K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER,
K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS,
K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING
).map { "\"$it\"" } ).map { "\"$it\"" },
fromKotlinOptionConverterProp = """
this?.let { ${typeOf<JsSourceMapEmbedMode>()}.fromMode(it) }
""".trimIndent(),
toKotlinOptionConverterProp = """
this?.mode
""".trimIndent()
) )
object JsMain : DefaultValues( object JsMain : DefaultValues(
"\"" + CALL + "\"", "${typeOf<JsMainFunctionExecutionMode>()}.${JsMainFunctionExecutionMode.CALL.name}",
listOf("\"" + CALL + "\"", "\"" + NO_CALL + "\"") typeOf<JsMainFunctionExecutionMode>(),
typeOf<String>(),
possibleValues = listOf("\"" + CALL + "\"", "\"" + NO_CALL + "\""),
fromKotlinOptionConverterProp = """
${typeOf<JsMainFunctionExecutionMode>()}.fromMode(this)
""".trimIndent(),
toKotlinOptionConverterProp = """
this.mode
""".trimIndent()
) )
} }
@@ -19,8 +19,18 @@ package org.jetbrains.kotlin.cli.common.arguments
import kotlin.reflect.KClass import kotlin.reflect.KClass
import kotlin.reflect.KVisibility import kotlin.reflect.KVisibility
/**
* @param gradleInputType should be one of [GradleInputTypes] constants
*/
@Retention(AnnotationRetention.RUNTIME) @Retention(AnnotationRetention.RUNTIME)
annotation class GradleOption( annotation class GradleOption(
val value: KClass<out DefaultValues> = DefaultValues::class, val value: KClass<out DefaultValues>,
val backingFieldVisibility: KVisibility = KVisibility.PRIVATE val gradleInputType: String
) )
// Enum class here is not possible due to bug in K2 compiler:
// https://youtrack.jetbrains.com/issue/KT-54079
object GradleInputTypes {
const val INPUT = "org.gradle.api.tasks.Input"
const val INTERNAL = "org.gradle.api.tasks.Internal"
}
@@ -16,11 +16,22 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@JvmStatic private val serialVersionUID = 0L @JvmStatic private val serialVersionUID = 0L
} }
@GradleOption(DefaultValues.StringNullDefault::class) @GradleOption(
value = DefaultValues.StringNullDefault::class,
gradleInputType = GradleInputTypes.INTERNAL // handled by task 'outputFileProperty'
)
@GradleDeprecatedOption(
message = "Use task 'outputFileProperty' to specify location",
level = DeprecationLevel.WARNING,
removeAfter = "1.9.0"
)
@Argument(value = "-output", valueDescription = "<filepath>", description = "Destination *.js file for the compilation result") @Argument(value = "-output", valueDescription = "<filepath>", description = "Destination *.js file for the compilation result")
var outputFile: String? by NullableStringFreezableVar(null) var outputFile: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.BooleanTrueDefault::class) @GradleOption(
value = DefaultValues.BooleanTrueDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-no-stdlib", description = "Don't automatically include the default Kotlin/JS stdlib into compilation dependencies") @Argument(value = "-no-stdlib", description = "Don't automatically include the default Kotlin/JS stdlib into compilation dependencies")
var noStdlib: Boolean by FreezableVar(false) var noStdlib: Boolean by FreezableVar(false)
@@ -38,11 +49,17 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
) )
var repositries: String? by NullableStringFreezableVar(null) var repositries: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-source-map", description = "Generate source map") @Argument(value = "-source-map", description = "Generate source map")
var sourceMap: Boolean by FreezableVar(false) var sourceMap: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.StringNullDefault::class) @GradleOption(
value = DefaultValues.StringNullDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-source-map-prefix", description = "Add the specified prefix to paths in the source map") @Argument(value = "-source-map-prefix", description = "Add the specified prefix to paths in the source map")
var sourceMapPrefix: String? by NullableStringFreezableVar(null) var sourceMapPrefix: String? by NullableStringFreezableVar(null)
@@ -58,7 +75,10 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
* SourceMapEmbedSources should be null by default, since it has effect only when source maps are enabled. * SourceMapEmbedSources should be null by default, since it has effect only when source maps are enabled.
* When sourceMapEmbedSources are not null and source maps is disabled warning is reported. * When sourceMapEmbedSources are not null and source maps is disabled warning is reported.
*/ */
@GradleOption(DefaultValues.JsSourceMapContentModes::class) @GradleOption(
value = DefaultValues.JsSourceMapContentModes::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-source-map-embed-sources", value = "-source-map-embed-sources",
valueDescription = "{always|never|inlining}", valueDescription = "{always|never|inlining}",
@@ -66,15 +86,24 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
) )
var sourceMapEmbedSources: String? by NullableStringFreezableVar(null) var sourceMapEmbedSources: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.BooleanTrueDefault::class) @GradleOption(
value = DefaultValues.BooleanTrueDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-meta-info", description = "Generate .meta.js and .kjsm files with metadata. Use to create a library") @Argument(value = "-meta-info", description = "Generate .meta.js and .kjsm files with metadata. Use to create a library")
var metaInfo: Boolean by FreezableVar(false) var metaInfo: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.JsEcmaVersions::class) @GradleOption(
value = DefaultValues.JsEcmaVersions::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-target", valueDescription = "{ v5 }", description = "Generate JS files for specific ECMA version") @Argument(value = "-target", valueDescription = "{ v5 }", description = "Generate JS files for specific ECMA version")
var target: String? by NullableStringFreezableVar(null) var target: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.JsModuleKinds::class) @GradleOption(
value = DefaultValues.JsModuleKinds::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-module-kind", value = "-module-kind",
valueDescription = "{plain|amd|commonjs|umd}", valueDescription = "{plain|amd|commonjs|umd}",
@@ -82,7 +111,10 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
) )
var moduleKind: String? by NullableStringFreezableVar(K2JsArgumentConstants.MODULE_PLAIN) var moduleKind: String? by NullableStringFreezableVar(K2JsArgumentConstants.MODULE_PLAIN)
@GradleOption(DefaultValues.JsMain::class) @GradleOption(
value = DefaultValues.JsMain::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-main", value = "-main",
valueDescription = "{$CALL|$NO_CALL}", valueDescription = "{$CALL|$NO_CALL}",
@@ -207,18 +239,23 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
) )
var generateDts: Boolean by FreezableVar(false) var generateDts: Boolean by FreezableVar(false)
@Argument( @Argument(
value = "-Xstrict-implicit-export-types", value = "-Xstrict-implicit-export-types",
description = "Generate strict types for implicitly exported entities inside d.ts files. Available in IR backend only." description = "Generate strict types for implicitly exported entities inside d.ts files. Available in IR backend only."
) )
var strictImplicitExportType: Boolean by FreezableVar(false) var strictImplicitExportType: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanTrueDefault::class) @GradleOption(
value = DefaultValues.BooleanTrueDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-Xtyped-arrays", description = "Translate primitive arrays to JS typed arrays") @Argument(value = "-Xtyped-arrays", description = "Translate primitive arrays to JS typed arrays")
var typedArrays: Boolean by FreezableVar(true) var typedArrays: Boolean by FreezableVar(true)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-Xfriend-modules-disabled", description = "Disable internal declaration export") @Argument(value = "-Xfriend-modules-disabled", description = "Disable internal declaration export")
var friendModulesDisabled: Boolean by FreezableVar(false) var friendModulesDisabled: Boolean by FreezableVar(false)
@@ -13,12 +13,20 @@ class K2JSDceArguments : CommonToolArguments() {
@JvmStatic private val serialVersionUID = 0L @JvmStatic private val serialVersionUID = 0L
} }
@GradleOption(
value = DefaultValues.StringNullDefault::class,
gradleInputType = GradleInputTypes.INTERNAL // handled by 'destinationDirectory'
)
@GradleDeprecatedOption(
message = "Use task 'destinationDirectory' to configure output directory",
level = DeprecationLevel.WARNING,
removeAfter = "1.9.0"
)
@Argument( @Argument(
value = "-output-dir", value = "-output-dir",
valueDescription = "<path>", valueDescription = "<path>",
description = "Output directory" description = "Output directory"
) )
@GradleOption(DefaultValues.StringNullDefault::class)
var outputDirectory: String? by NullableStringFreezableVar(null) var outputDirectory: String? by NullableStringFreezableVar(null)
@Argument( @Argument(
@@ -34,11 +42,14 @@ class K2JSDceArguments : CommonToolArguments() {
) )
var printReachabilityInfo: Boolean by FreezableVar(false) var printReachabilityInfo: Boolean by FreezableVar(false)
@GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument( @Argument(
value = "-dev-mode", value = "-dev-mode",
description = "Development mode: don't strip out any code, just copy dependencies" description = "Development mode: don't strip out any code, just copy dependencies"
) )
@GradleOption(DefaultValues.BooleanFalseDefault::class)
var devMode: Boolean by FreezableVar(false) var devMode: Boolean by FreezableVar(false)
@Argument( @Argument(
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.cli.common.arguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.config.*
import kotlin.reflect.KVisibility
class K2JVMCompilerArguments : CommonCompilerArguments() { class K2JVMCompilerArguments : CommonCompilerArguments() {
companion object { companion object {
@@ -37,7 +36,10 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
) )
var jdkHome: String? by NullableStringFreezableVar(null) var jdkHome: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath") @Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
var noJdk: Boolean by FreezableVar(false) var noJdk: Boolean by FreezableVar(false)
@@ -64,13 +66,16 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
) )
var scriptTemplates: Array<String>? by FreezableVar(null) var scriptTemplates: Array<String>? by FreezableVar(null)
@GradleOption(DefaultValues.StringNullDefault::class) @GradleOption(
value = DefaultValues.StringNullDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-module-name", valueDescription = "<name>", description = "Name of the generated .kotlin_module file") @Argument(value = "-module-name", valueDescription = "<name>", description = "Name of the generated .kotlin_module file")
var moduleName: String? by NullableStringFreezableVar(null) var moduleName: String? by NullableStringFreezableVar(null)
@GradleOption( @GradleOption(
value = DefaultValues.JvmTargetVersions::class, value = DefaultValues.JvmTargetVersions::class,
backingFieldVisibility = KVisibility.INTERNAL gradleInputType = GradleInputTypes.INPUT
) )
@Argument( @Argument(
value = "-jvm-target", value = "-jvm-target",
@@ -79,7 +84,10 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
) )
var jvmTarget: String? by NullableStringFreezableVar(null) var jvmTarget: String? by NullableStringFreezableVar(null)
@GradleOption(DefaultValues.BooleanFalseDefault::class) @GradleOption(
value = DefaultValues.BooleanFalseDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "-java-parameters", description = "Generate metadata for Java 1.8 reflection on method parameters") @Argument(value = "-java-parameters", description = "Generate metadata for Java 1.8 reflection on method parameters")
var javaParameters: Boolean by FreezableVar(false) var javaParameters: Boolean by FreezableVar(false)
@@ -11,149 +11,110 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.Printer
import java.io.File import java.io.File
import java.io.PrintStream import java.io.PrintStream
import java.util.*
import kotlin.reflect.KAnnotatedElement import kotlin.reflect.KAnnotatedElement
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1 import kotlin.reflect.KProperty1
import kotlin.reflect.KVisibility
import kotlin.reflect.full.declaredMemberProperties import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.full.withNullability import kotlin.reflect.full.withNullability
// Additional properties that should be included in interface // Additional properties that should be included in interface
@Suppress("unused") @Suppress("unused")
interface AdditionalGradleProperties { interface AdditionalGradleProperties {
@GradleOption(EmptyList::class) @GradleOption(
value = DefaultValues.EmptyStringListDefault::class,
gradleInputType = GradleInputTypes.INPUT
)
@Argument(value = "", description = "A list of additional compiler arguments") @Argument(value = "", description = "A list of additional compiler arguments")
var freeCompilerArgs: List<String> var freeCompilerArgs: List<String>
object EmptyList : DefaultValues("emptyList()")
} }
private data class GeneratedOptions(
val optionsName: FqName,
val deprecatedOptionsName: FqName,
val properties: List<KProperty1<*, *>>
)
private const val GRADLE_API_SRC_DIR = "libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin"
private const val GRADLE_PLUGIN_SRC_DIR = "libraries/tools/kotlin-gradle-plugin/src/common/kotlin"
private const val OPTIONS_PACKAGE_PREFIX = "org.jetbrains.kotlin.gradle.dsl"
private const val IMPLEMENTATION_SUFFIX = "Default"
fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit) { fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit) {
val apiSrcDir = File("libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin") val apiSrcDir = File(GRADLE_API_SRC_DIR)
val srcDir = File("libraries/tools/kotlin-gradle-plugin/src/common/kotlin") val srcDir = File(GRADLE_PLUGIN_SRC_DIR)
// common interface val commonToolOptions = generateKotlinCommonToolOptions(apiSrcDir, withPrinterToFile)
val commonInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions") val commonToolImplFqName = generateKotlinCommonToolOptionsImpl(
val commonOptions = gradleOptions<CommonToolArguments>() srcDir,
val additionalOptions = gradleOptions<AdditionalGradleProperties>() commonToolOptions.optionsName,
withPrinterToFile(file(apiSrcDir, commonInterfaceFqName)) { commonToolOptions.properties,
generateInterface( withPrinterToFile
commonInterfaceFqName, )
commonOptions + additionalOptions
)
}
println("### Attributes common for JVM, JS, and JS DCE\n") val commonCompilerOptions = generateKotlinCommonOptions(
generateMarkdown(commonOptions + additionalOptions) apiSrcDir,
commonToolOptions,
withPrinterToFile
)
val commonCompilerOptionsImplFqName = generateKotlinCommonOptionsImpl(
srcDir,
commonCompilerOptions.optionsName,
commonToolImplFqName,
commonCompilerOptions.properties,
withPrinterToFile
)
val commonCompilerInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions") val jvmOptions = generateKotlinJvmOptions(
val commonCompilerOptions = gradleOptions<CommonCompilerArguments>() apiSrcDir,
withPrinterToFile(file(apiSrcDir, commonCompilerInterfaceFqName)) { commonCompilerOptions,
generateInterface( withPrinterToFile
commonCompilerInterfaceFqName, )
commonCompilerOptions, generateKotlinJvmOptionsImpl(
parentType = commonInterfaceFqName srcDir,
) jvmOptions.optionsName,
} commonCompilerOptionsImplFqName,
jvmOptions.properties,
withPrinterToFile
)
println("\n### Attributes common for JVM and JS\n") val jsOptions = generateKotlinJsOptions(
generateMarkdown(commonCompilerOptions) apiSrcDir,
commonCompilerOptions,
withPrinterToFile
)
generateKotlinJsOptionsImpl(
srcDir,
jsOptions.optionsName,
commonCompilerOptionsImplFqName,
jsOptions.properties,
withPrinterToFile
)
// generate jvm interface val jsDceOptions = generateJsDceOptions(
val jvmInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions") apiSrcDir,
val jvmOptions = gradleOptions<K2JVMCompilerArguments>() commonToolOptions,
withPrinterToFile(file(apiSrcDir, jvmInterfaceFqName)) { withPrinterToFile
generateInterface( )
jvmInterfaceFqName, generateJsDceOptionsImpl(
jvmOptions, srcDir,
parentType = commonCompilerInterfaceFqName jsDceOptions.optionsName,
) commonCompilerOptionsImplFqName,
} jsDceOptions.properties,
withPrinterToFile
// generate jvm impl )
val k2JvmCompilerArgumentsFqName = FqName(K2JVMCompilerArguments::class.qualifiedName!!)
val jvmImplFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsBase")
withPrinterToFile(file(srcDir, jvmImplFqName)) {
generateImpl(
jvmImplFqName,
jvmInterfaceFqName,
k2JvmCompilerArgumentsFqName,
commonOptions + commonCompilerOptions + jvmOptions
)
}
println("\n### Attributes specific for JVM\n")
generateMarkdown(jvmOptions)
// generate js interface
val jsInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions")
val jsOptions = gradleOptions<K2JSCompilerArguments>()
withPrinterToFile(file(apiSrcDir, jsInterfaceFqName)) {
generateInterface(
jsInterfaceFqName,
jsOptions,
parentType = commonCompilerInterfaceFqName
)
}
val k2JsCompilerArgumentsFqName = FqName(K2JSCompilerArguments::class.qualifiedName!!)
val jsImplFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsOptionsBase")
withPrinterToFile(file(srcDir, jsImplFqName)) {
generateImpl(
jsImplFqName,
jsInterfaceFqName,
k2JsCompilerArgumentsFqName,
commonOptions + commonCompilerOptions + jsOptions
)
}
println("\n### Attributes specific for JS\n")
generateMarkdown(jsOptions)
// generate JS DCE interface and implementation
val jsDceInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsDceOptions")
val jsDceOptions = gradleOptions<K2JSDceArguments>()
withPrinterToFile(file(apiSrcDir, jsDceInterfaceFqName)) {
generateInterface(
jsDceInterfaceFqName,
jsDceOptions,
parentType = commonInterfaceFqName
)
}
val k2JsDceArgumentsFqName = FqName(K2JSDceArguments::class.qualifiedName!!)
val jsDceImplFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsDceOptionsBase")
withPrinterToFile(file(srcDir, jsDceImplFqName)) {
generateImpl(
jsDceImplFqName,
jsDceInterfaceFqName,
k2JsDceArgumentsFqName,
commonOptions + jsDceOptions
)
}
// generate multiplatform common interface and implementation
val multiplatformCommonInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonOptions")
val multiplatformCommonOptions = gradleOptions<K2MetadataCompilerArguments>()
withPrinterToFile(file(srcDir, multiplatformCommonInterfaceFqName)) {
generateInterface(
multiplatformCommonInterfaceFqName,
multiplatformCommonOptions,
parentType = commonCompilerInterfaceFqName
)
}
val k2metadataCompilerArgumentsFqName = FqName(K2MetadataCompilerArguments::class.qualifiedName!!)
val multiplatformCommonImplFqName = FqName(multiplatformCommonInterfaceFqName.asString() + "Base")
withPrinterToFile(file(srcDir, multiplatformCommonImplFqName)) {
generateImpl(
multiplatformCommonImplFqName,
multiplatformCommonInterfaceFqName,
k2metadataCompilerArgumentsFqName,
commonOptions + commonCompilerOptions + multiplatformCommonOptions
)
}
val multiplatformCommonOptions = generateMultiplatformCommonOptions(
apiSrcDir,
commonCompilerOptions,
withPrinterToFile
)
generateMultiplatformCommonOptionsImpl(
srcDir,
multiplatformCommonOptions.optionsName,
commonCompilerOptionsImplFqName,
multiplatformCommonOptions.properties,
withPrinterToFile
)
} }
fun main() { fun main() {
@@ -171,6 +132,314 @@ fun main() {
generateKotlinGradleOptions(::getPrinter) generateKotlinGradleOptions(::getPrinter)
} }
private fun generateKotlinCommonToolOptions(
apiSrcDir: File,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val commonInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerCommonToolOptions")
val commonOptions = gradleOptions<CommonToolArguments>()
val additionalOptions = gradleOptions<AdditionalGradleProperties>()
withPrinterToFile(fileFromFqName(apiSrcDir, commonInterfaceFqName)) {
generateInterface(
commonInterfaceFqName,
commonOptions + additionalOptions
)
}
val deprecatedCommonInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinCommonToolOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedCommonInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedCommonInterfaceFqName,
commonInterfaceFqName,
commonOptions + additionalOptions,
parentType = null,
)
}
println("### Attributes common for JVM, JS, and JS DCE\n")
generateMarkdown(commonOptions + additionalOptions)
return GeneratedOptions(commonInterfaceFqName, deprecatedCommonInterfaceFqName, (commonOptions + additionalOptions))
}
private fun generateKotlinCommonToolOptionsImpl(
srcDir: File,
commonToolOptionsInterfaceFqName: FqName,
options: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): FqName {
val k2CommonToolCompilerArgumentsFqName = FqName(CommonToolArguments::class.qualifiedName!!)
val commonToolImplFqName = FqName("${commonToolOptionsInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, commonToolImplFqName)) {
generateImpl(
commonToolImplFqName,
null,
commonToolOptionsInterfaceFqName,
k2CommonToolCompilerArgumentsFqName,
options,
)
}
return commonToolImplFqName
}
private fun generateKotlinCommonOptions(
apiSrcDir: File,
commonToolGeneratedOptions: GeneratedOptions,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val commonCompilerInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerCommonOptions")
val commonCompilerOptions = gradleOptions<CommonCompilerArguments>()
withPrinterToFile(fileFromFqName(apiSrcDir, commonCompilerInterfaceFqName)) {
generateInterface(
commonCompilerInterfaceFqName,
commonCompilerOptions,
parentType = commonToolGeneratedOptions.optionsName,
)
}
val deprecatedCommonCompilerInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinCommonOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedCommonCompilerInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedCommonCompilerInterfaceFqName,
commonCompilerInterfaceFqName,
commonCompilerOptions,
parentType = commonToolGeneratedOptions.deprecatedOptionsName
)
}
println("\n### Attributes common for JVM and JS\n")
generateMarkdown(commonCompilerOptions)
return GeneratedOptions(commonCompilerInterfaceFqName, deprecatedCommonCompilerInterfaceFqName, commonCompilerOptions)
}
private fun generateKotlinCommonOptionsImpl(
srcDir: File,
commonOptionsInterfaceFqName: FqName,
commonToolImpl: FqName,
options: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): FqName {
val k2CommonCompilerArgumentsFqName = FqName(CommonCompilerArguments::class.qualifiedName!!)
val commonCompilerImplFqName = FqName("${commonOptionsInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, commonCompilerImplFqName)) {
generateImpl(
commonCompilerImplFqName,
commonToolImpl,
commonOptionsInterfaceFqName,
k2CommonCompilerArgumentsFqName,
options,
)
}
return commonCompilerImplFqName
}
private fun generateKotlinJvmOptions(
apiSrcDir: File,
commonCompilerGeneratedOptions: GeneratedOptions,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val jvmInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerJvmOptions")
val jvmOptions = gradleOptions<K2JVMCompilerArguments>()
withPrinterToFile(fileFromFqName(apiSrcDir, jvmInterfaceFqName)) {
generateInterface(
jvmInterfaceFqName,
jvmOptions,
parentType = commonCompilerGeneratedOptions.optionsName,
)
}
val deprecatedJvmInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinJvmOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedJvmInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedJvmInterfaceFqName,
jvmInterfaceFqName,
jvmOptions,
parentType = commonCompilerGeneratedOptions.deprecatedOptionsName
)
}
println("\n### Attributes specific for JVM\n")
generateMarkdown(jvmOptions)
return GeneratedOptions(jvmInterfaceFqName, deprecatedJvmInterfaceFqName, jvmOptions)
}
private fun generateKotlinJvmOptionsImpl(
srcDir: File,
jvmInterfaceFqName: FqName,
commonCompilerImpl: FqName,
jvmOptions: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
) {
val k2JvmCompilerArgumentsFqName = FqName(K2JVMCompilerArguments::class.qualifiedName!!)
val jvmImplFqName = FqName("${jvmInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, jvmImplFqName)) {
generateImpl(
jvmImplFqName,
commonCompilerImpl,
jvmInterfaceFqName,
k2JvmCompilerArgumentsFqName,
jvmOptions
)
}
}
private fun generateKotlinJsOptions(
apiSrcDir: File,
commonCompilerOptions: GeneratedOptions,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val jsInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerJsOptions")
val jsOptions = gradleOptions<K2JSCompilerArguments>()
withPrinterToFile(fileFromFqName(apiSrcDir, jsInterfaceFqName)) {
generateInterface(
jsInterfaceFqName,
jsOptions,
parentType = commonCompilerOptions.optionsName,
)
}
val deprecatedJsInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinJsOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedJsInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedJsInterfaceFqName,
jsInterfaceFqName,
jsOptions,
parentType = commonCompilerOptions.deprecatedOptionsName,
)
}
println("\n### Attributes specific for JS\n")
generateMarkdown(jsOptions)
return GeneratedOptions(jsInterfaceFqName, deprecatedJsInterfaceFqName, jsOptions)
}
private fun generateKotlinJsOptionsImpl(
srcDir: File,
jsInterfaceFqName: FqName,
commonCompilerImpl: FqName,
jsOptions: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
) {
val k2JsCompilerArgumentsFqName = FqName(K2JSCompilerArguments::class.qualifiedName!!)
val jsImplFqName = FqName("${jsInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, jsImplFqName)) {
generateImpl(
jsImplFqName,
commonCompilerImpl,
jsInterfaceFqName,
k2JsCompilerArgumentsFqName,
jsOptions
)
}
}
private fun generateJsDceOptions(
apiSrcDir: File,
commonToolOptions: GeneratedOptions,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val jsDceInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerJsDceOptions")
val jsDceOptions = gradleOptions<K2JSDceArguments>()
withPrinterToFile(fileFromFqName(apiSrcDir, jsDceInterfaceFqName)) {
generateInterface(
jsDceInterfaceFqName,
jsDceOptions,
parentType = commonToolOptions.optionsName,
)
}
val deprecatedJsDceInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinJsDceOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedJsDceInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedJsDceInterfaceFqName,
jsDceInterfaceFqName,
jsDceOptions,
parentType = commonToolOptions.deprecatedOptionsName,
)
}
println("\n### Attributes specific for JS/DCE\n")
generateMarkdown(jsDceOptions)
return GeneratedOptions(jsDceInterfaceFqName, deprecatedJsDceInterfaceFqName, jsDceOptions)
}
private fun generateJsDceOptionsImpl(
srcDir: File,
jsDceInterfaceFqName: FqName,
commonCompilerImpl: FqName,
jsDceOptions: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
) {
val k2JsDceArgumentsFqName = FqName(K2JSDceArguments::class.qualifiedName!!)
val jsDceImplFqName = FqName("${jsDceInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, jsDceImplFqName)) {
generateImpl(
jsDceImplFqName,
commonCompilerImpl,
jsDceInterfaceFqName,
k2JsDceArgumentsFqName,
jsDceOptions
)
}
}
private fun generateMultiplatformCommonOptions(
apiSrcDir: File,
commonCompilerOptions: GeneratedOptions,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
): GeneratedOptions {
val multiplatformCommonInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.CompilerMultiplatformCommonOptions")
val multiplatformCommonOptions = gradleOptions<K2MetadataCompilerArguments>()
withPrinterToFile(fileFromFqName(apiSrcDir, multiplatformCommonInterfaceFqName)) {
generateInterface(
multiplatformCommonInterfaceFqName,
multiplatformCommonOptions,
parentType = commonCompilerOptions.optionsName,
)
}
val deprecatedMultiplatformCommonInterfaceFqName = FqName("$OPTIONS_PACKAGE_PREFIX.KotlinMultiplatformCommonOptions")
withPrinterToFile(fileFromFqName(apiSrcDir, deprecatedMultiplatformCommonInterfaceFqName)) {
generateDeprecatedInterface(
deprecatedMultiplatformCommonInterfaceFqName,
multiplatformCommonInterfaceFqName,
parentType = commonCompilerOptions.deprecatedOptionsName,
properties = multiplatformCommonOptions
)
}
println("\n### Attributes specific for Multiplatform/Common\n")
generateMarkdown(multiplatformCommonOptions)
return GeneratedOptions(multiplatformCommonInterfaceFqName, deprecatedMultiplatformCommonInterfaceFqName, multiplatformCommonOptions)
}
private fun generateMultiplatformCommonOptionsImpl(
srcDir: File,
multiplatformCommonInterfaceFqName: FqName,
commonCompilerImpl: FqName,
multiplatformCommonOptions: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
) {
val k2metadataCompilerArgumentsFqName = FqName(K2MetadataCompilerArguments::class.qualifiedName!!)
val multiplatformCommonImplFqName = FqName("${multiplatformCommonInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, multiplatformCommonImplFqName)) {
generateImpl(
multiplatformCommonImplFqName,
commonCompilerImpl,
multiplatformCommonInterfaceFqName,
k2metadataCompilerArgumentsFqName,
multiplatformCommonOptions
)
}
}
private inline fun <reified T : Any> List<KProperty1<T, *>>.filterToBeDeleted() = filter { prop -> private inline fun <reified T : Any> List<KProperty1<T, *>>.filterToBeDeleted() = filter { prop ->
prop.findAnnotation<GradleDeprecatedOption>() prop.findAnnotation<GradleDeprecatedOption>()
?.let { LanguageVersion.fromVersionString(it.removeAfter) } ?.let { LanguageVersion.fromVersionString(it.removeAfter) }
@@ -179,110 +448,237 @@ private inline fun <reified T : Any> List<KProperty1<T, *>>.filterToBeDeleted()
} }
private inline fun <reified T : Any> gradleOptions(): List<KProperty1<T, *>> = private inline fun <reified T : Any> gradleOptions(): List<KProperty1<T, *>> =
T::class.declaredMemberProperties.filter { it.findAnnotation<GradleOption>() != null }.filterToBeDeleted().sortedBy { it.name } T::class
.declaredMemberProperties
.filter {
it.findAnnotation<GradleOption>() != null
}
.filterToBeDeleted()
.sortedBy { it.name }
internal fun file(baseDir: File, fqName: FqName): File { internal fun fileFromFqName(baseDir: File, fqName: FqName): File {
val fileRelativePath = fqName.asString().replace(".", "/") + ".kt" val fileRelativePath = fqName.asString().replace(".", "/") + ".kt"
return File(baseDir, fileRelativePath) return File(baseDir, fileRelativePath)
} }
private fun Printer.generateInterface(type: FqName, properties: List<KProperty1<*, *>>, parentType: FqName? = null) { private fun Printer.generateInterface(
type: FqName,
properties: List<KProperty1<*, *>>,
parentType: FqName? = null,
) {
val afterType = parentType?.let { " : $it" } val afterType = parentType?.let { " : $it" }
generateDeclaration("interface", type, afterType = afterType) { generateDeclaration("interface", type, afterType = afterType) {
for (property in properties) { for (property in properties) {
println() println()
generateDoc(property) generateDoc(property)
generateOptionDeprecation(property) generateOptionDeprecation(property)
generatePropertyDeclaration(property) generatePropertyProvider(property)
}
}
}
private fun Printer.generateDeprecatedInterface(
type: FqName,
compilerOptionType: FqName,
properties: List<KProperty1<*, *>>,
parentType: FqName? = null,
) {
val afterType = parentType?.let { " : $it" }
val modifier = """
@Deprecated("Use ${compilerOptionType.shortName()} instead", level = DeprecationLevel.WARNING)
interface
""".trimIndent()
generateDeclaration(modifier, type, afterType = afterType) {
println("${if (parentType != null) "override " else ""}val options: $compilerOptionType")
properties.forEach {
println()
generatePropertyGetterAndSetter(it)
} }
} }
} }
private fun Printer.generateImpl( private fun Printer.generateImpl(
type: FqName, type: FqName,
parentImplFqName: FqName?,
parentType: FqName, parentType: FqName,
argsType: FqName, argsType: FqName,
properties: List<KProperty1<*, *>> properties: List<KProperty1<*, *>>
) { ) {
generateDeclaration("internal abstract class", type, afterType = ": $parentType") { val modifiers = "internal abstract class"
fun KProperty1<*, *>.backingField(): String = "${this.name}Field" val afterType = if (parentImplFqName != null) {
": $parentImplFqName(objectFactory), $parentType"
} else {
": $parentType"
}
generateDeclaration(
modifiers,
type,
constructorDeclaration = "@javax.inject.Inject constructor(\n objectFactory: org.gradle.api.model.ObjectFactory\n)",
afterType = afterType
) {
for (property in properties) { for (property in properties) {
println() println()
val propertyType = property.gradleReturnType generatePropertyProviderImpl(property)
if (propertyType.endsWith("?")) {
generateOptionDeprecation(property)
generatePropertyDeclaration(property, modifiers = "override", value = "null")
} else {
val backingField = property.backingField()
val visibilityModified = property.gradleBackingFieldVisibility.name.lowercase(Locale.US)
println("$visibilityModified var $backingField: $propertyType? = null")
generateOptionDeprecation(property)
generatePropertyDeclaration(property, modifiers = "override")
withIndent {
println("get() = $backingField ?: ${property.gradleDefaultValue}")
println("set(value) {")
withIndent { println("$backingField = value") }
println("}")
}
}
} }
println() println()
println("internal open fun updateArguments(args: $argsType) {") println("internal fun fillCompilerArguments(args: $argsType) {")
withIndent { withIndent {
if (parentImplFqName != null) println("super.fillCompilerArguments(args)")
for (property in properties) { for (property in properties) {
val backingField = if (property.gradleReturnType.endsWith("?")) property.name else property.backingField() val defaultValue = property.gradleValues
println("$backingField?.let { args.${property.name} = it }") if (property.name != "freeCompilerArgs") {
val getter = if (property.gradleReturnType.endsWith("?")) ".orNull" else ".get()"
val toArg = defaultValue.toArgumentConverter?.substringAfter("this") ?: ""
println("args.${property.name} = ${property.name}$getter$toArg")
} else {
println("args.freeArgs += ${property.name}.get()")
}
} }
addAdditionalJvmArgs(type)
}
println("}")
println()
println("internal fun fillDefaultValues(args: $argsType) {")
withIndent {
if (parentImplFqName != null) println("super.fillDefaultValues(args)")
properties
.filter { it.name != "freeCompilerArgs" }
.forEach {
val defaultValue = it.gradleValues
var value = defaultValue.defaultValue
if (value != "null" && defaultValue.toArgumentConverter != null) {
value = "$value${defaultValue.toArgumentConverter!!.substringAfter("this")}"
}
println("args.${it.name} = $value")
}
addAdditionalJvmArgs(type)
} }
println("}") println("}")
} }
}
println() private fun Printer.addAdditionalJvmArgs(implType: FqName) {
println("internal fun $argsType.fillDefaultValues() {") // Adding required 'noStdlib' and 'noReflect' compiler arguments for JVM compilation
withIndent { // Otherwise compilation via build tools will fail
for (property in properties) { if (implType.shortName().toString() == "CompilerJvmOptions$IMPLEMENTATION_SUFFIX") {
println("${property.name} = ${property.gradleDefaultValue}") println()
} println("// Arguments with always default values when used from build tools")
// Adding required 'noStdlib' and 'noReflect' compiler arguments for JVM compilation println("args.noStdlib = true")
// Otherwise compilation via build tools will fail println("args.noReflect = true")
if (type.shortName().toString() == "KotlinJvmOptionsBase") {
println("noStdlib = true")
println("noReflect = true")
}
} }
println("}")
} }
internal fun Printer.generateDeclaration( internal fun Printer.generateDeclaration(
modifiers: String, modifiers: String,
type: FqName, type: FqName,
constructorDeclaration: String? = null,
afterType: String? = null, afterType: String? = null,
generateBody: Printer.() -> Unit generateBody: Printer.() -> Unit
) { ) {
println("// DO NOT EDIT MANUALLY!") println(
println("// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt") """
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
""".trimIndent()
)
if (!type.parent().isRoot) { if (!type.parent().isRoot) {
println("package ${type.parent()}") println("package ${type.parent()}")
println() println()
} }
println("@Suppress(\"DEPRECATION\")") print("$modifiers ${type.shortName()}")
print("$modifiers ${type.shortName()} ") constructorDeclaration?.let { print(" $it ") }
afterType?.let { print("$afterType ") } afterType?.let { print("$afterType") }
println("{") println(" {")
withIndent { withIndent {
generateBody() generateBody()
} }
println("}") println("}")
} }
private fun Printer.generatePropertyDeclaration(property: KProperty1<*, *>, modifiers: String = "", value: String? = null) { private fun Printer.generatePropertyProvider(
val returnType = property.gradleReturnType property: KProperty1<*, *>,
val initialValue = if (value != null) " = $value" else "" modifiers: String = ""
println("$modifiers var ${property.name}: $returnType$initialValue") ) {
if (property.gradleDefaultValue == "null" &&
property.gradleInputType == GradleInputTypes.INPUT
) {
println("@get:org.gradle.api.tasks.Optional")
}
println("@get:${property.gradleInputType}")
println("${modifiers.appendWhitespaceIfNotBlank}val ${property.name}: ${property.gradleLazyReturnType}")
} }
private fun Printer.generatePropertyProviderImpl(
property: KProperty1<*, *>,
modifiers: String = ""
) {
generateOptionDeprecation(property)
println(
"override ${modifiers.appendWhitespaceIfNotBlank}val ${property.name}: ${property.gradleLazyReturnType} ="
)
withIndent {
val convention = if (property.gradleDefaultValue != "null") {
".convention(${property.gradleDefaultValue})"
} else {
""
}
println(
"objectFactory${property.gradleLazyReturnTypeInstantiator}$convention"
)
}
}
private fun Printer.generatePropertyGetterAndSetter(
property: KProperty1<*, *>,
modifiers: String = "",
) {
val defaultValue = property.gradleValues
val returnType = property.gradleReturnType
if (defaultValue.type != defaultValue.kotlinOptionsType) {
assert(defaultValue.fromKotlinOptionConverterProp != null)
assert(defaultValue.toKotlinOptionConverterProp != null)
}
if (defaultValue.fromKotlinOptionConverterProp != null) {
println("private val ${defaultValue.kotlinOptionsType}.${property.name}CompilerOption get() = ${defaultValue.fromKotlinOptionConverterProp}")
println()
println("private val ${defaultValue.type}.${property.name}KotlinOption get() = ${defaultValue.toKotlinOptionConverterProp}")
println()
}
generateDoc(property)
generateOptionDeprecation(property)
println("${modifiers.appendWhitespaceIfNotBlank}var ${property.name}: $returnType")
val propGetter = if (returnType.endsWith("?")) ".orNull" else ".get()"
val getter = if (defaultValue.fromKotlinOptionConverterProp != null) {
"$propGetter.${property.name}KotlinOption"
} else {
propGetter
}
val setter = if (defaultValue.toKotlinOptionConverterProp != null) {
".set(value.${property.name}CompilerOption)"
} else {
".set(value)"
}
withIndent {
println("get() = options.${property.name}$getter")
println("set(value) = options.${property.name}$setter")
}
}
private val String.appendWhitespaceIfNotBlank get() = if (isNotBlank()) "$this " else ""
private fun Printer.generateOptionDeprecation(property: KProperty1<*, *>) { private fun Printer.generateOptionDeprecation(property: KProperty1<*, *>) {
property.findAnnotation<GradleDeprecatedOption>() property.findAnnotation<GradleDeprecatedOption>()
?.let { DeprecatedOptionAnnotator.generateOptionAnnotation(it) } ?.let { DeprecatedOptionAnnotator.generateOptionAnnotation(it) }
@@ -335,15 +731,6 @@ private val KProperty1<*, *>.gradleValues: DefaultValues
private val KProperty1<*, *>.gradleDefaultValue: String private val KProperty1<*, *>.gradleDefaultValue: String
get() = gradleValues.defaultValue get() = gradleValues.defaultValue
private val KProperty1<*, *>.gradleBackingFieldVisibility: KVisibility
get() {
val fieldVisibility = findAnnotation<GradleOption>()!!.backingFieldVisibility
require(fieldVisibility != KVisibility.PUBLIC) {
"Backing field should not have public visibility!"
}
return fieldVisibility
}
private val KProperty1<*, *>.gradleReturnType: String private val KProperty1<*, *>.gradleReturnType: String
get() { get() {
// Set nullability based on Gradle default value // Set nullability based on Gradle default value
@@ -354,6 +741,39 @@ private val KProperty1<*, *>.gradleReturnType: String
return type return type
} }
private val KProperty1<*, *>.gradleLazyReturnType: String
get() {
val returnType = gradleValues.type
val classifier = returnType.classifier
return when {
classifier is KClass<*> && classifier == List::class ->
"org.gradle.api.provider.ListProperty<${returnType.arguments.first().type!!.withNullability(false)}>"
classifier is KClass<*> && classifier == Set::class ->
"org.gradle.api.provider.SetProperty<${returnType.arguments.first().type!!.withNullability(false)}>"
classifier is KClass<*> && classifier == Map::class ->
"org.gradle.api.provider.MapProperty<${returnType.arguments[0]}, ${returnType.arguments[1]}"
else -> "org.gradle.api.provider.Property<${returnType.withNullability(false)}>"
}
}
private val KProperty1<*, *>.gradleLazyReturnTypeInstantiator: String
get() {
val returnType = gradleValues.type
val classifier = returnType.classifier
return when {
classifier is KClass<*> && classifier == List::class ->
".listProperty(${returnType.arguments.first().type!!.withNullability(false)}::class.java)"
classifier is KClass<*> && classifier == Set::class ->
".setProperty(${returnType.arguments.first().type!!.withNullability(false)}::class.java)"
classifier is KClass<*> && classifier == Map::class ->
".mapProperty(${returnType.arguments[0]}::class.java, ${returnType.arguments[1]}::class.java)"
else -> ".property(${returnType.withNullability(false)}::class.java)"
}
}
private val KProperty1<*, *>.gradleInputType: String get() =
findAnnotation<GradleOption>()!!.gradleInputType
private inline fun <reified T> KAnnotatedElement.findAnnotation(): T? = private inline fun <reified T> KAnnotatedElement.findAnnotation(): T? =
annotations.filterIsInstance<T>().firstOrNull() annotations.filterIsInstance<T>().firstOrNull()
@@ -15,7 +15,7 @@ internal fun generateJsMainFunctionExecutionMode(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val modeFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode") val modeFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode")
filePrinter(file(apiDir, modeFqName)) { filePrinter(fileFromFqName(apiDir, modeFqName)) {
generateDeclaration("enum class", modeFqName, afterType = "(val mode: String)") { generateDeclaration("enum class", modeFqName, afterType = "(val mode: String)") {
val modes = hashMapOf( val modes = hashMapOf(
K2JsArgumentConstants::CALL.name to K2JsArgumentConstants.CALL, K2JsArgumentConstants::CALL.name to K2JsArgumentConstants.CALL,
@@ -45,7 +45,7 @@ internal fun generateJsModuleKind(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val jsModuleKindFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsModuleKind") val jsModuleKindFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsModuleKind")
filePrinter(file(apiDir, jsModuleKindFqName)) { filePrinter(fileFromFqName(apiDir, jsModuleKindFqName)) {
generateDeclaration("enum class", jsModuleKindFqName, afterType = "(val kind: String)") { generateDeclaration("enum class", jsModuleKindFqName, afterType = "(val kind: String)") {
val kinds = hashMapOf( val kinds = hashMapOf(
K2JsArgumentConstants::MODULE_PLAIN.name to K2JsArgumentConstants.MODULE_PLAIN, K2JsArgumentConstants::MODULE_PLAIN.name to K2JsArgumentConstants.MODULE_PLAIN,
@@ -78,7 +78,7 @@ internal fun generateJsSourceMapEmbedMode(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val jsSourceMapEmbedKindFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode") val jsSourceMapEmbedKindFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode")
filePrinter(file(apiDir, jsSourceMapEmbedKindFqName)) { filePrinter(fileFromFqName(apiDir, jsSourceMapEmbedKindFqName)) {
generateDeclaration("enum class", jsSourceMapEmbedKindFqName, afterType = "(val mode: String)") { generateDeclaration("enum class", jsSourceMapEmbedKindFqName, afterType = "(val mode: String)") {
val modes = hashMapOf( val modes = hashMapOf(
K2JsArgumentConstants::SOURCE_MAP_SOURCE_CONTENT_ALWAYS.name to K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, K2JsArgumentConstants::SOURCE_MAP_SOURCE_CONTENT_ALWAYS.name to K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS,
@@ -109,7 +109,7 @@ internal fun generateJsDiagnosticMode(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val diagnosticModeFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsDiagnosticMode") val diagnosticModeFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JsDiagnosticMode")
filePrinter(file(apiDir, diagnosticModeFqName)) { filePrinter(fileFromFqName(apiDir, diagnosticModeFqName)) {
generateDeclaration("enum class", diagnosticModeFqName, afterType = "(val mode: String)") { generateDeclaration("enum class", diagnosticModeFqName, afterType = "(val mode: String)") {
val mods = hashMapOf( val mods = hashMapOf(
K2JsArgumentConstants::RUNTIME_DIAGNOSTIC_EXCEPTION.name to K2JsArgumentConstants.RUNTIME_DIAGNOSTIC_EXCEPTION, K2JsArgumentConstants::RUNTIME_DIAGNOSTIC_EXCEPTION.name to K2JsArgumentConstants.RUNTIME_DIAGNOSTIC_EXCEPTION,
@@ -15,7 +15,7 @@ internal fun generateJvmTarget(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val jvmTargetFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JvmTarget") val jvmTargetFqName = FqName("org.jetbrains.kotlin.gradle.dsl.JvmTarget")
filePrinter(file(apiDir, jvmTargetFqName)) { filePrinter(fileFromFqName(apiDir, jvmTargetFqName)) {
generateDeclaration("enum class", jvmTargetFqName, afterType = "(val target: String)") { generateDeclaration("enum class", jvmTargetFqName, afterType = "(val target: String)") {
val jvmTargetValues = JvmTarget.values() val jvmTargetValues = JvmTarget.values()
val deprecatedJvmTargetValues = JvmTarget.values().subtract(JvmTarget.supportedValues().toSet()) val deprecatedJvmTargetValues = JvmTarget.values().subtract(JvmTarget.supportedValues().toSet())
@@ -19,7 +19,7 @@ internal fun generateKotlinVersion(
filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit filePrinter: (targetFile: File, Printer.() -> Unit) -> Unit
) { ) {
val kotlinVersionFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinVersion") val kotlinVersionFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinVersion")
filePrinter(file(apiDir, kotlinVersionFqName)) { filePrinter(fileFromFqName(apiDir, kotlinVersionFqName)) {
generateDeclaration("enum class", kotlinVersionFqName, afterType = "(val version: String)") { generateDeclaration("enum class", kotlinVersionFqName, afterType = "(val version: String)") {
val languageVersions = LanguageVersion.values() val languageVersions = LanguageVersion.values()
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class JsDiagnosticMode(val mode: String) {
enum class JsDiagnosticMode (val mode: String) {
RUNTIME_DIAGNOSTIC_EXCEPTION("exception"), RUNTIME_DIAGNOSTIC_EXCEPTION("exception"),
RUNTIME_DIAGNOSTIC_LOG("log"); RUNTIME_DIAGNOSTIC_LOG("log");
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class JsMainFunctionExecutionMode(val mode: String) {
enum class JsMainFunctionExecutionMode (val mode: String) {
CALL("call"), CALL("call"),
NO_CALL("noCall"); NO_CALL("noCall");
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class JsModuleKind(val kind: String) {
enum class JsModuleKind (val kind: String) {
MODULE_AMD("amd"), MODULE_AMD("amd"),
MODULE_PLAIN("plain"), MODULE_PLAIN("plain"),
MODULE_ES("es"), MODULE_ES("es"),
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class JsSourceMapEmbedMode(val mode: String) {
enum class JsSourceMapEmbedMode (val mode: String) {
SOURCE_MAP_SOURCE_CONTENT_INLINING("inlining"), SOURCE_MAP_SOURCE_CONTENT_INLINING("inlining"),
SOURCE_MAP_SOURCE_CONTENT_NEVER("never"), SOURCE_MAP_SOURCE_CONTENT_NEVER("never"),
SOURCE_MAP_SOURCE_CONTENT_ALWAYS("always"); SOURCE_MAP_SOURCE_CONTENT_ALWAYS("always");
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class JvmTarget(val target: String) {
enum class JvmTarget (val target: String) {
@Deprecated("Will be removed soon") JVM_1_6("1.6"), @Deprecated("Will be removed soon") JVM_1_6("1.6"),
JVM_1_8("1.8"), JVM_1_8("1.8"),
JVM_9("9"), JVM_9("9"),
@@ -1,9 +1,11 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") enum class KotlinVersion(val version: String) {
enum class KotlinVersion (val version: String) {
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_0("1.0"), @Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_0("1.0"),
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_1("1.1"), @Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_1("1.1"),
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_2("1.2"), @Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_2("1.2"),
@@ -0,0 +1,34 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerCommonOptions : org.jetbrains.kotlin.gradle.dsl.CompilerCommonToolOptions {
/**
* Allow using declarations only from the specified version of bundled libraries
* Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)"
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val apiVersion: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.KotlinVersion>
/**
* Provide source compatibility with the specified version of Kotlin
* Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)"
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val languageVersion: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.KotlinVersion>
/**
* Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val useK2: org.gradle.api.provider.Property<kotlin.Boolean>
}
@@ -0,0 +1,37 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerCommonToolOptions {
/**
* Report an error if there are any warnings
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val allWarningsAsErrors: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Generate no warnings
* Default value: false
*/
@get:org.gradle.api.tasks.Internal
val suppressWarnings: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Enable verbose logging output
* Default value: false
*/
@get:org.gradle.api.tasks.Internal
val verbose: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* A list of additional compiler arguments
* Default value: emptyList<String>()
*/
@get:org.gradle.api.tasks.Input
val freeCompilerArgs: org.gradle.api.provider.ListProperty<kotlin.String>
}
@@ -0,0 +1,24 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerJsDceOptions : org.jetbrains.kotlin.gradle.dsl.CompilerCommonToolOptions {
/**
* Development mode: don't strip out any code, just copy dependencies
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val devMode: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Output directory
* Default value: null
*/
@Deprecated(message = "Use task 'destinationDirectory' to configure output directory", level = DeprecationLevel.WARNING)
@get:org.gradle.api.tasks.Internal
val outputDirectory: org.gradle.api.provider.Property<kotlin.String>
}
@@ -0,0 +1,93 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerJsOptions : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions {
/**
* Disable internal declaration export
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val friendModulesDisabled: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Define whether the `main` function should be called upon execution
* Possible values: "call", "noCall"
* Default value: org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.CALL
*/
@get:org.gradle.api.tasks.Input
val main: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode>
/**
* Generate .meta.js and .kjsm files with metadata. Use to create a library
* Default value: true
*/
@get:org.gradle.api.tasks.Input
val metaInfo: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Kind of the JS module generated by the compiler
* Possible values: "plain", "amd", "commonjs", "umd"
* Default value: org.jetbrains.kotlin.gradle.dsl.JsModuleKind.MODULE_PLAIN
*/
@get:org.gradle.api.tasks.Input
val moduleKind: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsModuleKind>
/**
* Don't automatically include the default Kotlin/JS stdlib into compilation dependencies
* Default value: true
*/
@get:org.gradle.api.tasks.Input
val noStdlib: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Destination *.js file for the compilation result
* Default value: null
*/
@Deprecated(message = "Use task 'outputFileProperty' to specify location", level = DeprecationLevel.WARNING)
@get:org.gradle.api.tasks.Internal
val outputFile: org.gradle.api.provider.Property<kotlin.String>
/**
* Generate source map
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val sourceMap: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Embed source files into source map
* Possible values: "never", "always", "inlining"
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val sourceMapEmbedSources: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode>
/**
* Add the specified prefix to paths in the source map
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val sourceMapPrefix: org.gradle.api.provider.Property<kotlin.String>
/**
* Generate JS files for specific ECMA version
* Possible values: "v5"
* Default value: "v5"
*/
@get:org.gradle.api.tasks.Input
val target: org.gradle.api.provider.Property<kotlin.String>
/**
* Translate primitive arrays to JS typed arrays
* Default value: true
*/
@get:org.gradle.api.tasks.Input
val typedArrays: org.gradle.api.provider.Property<kotlin.Boolean>
}
@@ -0,0 +1,40 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerJvmOptions : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions {
/**
* Generate metadata for Java 1.8 reflection on method parameters
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val javaParameters: org.gradle.api.provider.Property<kotlin.Boolean>
/**
* Target version of the generated JVM bytecode (1.8, 9, 10, ..., 18), default is 1.8
* Possible values: "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val jvmTarget: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JvmTarget>
/**
* Name of the generated .kotlin_module file
* Default value: null
*/
@get:org.gradle.api.tasks.Optional
@get:org.gradle.api.tasks.Input
val moduleName: org.gradle.api.provider.Property<kotlin.String>
/**
* Don't automatically include the Java runtime into the classpath
* Default value: false
*/
@get:org.gradle.api.tasks.Input
val noJdk: org.gradle.api.provider.Property<kotlin.Boolean>
}
@@ -0,0 +1,9 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
interface CompilerMultiplatformCommonOptions : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions {
}
@@ -1,27 +1,45 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") @Deprecated("Use CompilerCommonOptions instead", level = DeprecationLevel.WARNING)
interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions { interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions {
override val options: org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions
private val kotlin.String?.apiVersionCompilerOption get() = if (this != null) org.jetbrains.kotlin.gradle.dsl.KotlinVersion.fromVersion(this) else null
private val org.jetbrains.kotlin.gradle.dsl.KotlinVersion?.apiVersionKotlinOption get() = this?.version
/** /**
* Allow using declarations only from the specified version of bundled libraries * Allow using declarations only from the specified version of bundled libraries
* Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)"
* Default value: null * Default value: null
*/ */
var apiVersion: kotlin.String? var apiVersion: kotlin.String?
get() = options.apiVersion.orNull.apiVersionKotlinOption
set(value) = options.apiVersion.set(value.apiVersionCompilerOption)
private val kotlin.String?.languageVersionCompilerOption get() = if (this != null) org.jetbrains.kotlin.gradle.dsl.KotlinVersion.fromVersion(this) else null
private val org.jetbrains.kotlin.gradle.dsl.KotlinVersion?.languageVersionKotlinOption get() = this?.version
/** /**
* Provide source compatibility with the specified version of Kotlin * Provide source compatibility with the specified version of Kotlin
* Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)"
* Default value: null * Default value: null
*/ */
var languageVersion: kotlin.String? var languageVersion: kotlin.String?
get() = options.languageVersion.orNull.languageVersionKotlinOption
set(value) = options.languageVersion.set(value.languageVersionCompilerOption)
/** /**
* Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided * Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
* Default value: false * Default value: false
*/ */
var useK2: kotlin.Boolean var useK2: kotlin.Boolean
get() = options.useK2.get()
set(value) = options.useK2.set(value)
} }
@@ -1,31 +1,43 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") @Deprecated("Use CompilerCommonToolOptions instead", level = DeprecationLevel.WARNING)
interface KotlinCommonToolOptions { interface KotlinCommonToolOptions {
val options: org.jetbrains.kotlin.gradle.dsl.CompilerCommonToolOptions
/** /**
* Report an error if there are any warnings * Report an error if there are any warnings
* Default value: false * Default value: false
*/ */
var allWarningsAsErrors: kotlin.Boolean var allWarningsAsErrors: kotlin.Boolean
get() = options.allWarningsAsErrors.get()
set(value) = options.allWarningsAsErrors.set(value)
/** /**
* Generate no warnings * Generate no warnings
* Default value: false * Default value: false
*/ */
var suppressWarnings: kotlin.Boolean var suppressWarnings: kotlin.Boolean
get() = options.suppressWarnings.get()
set(value) = options.suppressWarnings.set(value)
/** /**
* Enable verbose logging output * Enable verbose logging output
* Default value: false * Default value: false
*/ */
var verbose: kotlin.Boolean var verbose: kotlin.Boolean
get() = options.verbose.get()
set(value) = options.verbose.set(value)
/** /**
* A list of additional compiler arguments * A list of additional compiler arguments
* Default value: emptyList() * Default value: emptyList<String>()
*/ */
var freeCompilerArgs: kotlin.collections.List<kotlin.String> var freeCompilerArgs: kotlin.collections.List<kotlin.String>
get() = options.freeCompilerArgs.get()
set(value) = options.freeCompilerArgs.set(value)
} }
@@ -1,19 +1,28 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") @Deprecated("Use CompilerJsDceOptions instead", level = DeprecationLevel.WARNING)
interface KotlinJsDceOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions { interface KotlinJsDceOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions {
override val options: org.jetbrains.kotlin.gradle.dsl.CompilerJsDceOptions
/** /**
* Development mode: don't strip out any code, just copy dependencies * Development mode: don't strip out any code, just copy dependencies
* Default value: false * Default value: false
*/ */
var devMode: kotlin.Boolean var devMode: kotlin.Boolean
get() = options.devMode.get()
set(value) = options.devMode.set(value)
/** /**
* Output directory * Output directory
* Default value: null * Default value: null
*/ */
var outputDirectory: kotlin.String? @Deprecated(message = "Use task 'destinationDirectory' to configure output directory", level = DeprecationLevel.WARNING)
var outputDirectory: kotlin.String?
get() = options.outputDirectory.orNull
set(value) = options.outputDirectory.set(value)
} }
@@ -1,77 +1,116 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") @Deprecated("Use CompilerJsOptions instead", level = DeprecationLevel.WARNING)
interface KotlinJsOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions { interface KotlinJsOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
override val options: org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions
/** /**
* Disable internal declaration export * Disable internal declaration export
* Default value: false * Default value: false
*/ */
var friendModulesDisabled: kotlin.Boolean var friendModulesDisabled: kotlin.Boolean
get() = options.friendModulesDisabled.get()
set(value) = options.friendModulesDisabled.set(value)
private val kotlin.String.mainCompilerOption get() = org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.fromMode(this)
private val org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.mainKotlinOption get() = this.mode
/** /**
* Define whether the `main` function should be called upon execution * Define whether the `main` function should be called upon execution
* Possible values: "call", "noCall" * Possible values: "call", "noCall"
* Default value: "call" * Default value: org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.CALL
*/ */
var main: kotlin.String var main: kotlin.String
get() = options.main.get().mainKotlinOption
set(value) = options.main.set(value.mainCompilerOption)
/** /**
* Generate .meta.js and .kjsm files with metadata. Use to create a library * Generate .meta.js and .kjsm files with metadata. Use to create a library
* Default value: true * Default value: true
*/ */
var metaInfo: kotlin.Boolean var metaInfo: kotlin.Boolean
get() = options.metaInfo.get()
set(value) = options.metaInfo.set(value)
private val kotlin.String.moduleKindCompilerOption get() = org.jetbrains.kotlin.gradle.dsl.JsModuleKind.fromKind(this)
private val org.jetbrains.kotlin.gradle.dsl.JsModuleKind.moduleKindKotlinOption get() = this.kind
/** /**
* Kind of the JS module generated by the compiler * Kind of the JS module generated by the compiler
* Possible values: "plain", "amd", "commonjs", "umd" * Possible values: "plain", "amd", "commonjs", "umd"
* Default value: "plain" * Default value: org.jetbrains.kotlin.gradle.dsl.JsModuleKind.MODULE_PLAIN
*/ */
var moduleKind: kotlin.String var moduleKind: kotlin.String
get() = options.moduleKind.get().moduleKindKotlinOption
set(value) = options.moduleKind.set(value.moduleKindCompilerOption)
/** /**
* Don't automatically include the default Kotlin/JS stdlib into compilation dependencies * Don't automatically include the default Kotlin/JS stdlib into compilation dependencies
* Default value: true * Default value: true
*/ */
var noStdlib: kotlin.Boolean var noStdlib: kotlin.Boolean
get() = options.noStdlib.get()
set(value) = options.noStdlib.set(value)
/** /**
* Destination *.js file for the compilation result * Destination *.js file for the compilation result
* Default value: null * Default value: null
*/ */
var outputFile: kotlin.String? @Deprecated(message = "Use task 'outputFileProperty' to specify location", level = DeprecationLevel.WARNING)
var outputFile: kotlin.String?
get() = options.outputFile.orNull
set(value) = options.outputFile.set(value)
/** /**
* Generate source map * Generate source map
* Default value: false * Default value: false
*/ */
var sourceMap: kotlin.Boolean var sourceMap: kotlin.Boolean
get() = options.sourceMap.get()
set(value) = options.sourceMap.set(value)
private val kotlin.String?.sourceMapEmbedSourcesCompilerOption get() = this?.let { org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode.fromMode(it) }
private val org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode?.sourceMapEmbedSourcesKotlinOption get() = this?.mode
/** /**
* Embed source files into source map * Embed source files into source map
* Possible values: "never", "always", "inlining" * Possible values: "never", "always", "inlining"
* Default value: null * Default value: null
*/ */
var sourceMapEmbedSources: kotlin.String? var sourceMapEmbedSources: kotlin.String?
get() = options.sourceMapEmbedSources.orNull.sourceMapEmbedSourcesKotlinOption
set(value) = options.sourceMapEmbedSources.set(value.sourceMapEmbedSourcesCompilerOption)
/** /**
* Add the specified prefix to paths in the source map * Add the specified prefix to paths in the source map
* Default value: null * Default value: null
*/ */
var sourceMapPrefix: kotlin.String? var sourceMapPrefix: kotlin.String?
get() = options.sourceMapPrefix.orNull
set(value) = options.sourceMapPrefix.set(value)
/** /**
* Generate JS files for specific ECMA version * Generate JS files for specific ECMA version
* Possible values: "v5" * Possible values: "v5"
* Default value: "v5" * Default value: "v5"
*/ */
var target: kotlin.String var target: kotlin.String
get() = options.target.get()
set(value) = options.target.set(value)
/** /**
* Translate primitive arrays to JS typed arrays * Translate primitive arrays to JS typed arrays
* Default value: true * Default value: true
*/ */
var typedArrays: kotlin.Boolean var typedArrays: kotlin.Boolean
get() = options.typedArrays.get()
set(value) = options.typedArrays.set(value)
} }
@@ -1,32 +1,48 @@
// DO NOT EDIT MANUALLY! // DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt // Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION") @Deprecated("Use CompilerJvmOptions instead", level = DeprecationLevel.WARNING)
interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions { interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
override val options: org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions
/** /**
* Generate metadata for Java 1.8 reflection on method parameters * Generate metadata for Java 1.8 reflection on method parameters
* Default value: false * Default value: false
*/ */
var javaParameters: kotlin.Boolean var javaParameters: kotlin.Boolean
get() = options.javaParameters.get()
set(value) = options.javaParameters.set(value)
private val kotlin.String?.jvmTargetCompilerOption get() = if (this != null) org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(this) else null
private val org.jetbrains.kotlin.gradle.dsl.JvmTarget?.jvmTargetKotlinOption get() = this?.target
/** /**
* Target version of the generated JVM bytecode (1.8, 9, 10, ..., 18), default is 1.8 * Target version of the generated JVM bytecode (1.8, 9, 10, ..., 18), default is 1.8
* Possible values: "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18" * Possible values: "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"
* Default value: null * Default value: null
*/ */
var jvmTarget: kotlin.String? var jvmTarget: kotlin.String?
get() = options.jvmTarget.orNull.jvmTargetKotlinOption
set(value) = options.jvmTarget.set(value.jvmTargetCompilerOption)
/** /**
* Name of the generated .kotlin_module file * Name of the generated .kotlin_module file
* Default value: null * Default value: null
*/ */
var moduleName: kotlin.String? var moduleName: kotlin.String?
get() = options.moduleName.orNull
set(value) = options.moduleName.set(value)
/** /**
* Don't automatically include the Java runtime into the classpath * Don't automatically include the Java runtime into the classpath
* Default value: false * Default value: false
*/ */
var noJdk: kotlin.Boolean var noJdk: kotlin.Boolean
get() = options.noJdk.get()
set(value) = options.noJdk.set(value)
} }
@@ -0,0 +1,11 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
@Deprecated("Use CompilerMultiplatformCommonOptions instead", level = DeprecationLevel.WARNING)
interface KotlinMultiplatformCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
override val options: org.jetbrains.kotlin.gradle.dsl.CompilerMultiplatformCommonOptions
}
@@ -38,6 +38,7 @@ dependencies {
commonCompileOnly(project(":compiler")) commonCompileOnly(project(":compiler"))
commonCompileOnly(project(":compiler:incremental-compilation-impl")) commonCompileOnly(project(":compiler:incremental-compilation-impl"))
commonCompileOnly(project(":daemon-common")) commonCompileOnly(project(":daemon-common"))
commonCompileOnly(project(":kotlin-gradle-compiler-types"))
commonCompileOnly(project(":native:kotlin-native-utils")) commonCompileOnly(project(":native:kotlin-native-utils"))
commonCompileOnly(project(":kotlin-android-extensions")) commonCompileOnly(project(":kotlin-android-extensions"))
commonCompileOnly(project(":kotlin-build-common")) commonCompileOnly(project(":kotlin-build-common"))
@@ -0,0 +1,34 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerCommonOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonToolOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions {
override val apiVersion: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.KotlinVersion> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.KotlinVersion::class.java)
override val languageVersion: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.KotlinVersion> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.KotlinVersion::class.java)
override val useK2: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments) {
super.fillCompilerArguments(args)
args.apiVersion = apiVersion.orNull?.version
args.languageVersion = languageVersion.orNull?.version
args.useK2 = useK2.get()
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments) {
super.fillDefaultValues(args)
args.apiVersion = null
args.languageVersion = null
args.useK2 = false
}
}
@@ -0,0 +1,36 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerCommonToolOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonToolOptions {
override val allWarningsAsErrors: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val suppressWarnings: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val verbose: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val freeCompilerArgs: org.gradle.api.provider.ListProperty<kotlin.String> =
objectFactory.listProperty(kotlin.String::class.java).convention(emptyList<String>())
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments) {
args.allWarningsAsErrors = allWarningsAsErrors.get()
args.suppressWarnings = suppressWarnings.get()
args.verbose = verbose.get()
args.freeArgs += freeCompilerArgs.get()
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments) {
args.allWarningsAsErrors = false
args.suppressWarnings = false
args.verbose = false
}
}
@@ -0,0 +1,30 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerJsDceOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.CompilerJsDceOptions {
override val devMode: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
@Deprecated(message = "Use task 'destinationDirectory' to configure output directory", level = DeprecationLevel.WARNING)
override val outputDirectory: org.gradle.api.provider.Property<kotlin.String> =
objectFactory.property(kotlin.String::class.java)
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments) {
super.fillCompilerArguments(args)
args.devMode = devMode.get()
args.outputDirectory = outputDirectory.orNull
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments) {
super.fillDefaultValues(args)
args.devMode = false
args.outputDirectory = null
}
}
@@ -0,0 +1,75 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerJsOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions {
override val friendModulesDisabled: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val main: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode::class.java).convention(org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.CALL)
override val metaInfo: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(true)
override val moduleKind: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsModuleKind> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.JsModuleKind::class.java).convention(org.jetbrains.kotlin.gradle.dsl.JsModuleKind.MODULE_PLAIN)
override val noStdlib: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(true)
@Deprecated(message = "Use task 'outputFileProperty' to specify location", level = DeprecationLevel.WARNING)
override val outputFile: org.gradle.api.provider.Property<kotlin.String> =
objectFactory.property(kotlin.String::class.java)
override val sourceMap: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val sourceMapEmbedSources: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode::class.java)
override val sourceMapPrefix: org.gradle.api.provider.Property<kotlin.String> =
objectFactory.property(kotlin.String::class.java)
override val target: org.gradle.api.provider.Property<kotlin.String> =
objectFactory.property(kotlin.String::class.java).convention("v5")
override val typedArrays: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(true)
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments) {
super.fillCompilerArguments(args)
args.friendModulesDisabled = friendModulesDisabled.get()
args.main = main.get().mode
args.metaInfo = metaInfo.get()
args.moduleKind = moduleKind.get().kind
args.noStdlib = noStdlib.get()
args.outputFile = outputFile.orNull
args.sourceMap = sourceMap.get()
args.sourceMapEmbedSources = sourceMapEmbedSources.orNull?.mode
args.sourceMapPrefix = sourceMapPrefix.orNull
args.target = target.get()
args.typedArrays = typedArrays.get()
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments) {
super.fillDefaultValues(args)
args.friendModulesDisabled = false
args.main = org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode.CALL.mode
args.metaInfo = true
args.moduleKind = org.jetbrains.kotlin.gradle.dsl.JsModuleKind.MODULE_PLAIN.kind
args.noStdlib = true
args.outputFile = null
args.sourceMap = false
args.sourceMapEmbedSources = null
args.sourceMapPrefix = null
args.target = "v5"
args.typedArrays = true
}
}
@@ -0,0 +1,47 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerJvmOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions {
override val javaParameters: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val jvmTarget: org.gradle.api.provider.Property<org.jetbrains.kotlin.gradle.dsl.JvmTarget> =
objectFactory.property(org.jetbrains.kotlin.gradle.dsl.JvmTarget::class.java)
override val moduleName: org.gradle.api.provider.Property<kotlin.String> =
objectFactory.property(kotlin.String::class.java)
override val noJdk: org.gradle.api.provider.Property<kotlin.Boolean> =
objectFactory.property(kotlin.Boolean::class.java).convention(false)
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments) {
super.fillCompilerArguments(args)
args.javaParameters = javaParameters.get()
args.jvmTarget = jvmTarget.orNull?.target
args.moduleName = moduleName.orNull
args.noJdk = noJdk.get()
// Arguments with always default values when used from build tools
args.noStdlib = true
args.noReflect = true
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments) {
super.fillDefaultValues(args)
args.javaParameters = false
args.jvmTarget = null
args.moduleName = null
args.noJdk = false
// Arguments with always default values when used from build tools
args.noStdlib = true
args.noReflect = true
}
}
@@ -0,0 +1,19 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
// To regenerate run 'generateGradleOptions' task
@file:Suppress("RemoveRedundantQualifierName", "Deprecation", "DuplicatedCode")
package org.jetbrains.kotlin.gradle.dsl
internal abstract class CompilerMultiplatformCommonOptionsDefault @javax.inject.Inject constructor(
objectFactory: org.gradle.api.model.ObjectFactory
) : org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.CompilerMultiplatformCommonOptions {
internal fun fillCompilerArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) {
super.fillCompilerArguments(args)
}
internal fun fillDefaultValues(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) {
super.fillDefaultValues(args)
}
}
@@ -1,53 +0,0 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
internal abstract class KotlinJsDceOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJsDceOptions {
private var allWarningsAsErrorsField: kotlin.Boolean? = null
override var allWarningsAsErrors: kotlin.Boolean
get() = allWarningsAsErrorsField ?: false
set(value) {
allWarningsAsErrorsField = value
}
private var suppressWarningsField: kotlin.Boolean? = null
override var suppressWarnings: kotlin.Boolean
get() = suppressWarningsField ?: false
set(value) {
suppressWarningsField = value
}
private var verboseField: kotlin.Boolean? = null
override var verbose: kotlin.Boolean
get() = verboseField ?: false
set(value) {
verboseField = value
}
private var devModeField: kotlin.Boolean? = null
override var devMode: kotlin.Boolean
get() = devModeField ?: false
set(value) {
devModeField = value
}
override var outputDirectory: kotlin.String? = null
internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments) {
allWarningsAsErrorsField?.let { args.allWarningsAsErrors = it }
suppressWarningsField?.let { args.suppressWarnings = it }
verboseField?.let { args.verbose = it }
devModeField?.let { args.devMode = it }
outputDirectory?.let { args.outputDirectory = it }
}
}
internal fun org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments.fillDefaultValues() {
allWarningsAsErrors = false
suppressWarnings = false
verbose = false
devMode = false
outputDirectory = null
}
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.gradle.dsl
import org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments
internal class KotlinJsDceOptionsImpl : KotlinJsDceOptionsBase() {
override var freeCompilerArgs: List<String> = listOf()
override fun updateArguments(args: K2JSDceArguments) {
super.updateArguments(args)
copyFreeCompilerArgsToArgs(args)
}
}
@@ -1,141 +0,0 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions {
private var allWarningsAsErrorsField: kotlin.Boolean? = null
override var allWarningsAsErrors: kotlin.Boolean
get() = allWarningsAsErrorsField ?: false
set(value) {
allWarningsAsErrorsField = value
}
private var suppressWarningsField: kotlin.Boolean? = null
override var suppressWarnings: kotlin.Boolean
get() = suppressWarningsField ?: false
set(value) {
suppressWarningsField = value
}
private var verboseField: kotlin.Boolean? = null
override var verbose: kotlin.Boolean
get() = verboseField ?: false
set(value) {
verboseField = value
}
override var apiVersion: kotlin.String? = null
override var languageVersion: kotlin.String? = null
private var useK2Field: kotlin.Boolean? = null
override var useK2: kotlin.Boolean
get() = useK2Field ?: false
set(value) {
useK2Field = value
}
private var friendModulesDisabledField: kotlin.Boolean? = null
override var friendModulesDisabled: kotlin.Boolean
get() = friendModulesDisabledField ?: false
set(value) {
friendModulesDisabledField = value
}
private var mainField: kotlin.String? = null
override var main: kotlin.String
get() = mainField ?: "call"
set(value) {
mainField = value
}
private var metaInfoField: kotlin.Boolean? = null
override var metaInfo: kotlin.Boolean
get() = metaInfoField ?: true
set(value) {
metaInfoField = value
}
private var moduleKindField: kotlin.String? = null
override var moduleKind: kotlin.String
get() = moduleKindField ?: "plain"
set(value) {
moduleKindField = value
}
private var noStdlibField: kotlin.Boolean? = null
override var noStdlib: kotlin.Boolean
get() = noStdlibField ?: true
set(value) {
noStdlibField = value
}
override var outputFile: kotlin.String? = null
private var sourceMapField: kotlin.Boolean? = null
override var sourceMap: kotlin.Boolean
get() = sourceMapField ?: false
set(value) {
sourceMapField = value
}
override var sourceMapEmbedSources: kotlin.String? = null
override var sourceMapPrefix: kotlin.String? = null
private var targetField: kotlin.String? = null
override var target: kotlin.String
get() = targetField ?: "v5"
set(value) {
targetField = value
}
private var typedArraysField: kotlin.Boolean? = null
override var typedArrays: kotlin.Boolean
get() = typedArraysField ?: true
set(value) {
typedArraysField = value
}
internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments) {
allWarningsAsErrorsField?.let { args.allWarningsAsErrors = it }
suppressWarningsField?.let { args.suppressWarnings = it }
verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it }
useK2Field?.let { args.useK2 = it }
friendModulesDisabledField?.let { args.friendModulesDisabled = it }
mainField?.let { args.main = it }
metaInfoField?.let { args.metaInfo = it }
moduleKindField?.let { args.moduleKind = it }
noStdlibField?.let { args.noStdlib = it }
outputFile?.let { args.outputFile = it }
sourceMapField?.let { args.sourceMap = it }
sourceMapEmbedSources?.let { args.sourceMapEmbedSources = it }
sourceMapPrefix?.let { args.sourceMapPrefix = it }
targetField?.let { args.target = it }
typedArraysField?.let { args.typedArrays = it }
}
}
internal fun org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.fillDefaultValues() {
allWarningsAsErrors = false
suppressWarnings = false
verbose = false
apiVersion = null
languageVersion = null
useK2 = false
friendModulesDisabled = false
main = "call"
metaInfo = true
moduleKind = "plain"
noStdlib = true
outputFile = null
sourceMap = false
sourceMapEmbedSources = null
sourceMapPrefix = null
target = "v5"
typedArrays = true
}
@@ -1,34 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.gradle.dsl
import org.gradle.api.file.FileCollection
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
internal class KotlinJsOptionsImpl : KotlinJsOptionsBase() {
override var freeCompilerArgs: List<String> = listOf()
var sourceMapBaseDirs: FileCollection? = null
override fun updateArguments(args: K2JSCompilerArguments) {
super.updateArguments(args)
copyFreeCompilerArgsToArgs(args)
sourceMapBaseDirs?.let {
args.sourceMapBaseDirs = it.asPath
}
}
}
@@ -1,85 +0,0 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions {
private var allWarningsAsErrorsField: kotlin.Boolean? = null
override var allWarningsAsErrors: kotlin.Boolean
get() = allWarningsAsErrorsField ?: false
set(value) {
allWarningsAsErrorsField = value
}
private var suppressWarningsField: kotlin.Boolean? = null
override var suppressWarnings: kotlin.Boolean
get() = suppressWarningsField ?: false
set(value) {
suppressWarningsField = value
}
private var verboseField: kotlin.Boolean? = null
override var verbose: kotlin.Boolean
get() = verboseField ?: false
set(value) {
verboseField = value
}
override var apiVersion: kotlin.String? = null
override var languageVersion: kotlin.String? = null
private var useK2Field: kotlin.Boolean? = null
override var useK2: kotlin.Boolean
get() = useK2Field ?: false
set(value) {
useK2Field = value
}
private var javaParametersField: kotlin.Boolean? = null
override var javaParameters: kotlin.Boolean
get() = javaParametersField ?: false
set(value) {
javaParametersField = value
}
override var jvmTarget: kotlin.String? = null
override var moduleName: kotlin.String? = null
private var noJdkField: kotlin.Boolean? = null
override var noJdk: kotlin.Boolean
get() = noJdkField ?: false
set(value) {
noJdkField = value
}
internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments) {
allWarningsAsErrorsField?.let { args.allWarningsAsErrors = it }
suppressWarningsField?.let { args.suppressWarnings = it }
verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it }
useK2Field?.let { args.useK2 = it }
javaParametersField?.let { args.javaParameters = it }
jvmTarget?.let { args.jvmTarget = it }
moduleName?.let { args.moduleName = it }
noJdkField?.let { args.noJdk = it }
}
}
internal fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fillDefaultValues() {
allWarningsAsErrors = false
suppressWarnings = false
verbose = false
apiVersion = null
languageVersion = null
useK2 = false
javaParameters = false
jvmTarget = null
moduleName = null
noJdk = false
noStdlib = true
noReflect = true
}
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.gradle.dsl
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
internal class KotlinJvmOptionsImpl : KotlinJvmOptionsBase() {
override var freeCompilerArgs: List<String> = listOf()
override fun updateArguments(args: K2JVMCompilerArguments) {
super.updateArguments(args)
copyFreeCompilerArgsToArgs(args)
}
}
@@ -1,7 +0,0 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
interface KotlinMultiplatformCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
}
@@ -1,57 +0,0 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
internal abstract class KotlinMultiplatformCommonOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonOptions {
private var allWarningsAsErrorsField: kotlin.Boolean? = null
override var allWarningsAsErrors: kotlin.Boolean
get() = allWarningsAsErrorsField ?: false
set(value) {
allWarningsAsErrorsField = value
}
private var suppressWarningsField: kotlin.Boolean? = null
override var suppressWarnings: kotlin.Boolean
get() = suppressWarningsField ?: false
set(value) {
suppressWarningsField = value
}
private var verboseField: kotlin.Boolean? = null
override var verbose: kotlin.Boolean
get() = verboseField ?: false
set(value) {
verboseField = value
}
override var apiVersion: kotlin.String? = null
override var languageVersion: kotlin.String? = null
private var useK2Field: kotlin.Boolean? = null
override var useK2: kotlin.Boolean
get() = useK2Field ?: false
set(value) {
useK2Field = value
}
internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) {
allWarningsAsErrorsField?.let { args.allWarningsAsErrors = it }
suppressWarningsField?.let { args.suppressWarnings = it }
verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it }
useK2Field?.let { args.useK2 = it }
}
}
internal fun org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments.fillDefaultValues() {
allWarningsAsErrors = false
suppressWarnings = false
verbose = false
apiVersion = null
languageVersion = null
useK2 = false
}
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.gradle.dsl
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
internal class KotlinMultiplatformCommonOptionsImpl : KotlinMultiplatformCommonOptionsBase() {
override var freeCompilerArgs: List<String> = listOf()
override fun updateArguments(args: K2MetadataCompilerArguments) {
super.updateArguments(args)
copyFreeCompilerArgsToArgs(args)
}
}
+4
View File
@@ -57,6 +57,10 @@
# The appropriate jar is either loaded separately or added explicitly to the classpath then needed # The appropriate jar is either loaded separately or added explicitly to the classpath then needed
-dontwarn org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar -dontwarn org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar
# Ignore generated Gradle DSL types
# They will be added separately on generating Gradle DSL for compiler options
-dontwarn org.jetbrains.kotlin.cli.common.arguments.DefaultValues$*
-dontwarn org.jdom.xpath.jaxen.* -dontwarn org.jdom.xpath.jaxen.*
-dontwarn com.intellij.util.io.Decompressor* -dontwarn com.intellij.util.io.Decompressor*
-dontwarn org.w3c.dom.Location -dontwarn org.w3c.dom.Location