diff --git a/generators/src/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt b/generators/src/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt index b6e83100149..38dacfba137 100644 --- a/generators/src/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt +++ b/generators/src/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt @@ -122,6 +122,25 @@ fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.() k2JsDceArgumentsFqName, commonOptions + jsDceOptions) } + + // generate multiplatform common interface and implementation + val multiplatformCommonInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonOptions") + val multiplatformCommonOptions = gradleOptions() + 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) + } + } fun main(args: Array) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptions.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptions.kt new file mode 100644 index 00000000000..68702d504c6 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptions.kt @@ -0,0 +1,22 @@ +/* + * 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. + */ + +// DO NOT EDIT MANUALLY! +// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt +package org.jetbrains.kotlin.gradle.dsl + +interface KotlinMultiplatformCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions { +} diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsBase.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsBase.kt new file mode 100644 index 00000000000..5f05d8fbad8 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsBase.kt @@ -0,0 +1,56 @@ +/* + * 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. + */ + +// DO NOT EDIT MANUALLY! +// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt +package org.jetbrains.kotlin.gradle.dsl + +internal abstract class KotlinMultiplatformCommonOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonOptions { + + 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 apiVersionField: kotlin.String?? = null + override var apiVersion: kotlin.String? + get() = apiVersionField ?: null + set(value) { apiVersionField = value } + + private var languageVersionField: kotlin.String?? = null + override var languageVersion: kotlin.String? + get() = languageVersionField ?: null + set(value) { languageVersionField = value } + + internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) { + suppressWarningsField?.let { args.suppressWarnings = it } + verboseField?.let { args.verbose = it } + apiVersionField?.let { args.apiVersion = it } + languageVersionField?.let { args.languageVersion = it } + } +} + +internal fun org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments.fillDefaultValues() { + suppressWarnings = false + verbose = false + apiVersion = null + languageVersion = null +}