From cce7b3cfdfad6859bdbcf829fb648f42532904dc Mon Sep 17 00:00:00 2001 From: Sergey Igushkin Date: Mon, 9 Oct 2017 15:48:22 +0300 Subject: [PATCH] Create KotlinMultiplatformCommonOptionsImpl.kt --- .../KotlinMultiplatformCommonOptionsImpl.kt | 28 +++++++++++++++++++ .../kotlin/gradle/dsl/optionsUtil.kt | 25 +++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsImpl.kt create mode 100644 libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/optionsUtil.kt diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsImpl.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsImpl.kt new file mode 100644 index 00000000000..3e3865ed69f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinMultiplatformCommonOptionsImpl.kt @@ -0,0 +1,28 @@ +/* + * 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 = listOf() + + override fun updateArguments(args: K2MetadataCompilerArguments) { + super.updateArguments(args) + copyFreeCompilerArgsToArgs(args) + } +} diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/optionsUtil.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/optionsUtil.kt new file mode 100644 index 00000000000..5e351aaaeaa --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/optionsUtil.kt @@ -0,0 +1,25 @@ +/* + * 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.CommonToolArguments + +fun KotlinCommonToolOptions.copyFreeCompilerArgsToArgs(args: CommonToolArguments) { + // cast to List is important because in Groovy a GString can be inside of a list + val freeArgs = (freeCompilerArgs as List).map(Any::toString) + args.freeArgs.addAll(freeArgs) +} \ No newline at end of file