Support composite build against detached shared

This commit is contained in:
Ilya Matveev
2019-03-13 13:02:19 +07:00
committed by Ilya Matveev
parent 386b9a50f0
commit 8fd0ef395d
5 changed files with 51 additions and 5 deletions
-4
View File
@@ -23,10 +23,6 @@ import org.jetbrains.kotlin.konan.*
buildscript {
apply from: "gradle/kotlinGradlePlugin.gradle"
apply from: "gradle/kotlinNativeShared.gradle"
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-version:$konanVersion"
}
}
// Allows generating wrappers for the root build and all the samples during execution of the default 'wrapper' task.
+16 -1
View File
@@ -38,8 +38,23 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$buildKotlinVersion"
compile "org.jetbrains.kotlin:kotlin-reflect:$buildKotlinVersion"
compile group: 'com.ullink.slack', name: 'simpleslackapi', version: '0.6.0'
compile "org.jetbrains.kotlin:kotlin-native-shared:$sharedVersion"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.10.0"
// Support composite build against kotlin-native-shared.
// Gradle cannot substitute a dependency in buildSrc by an included build.
// See: https://github.com/gradle/gradle/issues/3768.
// Thus we have to compile sources of the included shared once more
// and depend on them during buildSrc compilation.
// We don't add this dependency in the runtime scope because build scripts
// already depend on kotlin-native-shared and this dependency is correctly
// substituted by the included build.
if (hasProperty("sharedProjectPath")) {
compileOnly project(':shared')
} else {
// If there is no composite build against shared, add a dependency on a published jar.
compile "org.jetbrains.kotlin:kotlin-native-shared:$sharedVersion"
}
}
rootProject.dependencies {
+4
View File
@@ -15,3 +15,7 @@
*/
include 'plugins'
if (hasProperty("sharedProjectPath")) {
include 'shared'
}
+27
View File
@@ -0,0 +1,27 @@
/*
* 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.
*/
plugins {
kotlin("jvm")
}
val sharedProject = file(property("sharedProjectPath")!!).resolve("src")
kotlin.sourceSets["main"].kotlin.srcDirs.add(sharedProject)
dependencies {
implementation(kotlin("stdlib"))
}
+4
View File
@@ -49,3 +49,7 @@ if (hasProperty("kotlinProjectPath")) {
}
}
}
if (hasProperty("sharedProjectPath")) {
includeBuild(sharedProjectPath)
}