Generate KotlinMultiplatformCommonOptions and <...>OptionsBase.

This commit is contained in:
Sergey Igushkin
2017-10-09 15:47:37 +03:00
parent 8cdef4139e
commit e06d60174d
3 changed files with 97 additions and 0 deletions
@@ -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<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)
}
}
fun main(args: Array<String>) {
@@ -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 {
}
@@ -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
}