diff --git a/build-tools/build.gradle.kts b/build-tools/build.gradle.kts new file mode 100644 index 00000000000..2f9b3ffff2b --- /dev/null +++ b/build-tools/build.gradle.kts @@ -0,0 +1,82 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.util.Properties + +plugins { + // We explicitly configure versions of plugins in settings.gradle.kts. + // due to https://github.com/gradle/gradle/issues/1697. + id("kotlin") + id("kotlinx-serialization") + groovy + `java-gradle-plugin` +} + +val rootProperties = Properties().apply { + rootDir.resolve("../gradle.properties").reader().use(::load) +} + +val kotlinVersion: String by rootProperties +val kotlinCompilerRepo: String by rootProperties +val buildKotlinVersion: String by rootProperties +val buildKotlinCompilerRepo: String by rootProperties +val konanVersion: String by rootProperties + +group = "org.jetbrains.kotlin" +version = konanVersion + +repositories { + maven(kotlinCompilerRepo) + maven(buildKotlinCompilerRepo) + maven("https://cache-redirector.jetbrains.com/maven-central") + maven("https://kotlin.bintray.com/kotlinx") +} + +dependencies { + compileOnly(gradleApi()) + + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") + implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") + implementation("com.ullink.slack:simpleslackapi:1.2.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.10.0") + + implementation("io.ktor:ktor-client-auth:1.2.1") + implementation("io.ktor:ktor-client-core:1.2.1") + implementation("io.ktor:ktor-client-cio:1.2.1") + + api("org.jetbrains.kotlin:kotlin-native-utils:$kotlinVersion") + + // Located in /shared and always provided by the composite build. + api("org.jetbrains.kotlin:kotlin-native-shared:$konanVersion") +} + +sourceSets["main"].withConvention(KotlinSourceSet::class) { + kotlin.srcDir("$projectDir/../tools/benchmarks/shared/src") +} + +gradlePlugin { + plugins { + create("benchmarkPlugin") { + id = "benchmarking" + implementationClass = "org.jetbrains.kotlin.benchmark.BenchmarkingPlugin" + } + create("compileBenchmarking") { + id = "compile-benchmarking" + implementationClass = "org.jetbrains.kotlin.benchmark.CompileBenchmarkingPlugin" + } + } +} + +val compileKotlin: KotlinCompile by tasks +val compileGroovy: GroovyCompile by tasks + +// Add Kotlin classes to a classpath for the Groovy compiler +compileGroovy.apply { + classpath += project.files(compileKotlin.destinationDir) + dependsOn(compileKotlin) +} \ No newline at end of file diff --git a/build-tools/settings.gradle.kts b/build-tools/settings.gradle.kts new file mode 100644 index 00000000000..784941bed23 --- /dev/null +++ b/build-tools/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val rootProperties = java.util.Properties().apply { + rootDir.resolve("../gradle.properties").reader().use(::load) + } + + val kotlinCompilerRepo: String by rootProperties + val kotlinVersion by rootProperties + + repositories { + maven(kotlinCompilerRepo) + maven("https://cache-redirector.jetbrains.com/maven-central") + } + + resolutionStrategy { + eachPlugin { + if (requested.id.id == "kotlin") { + useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + } + if (requested.id.id == "kotlinx-serialization") { + useModule("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") + } + } + } +} + +rootProject.name = "kotlin-native-build-tools" + +includeBuild("../shared") diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy b/build-tools/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy similarity index 100% rename from buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy rename to build-tools/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy similarity index 100% rename from buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy rename to build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/build-tools/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy similarity index 100% rename from buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy rename to build-tools/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/BuildRegister.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/BuildRegister.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/BuildRegister.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/BuildRegister.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/CopyCommonSources.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopyCommonSources.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/CopyCommonSources.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/CopyCommonSources.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/CopySamples.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecLlvm.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecLlvm.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecLlvm.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecLlvm.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExternalReportUtils.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExternalReportUtils.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExternalReportUtils.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/ExternalReportUtils.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Internals.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Internals.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Internals.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/Internals.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KLibInstall.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/KLibInstall.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KLibInstall.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/KLibInstall.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KonanTestSuiteReport.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/KonanTestSuiteReport.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KonanTestSuiteReport.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/KonanTestSuiteReport.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KotlinBuildPusher.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinBuildPusher.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KotlinBuildPusher.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinBuildPusher.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/MPPTools.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/MPPTools.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/MPPTools.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/MPPTools.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RegressionsReporter.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/RegressionsReporter.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RegressionsReporter.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/RegressionsReporter.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RegressionsSummaryReporter.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/RegressionsSummaryReporter.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RegressionsSummaryReporter.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/RegressionsSummaryReporter.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Reporter.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Reporter.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Reporter.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/Reporter.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunBenchmarksExecutableTask.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/RunBenchmarksExecutableTask.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunBenchmarksExecutableTask.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/RunBenchmarksExecutableTask.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunJvmTask.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/RunJvmTask.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunJvmTask.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/RunJvmTask.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunKotlinNativeTask.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/RunKotlinNativeTask.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/RunKotlinNativeTask.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/RunKotlinNativeTask.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/TestDirectives.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/TestDirectives.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/TestDirectives.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/TestDirectives.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Utils.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Utils.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/Wrappers.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/benchmark/BenchmarkingPlugin.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/benchmark/BenchmarkingPlugin.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/benchmark/BenchmarkingPlugin.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/benchmark/BenchmarkingPlugin.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/benchmark/CompileBenchmarkingPlugin.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/benchmark/CompileBenchmarkingPlugin.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/benchmark/CompileBenchmarkingPlugin.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/benchmark/CompileBenchmarkingPlugin.kt diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/coroutineTestUtil.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/coroutineTestUtil.kt similarity index 100% rename from buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/coroutineTestUtil.kt rename to build-tools/src/main/kotlin/org/jetbrains/kotlin/coroutineTestUtil.kt diff --git a/build.gradle b/build.gradle index 495821043ce..9087a905594 100644 --- a/build.gradle +++ b/build.gradle @@ -25,10 +25,14 @@ buildscript { repositories { maven { url kotlinCompilerRepo } + maven { url "https://kotlin.bintray.com/kotlinx" } + maven { url "https://cache-redirector.jetbrains.com/maven-central" } } dependencies { + classpath "org.jetbrains.kotlin:kotlin-native-utils:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion" + classpath "org.jetbrains.kotlin:kotlin-native-build-tools:$konanVersion" } } import org.jetbrains.kotlin.konan.* diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 90b0cd9e375..00000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,44 +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. - */ - -buildscript { - val rootBuildDirectory = "$rootDir/.." - extra["rootBuildDirectory"] = rootBuildDirectory - apply(from = "$rootBuildDirectory/gradle/loadRootProperties.gradle") - apply(from = "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle") -} - -val buildKotlinCompilerRepo: String by project -val kotlinCompilerRepo: String by project - -val repos = listOf( - buildKotlinCompilerRepo, - kotlinCompilerRepo, - "https://cache-redirector.jetbrains.com/maven-central", - "https://kotlin.bintray.com/kotlinx" -) - -allprojects { - repositories { - repos.forEach { repoUrl -> - maven { setUrl(repoUrl) } - } - } -} - -dependencies { - runtime(project(":plugins")) -} diff --git a/buildSrc/plugins/build.gradle b/buildSrc/plugins/build.gradle deleted file mode 100644 index b2c8022cfc9..00000000000 --- a/buildSrc/plugins/build.gradle +++ /dev/null @@ -1,74 +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. - */ - -apply plugin: 'groovy' -apply plugin: 'kotlin' - -buildscript { - ext.rootBuildDirectory = "$rootDir/.." - apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle" - apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle" - dependencies{ - classpath "org.jetbrains.kotlin:kotlin-serialization:$buildKotlinVersion" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - } - -} - -apply plugin: 'kotlin' -apply plugin: 'kotlinx-serialization' -apply plugin: 'java-gradle-plugin' - -/* don't use repositories: gradle will ignore it anyway, but may confuse gradle build engineer, see outer build.gradle */ - -dependencies { - compile gradleApi() - compile localGroovy() - compile "org.jetbrains.kotlin:kotlin-stdlib:$buildKotlinVersion" - compile "org.jetbrains.kotlin:kotlin-reflect:$buildKotlinVersion" - compile group: 'com.ullink.slack', name: 'simpleslackapi', version: '1.2.0' - // An artifact from the included build 'shared' cannot be used here due to https://github.com/gradle/gradle/issues/3768 - implementation "org.jetbrains.kotlin:kotlin-gradle-plugin" - compile project(':shared') - compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.10.0" - implementation 'io.ktor:ktor-client-auth:1.2.1' - implementation 'io.ktor:ktor-client-core:1.2.1' - implementation 'io.ktor:ktor-client-cio:1.2.1' -} - -sourceSets.main.kotlin.srcDirs = ["src", "$projectDir/../../tools/benchmarks/shared/src"] - -rootProject.dependencies { - runtime project(path) -} - -compileGroovy { - // Add Kotlin classes to a classpath for the Groovy compiler - classpath += project.files(compileKotlin.destinationDir) -} - -gradlePlugin { - plugins { - benchmarkPlugin { - id = "benchmarking" - implementationClass = "org.jetbrains.kotlin.benchmark.BenchmarkingPlugin" - } - compileBenchmarking { - id = "compile-benchmarking" - implementationClass = "org.jetbrains.kotlin.benchmark.CompileBenchmarkingPlugin" - } - } -} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts deleted file mode 100644 index 9b10c7ee710..00000000000 --- a/buildSrc/settings.gradle.kts +++ /dev/null @@ -1,18 +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. - */ - -include(":plugins") -include(":shared") \ No newline at end of file diff --git a/buildSrc/shared/build.gradle b/buildSrc/shared/build.gradle deleted file mode 100644 index bee13ca01d6..00000000000 --- a/buildSrc/shared/build.gradle +++ /dev/null @@ -1,44 +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. - */ - -buildscript { - ext { - gradleProperties = new Properties() - gradleProperties.load(new FileInputStream("$projectDir/../../gradle.properties")) - buildKotlinVersion = gradleProperties."buildKotlinVersion" - buildKotlinCompilerRepo = gradleProperties."buildKotlinCompilerRepo" - } - - apply from: '../../gradle/kotlinGradlePlugin.gradle' -} - -apply plugin: 'kotlin' - -// We reuse the source code from the Project in buildSrc. -sourceSets.main.kotlin.srcDirs = ["$projectDir/../../shared/src/main/kotlin"] - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$buildKotlinVersion" - compile "org.jetbrains.kotlin:kotlin-native-utils:$kotlinVersion" -} - -rootProject.dependencies { - runtime project(path) -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index be5d05636d3..5ab581f60dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # -# Copyright 2010-2017 JetBrains s.r.o. +# Copyright 2010-2019 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. @@ -26,8 +26,3 @@ testKotlinCompilerVersion=1.3.50-dev-1455 konanVersion=1.3.50 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.workers.max=4 -#kotlinProjectPath=/Users/jetbrains/IdeaProjects/kotlin -#sharedProjectPath=/Users/jetbrains/IdeaProjects/kotlin-native-shared -#kotlinProjectPath=/Users/jetbrains/kotlin-native/kotlin -#sharedProjectPath=/Users/jetbrains/kotlin-native/kotlin-native-shared/kotlin-native-shared - diff --git a/gradle/kotlinGradlePlugin.gradle b/gradle/kotlinGradlePlugin.gradle index 0cb74d7d1e7..8ed6b6e3dae 100644 --- a/gradle/kotlinGradlePlugin.gradle +++ b/gradle/kotlinGradlePlugin.gradle @@ -1,13 +1,12 @@ -if (!hasProperty('buildKotlinVersion')) { - throw new GradleException('Please ensure the "buildKotlinVersion" property is defined before applying this script.') -} +def properties = ['buildKotlinVersion', 'buildKotlinCompilerRepo', 'kotlinVersion', 'kotlinCompilerRepo'] -if (!hasProperty('buildKotlinCompilerRepo')) { - throw new GradleException('Please ensure the "buildKotlinCompilerRepo" property is defined before applying this script.') +for (prop in properties) { + if (!hasProperty(prop)) { + throw new GradleException("Please ensure the '$prop' property is defined before applying this script.") + } } project.buildscript.repositories { - maven { url buildKotlinCompilerRepo } diff --git a/performance/build.gradle b/performance/build.gradle index e3c7167e449..5fde30aa992 100644 --- a/performance/build.gradle +++ b/performance/build.gradle @@ -4,24 +4,16 @@ import org.jetbrains.kotlin.BuildRegister import org.jetbrains.kotlin.MPPTools buildscript { - ext.rootBuildDirectory = file('..') - - apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle" - apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle" + apply from: "$rootProject.projectDir/gradle/kotlinGradlePlugin.gradle" repositories { maven { url 'https://cache-redirector.jetbrains.com/jcenter' } - maven { - url kotlinCompilerRepo - } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } +def rootBuildDirectory = rootProject.projectDir + task konanRun { subprojects.each { dependsOn it.getTasksByName('konanRun', true)[0] diff --git a/performance/framework/build.gradle b/performance/framework/build.gradle index 059d05e98b7..40cd5a5ac75 100644 --- a/performance/framework/build.gradle +++ b/performance/framework/build.gradle @@ -3,22 +3,12 @@ import org.jetbrains.kotlin.PlatformInfo import org.jetbrains.kotlin.RunJvmTask buildscript { - ext.rootBuildDirectory = file('../..') - - apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle" - apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle" + apply from: "$rootProject.projectDir/gradle/kotlinGradlePlugin.gradle" repositories { maven { url 'https://cache-redirector.jetbrains.com/jcenter' } - maven { - url kotlinCompilerRepo - } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } diff --git a/performance/swiftinterop/build.gradle b/performance/swiftinterop/build.gradle index 68f51df90bd..2a3ce855ebb 100644 --- a/performance/swiftinterop/build.gradle +++ b/performance/swiftinterop/build.gradle @@ -6,22 +6,11 @@ import org.jetbrains.kotlin.UtilsKt import java.nio.file.Paths buildscript { - ext.rootBuildDirectory = file('../..') - - apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle" - apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle" - + apply from: "$rootProject.projectDir/gradle/kotlinGradlePlugin.gradle" repositories { maven { url 'https://cache-redirector.jetbrains.com/jcenter' } - maven { - url kotlinCompilerRepo - } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } diff --git a/platformLibs/build.gradle b/platformLibs/build.gradle index 62114dd7685..c977135110a 100644 --- a/platformLibs/build.gradle +++ b/platformLibs/build.gradle @@ -4,8 +4,6 @@ import org.jetbrains.kotlin.konan.util.* import static org.jetbrains.kotlin.konan.util.VisibleNamedKt.getVisibleName -apply plugin: 'konan' - buildscript { repositories { maven { @@ -14,18 +12,27 @@ buildscript { maven { url buildKotlinCompilerRepo } + maven { + url kotlinCompilerRepo + } + maven { + url "https://kotlin.bintray.com/kotlinx" + } } dependencies { classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion" + classpath "org.jetbrains.kotlin:kotlin-native-build-tools:$konanVersion" } - - ext.konanHome = distDir.absolutePath - def jvmArguments = [project.findProperty("platformLibsJvmArgs") ?: "-Xmx6G", *HostManager.defaultJvmArgs] - ext.jvmArgs = jvmArguments.join(" ") - ext.setProperty("org.jetbrains.kotlin.native.home", konanHome) - ext.setProperty("konan.jvmArgs", jvmArgs) } +// These properties are used by the 'konan' plugin, thus we set them before applying it. +ext.konanHome = distDir.absolutePath +def jvmArguments = [project.findProperty("platformLibsJvmArgs") ?: "-Xmx6G", *HostManager.defaultJvmArgs] +ext.jvmArgs = jvmArguments.join(" ") +ext.setProperty("org.jetbrains.kotlin.native.home", konanHome) +ext.setProperty("konan.jvmArgs", jvmArgs) + +apply plugin: 'konan' //#region Util functions. private ArrayList targetDefFiles(KonanTarget target) { diff --git a/settings.gradle b/settings.gradle index a1fcba03218..0340ff9d754 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.PlatformInfo -import org.jetbrains.kotlin.konan.target.HostManager /* * Copyright 2010-2017 JetBrains s.r.o. @@ -32,22 +30,19 @@ include ':common' include ':backend.native:tests' include ':backend.native:debugger-tests' include ':utilities' + include ':performance' include ':performance:ring' include ':performance:cinterop' include ':performance:helloworld' include ':performance:videoplayer' include ':performance:framework' -if (PlatformInfo.isAppleTarget(HostManager.host)) { +if (System.getProperty("os.name") == "Mac OS X") { include ':performance:objcinterop' include ':performance:swiftinterop' } -include ':platformLibs' -includeBuild 'shared' -includeBuild 'extracted/konan.metadata' -includeBuild 'extracted/konan.serializer' -includeBuild 'tools/kotlin-native-gradle-plugin' +include ':platformLibs' if (hasProperty("kotlinProjectPath")) { include ':runtime:generator' @@ -56,12 +51,15 @@ if (hasProperty("kotlinProjectPath")) { substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler') substitute module("org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinStdlibVersion") with project(':include:kotlin-stdlib-common-sources') substitute module("org.jetbrains.kotlin:kotlin-stdlib-gen:$kotlinStdlibVersion") with project(':tools:kotlin-stdlib-gen') - substitute module("org.jetbrains.kotlin:kotlin-util-io:$kotlinVersion") with project(':kotlin-util-io') - substitute module("org.jetbrains.kotlin:kotlin-util-klib:$kotlinVersion") with project(':kotlin-util-klib') + substitute module("org.jetbrains.kotlin:kotlin-util-io") with project(':kotlin-util-io') + substitute module("org.jetbrains.kotlin:kotlin-util-klib") with project(':kotlin-util-klib') + substitute module("org.jetbrains.kotlin:kotlin-native-utils") with project(':kotlin-native:kotlin-native-utils') } } } -if (hasProperty("sharedProjectPath")) { - includeBuild(sharedProjectPath) -} +includeBuild 'shared' +includeBuild 'build-tools' +includeBuild 'extracted/konan.metadata' +includeBuild 'extracted/konan.serializer' +includeBuild 'tools/kotlin-native-gradle-plugin'