diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 6cdcd25f614..680f459799a 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -71,7 +71,7 @@ task copyGenerated(type: Copy) { task deleteGenerated(type: Delete) { dependsOn('copyGenerated') - delete 'build/generated' + delete 'build/generated/source/proto/compiler/java' } task renamePackage { diff --git a/build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt index 210f853a842..b37b3acd8e0 100644 --- a/build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt +++ b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt @@ -11,16 +11,13 @@ open class CustomWrapper : Wrapper() { val mainWrapperVersion: String @Input get() = mainWrapperTask.gradleVersion - val mainWrapperDistrType: DistributionType - @Input get() = mainWrapperTask.distributionType - val mainWrapperDistrUrl: String - @Input get() = mainWrapperTask.distributionUrl val mainWrapperDistrSha256: String? @Optional @Input get() = mainWrapperTask.distributionSha256Sum } open class WrappersExtension { var projects = mutableListOf() + var distributionType = Wrapper.DistributionType.BIN } class GradleWrappers : Plugin { @@ -38,16 +35,15 @@ class GradleWrappers : Plugin { this.mainWrapperTask = mainWrapperTask jarFile = it.resolve("gradle/wrapper/gradle-wrapper.jar") scriptFile = it.resolve("gradlew") + distributionType = wrappers.distributionType mainWrapperTask.dependsOn(this) // Get these parameters from the main wrapper task to support - // command line options like --gradle-version or --distribution-type. + // command line options like --gradle-version. // Gradle doesn't provide access to the values passed in command line - // at the configuration phase, so we have to get these values at execution phase. + // at the configuration phase, so we have to get these values at the execution phase. doFirst { gradleVersion = mainWrapperVersion - distributionType = mainWrapperDistrType - distributionUrl = mainWrapperDistrUrl distributionSha256Sum = mainWrapperDistrSha256 } } diff --git a/build.gradle b/build.gradle index 1c5a42787ee..e1b7f23a4c6 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,7 @@ import org.jetbrains.kotlin.konan.* // Run './gradlew wrapper --gradle-version ' to update all the wrappers. apply plugin: org.jetbrains.kotlin.GradleWrappers -wrappers.projects = ['samples', 'samples/calculator', 'samples/androidNativeActivity', 'samples/curl'] +wrappers.projects = ['samples', 'samples/calculator', 'samples/androidNativeActivity', 'samples/cocoapods/kotlin-library'] wrapper.distributionType = Wrapper.DistributionType.ALL defaultTasks 'clean', 'dist' diff --git a/extracted/konan.metadata/build.gradle b/extracted/konan.metadata/build.gradle index 4a19c6d652d..38441b31401 100644 --- a/extracted/konan.metadata/build.gradle +++ b/extracted/konan.metadata/build.gradle @@ -59,7 +59,7 @@ protobuf { compileJava { dependsOn('renamePackage') doFirst { - delete 'build/generated' + delete 'build/generated/source/proto/main/java' } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea141f..5c2d1cf016b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 10cb99e61a7..e0c4de36ddd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d517f..8e25e6c19d5 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..5c2d1cf016b 100644 Binary files a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar and b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties index 6b3851a8ad2..b0acbdcd73b 100644 --- a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties +++ b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/androidNativeActivity/gradlew b/samples/androidNativeActivity/gradlew index cccdd3d517f..8e25e6c19d5 100755 --- a/samples/androidNativeActivity/gradlew +++ b/samples/androidNativeActivity/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/samples/androidNativeActivity/gradlew.bat b/samples/androidNativeActivity/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/samples/androidNativeActivity/gradlew.bat +++ b/samples/androidNativeActivity/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/calculator/gradle/wrapper/gradle-wrapper.jar b/samples/calculator/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..5c2d1cf016b 100644 Binary files a/samples/calculator/gradle/wrapper/gradle-wrapper.jar and b/samples/calculator/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/calculator/gradle/wrapper/gradle-wrapper.properties b/samples/calculator/gradle/wrapper/gradle-wrapper.properties index 6b3851a8ad2..b0acbdcd73b 100644 --- a/samples/calculator/gradle/wrapper/gradle-wrapper.properties +++ b/samples/calculator/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/calculator/gradlew b/samples/calculator/gradlew index cccdd3d517f..8e25e6c19d5 100755 --- a/samples/calculator/gradlew +++ b/samples/calculator/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/samples/calculator/gradlew.bat b/samples/calculator/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/samples/calculator/gradlew.bat +++ b/samples/calculator/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.jar b/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..5c2d1cf016b 100644 Binary files a/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.jar and b/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.properties b/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.properties index 6b3851a8ad2..b0acbdcd73b 100644 --- a/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.properties +++ b/samples/cocoapods/kotlin-library/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/cocoapods/kotlin-library/gradlew b/samples/cocoapods/kotlin-library/gradlew index cccdd3d517f..8e25e6c19d5 100755 --- a/samples/cocoapods/kotlin-library/gradlew +++ b/samples/cocoapods/kotlin-library/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/samples/cocoapods/kotlin-library/gradlew.bat b/samples/cocoapods/kotlin-library/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/samples/cocoapods/kotlin-library/gradlew.bat +++ b/samples/cocoapods/kotlin-library/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/samples/gradle/wrapper/gradle-wrapper.jar b/samples/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..5c2d1cf016b 100644 Binary files a/samples/gradle/wrapper/gradle-wrapper.jar and b/samples/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/gradle/wrapper/gradle-wrapper.properties b/samples/gradle/wrapper/gradle-wrapper.properties index 6b3851a8ad2..b0acbdcd73b 100644 --- a/samples/gradle/wrapper/gradle-wrapper.properties +++ b/samples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/gradlew b/samples/gradlew index cccdd3d517f..8e25e6c19d5 100755 --- a/samples/gradlew +++ b/samples/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/samples/gradlew.bat b/samples/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/samples/gradlew.bat +++ b/samples/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeBinary.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeBinary.kt index c9662bce4a1..10baf88a981 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeBinary.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeBinary.kt @@ -62,7 +62,7 @@ abstract class AbstractKotlinNativeBinary( override val component: AbstractKotlinNativeComponent, val variant: KotlinNativeVariant, override val kind: CompilerOutputKind, - objects: ObjectFactory, + protected val objects: ObjectFactory, componentDependencies: KotlinNativeDependenciesImpl, configurations: ConfigurationContainer, val fileOperations: FileOperations @@ -129,8 +129,8 @@ abstract class AbstractKotlinNativeBinary( open fun isOptimized(): Boolean = optimized // TODO: Support native libraries - fun getLinkLibraries(): FileCollection = fileOperations.files() - fun getRuntimeLibraries(): FileCollection = fileOperations.files() + fun getLinkLibraries(): FileCollection = fileOperations.configurableFiles() + fun getRuntimeLibraries(): FileCollection = fileOperations.configurableFiles() fun getToolChain(): NativeToolChain = throw NotImplementedError("Kotlin/Native doesn't support the Gradle's toolchain model.") @@ -138,7 +138,7 @@ abstract class AbstractKotlinNativeBinary( /** A name of a root folder for this binary's output under the build directory. */ internal abstract val outputRootName: String - private val outputs: ConfigurableFileCollection = fileOperations.files() + private val outputs: ConfigurableFileCollection = fileOperations.configurableFiles() override fun getOutputs() = outputs override val additionalCompilerOptions: Collection diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeComponent.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeComponent.kt index 9a56c9d0521..b246e30bdcd 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeComponent.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/AbstractKotlinNativeComponent.kt @@ -55,7 +55,7 @@ abstract class AbstractKotlinNativeComponent @Inject constructor( val project: Project, val objectFactory: ObjectFactory, fileOperations: FileOperations -) : DefaultNativeComponent(fileOperations), +) : DefaultNativeComponent(objectFactory), KotlinNativeComponent, ComponentWithNames { diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeExecutableImpl.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeExecutableImpl.kt index 55b83d9ea98..1141e027f43 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeExecutableImpl.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeExecutableImpl.kt @@ -31,6 +31,7 @@ import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.language.cpp.internal.DefaultUsageContext import org.gradle.nativeplatform.Linkage +import org.gradle.nativeplatform.TargetMachine import org.jetbrains.kotlin.gradle.plugin.experimental.KotlinNativeExecutable import org.jetbrains.kotlin.konan.target.CompilerOutputKind import javax.inject.Inject @@ -79,4 +80,6 @@ open class KotlinNativeExecutableImpl @Inject constructor( } override val outputRootName = "exe" + + override fun getTargetMachine(): TargetMachine = konanTarget.toTargetMachine(objects) } diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeLibraryImpl.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeLibraryImpl.kt index 9dcddaf66a1..56a9920061b 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeLibraryImpl.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativeLibraryImpl.kt @@ -31,6 +31,7 @@ import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.language.cpp.internal.DefaultUsageContext import org.gradle.nativeplatform.Linkage +import org.gradle.nativeplatform.TargetMachine import org.jetbrains.kotlin.gradle.plugin.experimental.KotlinNativeLibrary import org.jetbrains.kotlin.konan.target.CompilerOutputKind import javax.inject.Inject @@ -81,4 +82,6 @@ open class KotlinNativeLibraryImpl @Inject constructor( override fun getLinkage(): Linkage? = Linkage.STATIC override val outputRootName = "lib" + + override fun getTargetMachine(): TargetMachine = konanTarget.toTargetMachine(objects) } diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativePlatform.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativePlatform.kt index 2d271ea9a6b..641e327c8af 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativePlatform.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/internal/KotlinNativePlatform.kt @@ -23,7 +23,9 @@ import org.gradle.api.model.ObjectFactory import org.gradle.api.provider.Provider import org.gradle.internal.os.OperatingSystem import org.gradle.language.cpp.internal.NativeVariantIdentity +import org.gradle.nativeplatform.MachineArchitecture import org.gradle.nativeplatform.OperatingSystemFamily +import org.gradle.nativeplatform.TargetMachine import org.gradle.nativeplatform.TargetMachineFactory import org.gradle.nativeplatform.platform.NativePlatform import org.gradle.nativeplatform.platform.internal.* @@ -47,6 +49,14 @@ fun KonanTarget.getGradleCPU(): ArchitectureInternal = architecture.visibleName. Architectures.forInput(it) } +fun KonanTarget.toTargetMachine(objectFactory: ObjectFactory): TargetMachine = object: TargetMachine { + override fun getOperatingSystemFamily(): OperatingSystemFamily = + getGradleOSFamily(objectFactory) + + override fun getArchitecture(): MachineArchitecture = + objectFactory.named(MachineArchitecture::class.java, this@toTargetMachine.architecture.visibleName) +} + class DefaultKotlinNativePlatform(name: String, override val target: KonanTarget): DefaultNativePlatform(name, target.getGradleOS(), target.getGradleCPU()), KotlinNativePlatform diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt index 53a4ce98b47..a7207244471 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt @@ -74,7 +74,7 @@ class KotlinNativePlugin @Inject constructor(val attributesFactory: ImmutableAtt attribute(KotlinPlatformType.attribute, KotlinPlatformType.native) attribute(KONAN_TARGET_ATTRIBUTE, target.name) } - return DefaultUsageContext(variantName + usageContextSuffix, usage, attributes) + return DefaultUsageContext(variantName + usageContextSuffix, attributes) } private fun AbstractKotlinNativeComponent.getAndLockTargets(): Set {