Fix composite build against shared
Gradle executes buildSrc logic in a separate classloader. Thus we need to build sources of the composite shared in buildSrc and include them in runtime dependencies of the buildSrc:plugin project.
This commit is contained in:
committed by
Ilya Matveev
parent
14fb86d487
commit
270a53ac8b
@@ -43,13 +43,9 @@ dependencies {
|
|||||||
// Support composite build against kotlin-native-shared.
|
// Support composite build against kotlin-native-shared.
|
||||||
// Gradle cannot substitute a dependency in buildSrc by an included build.
|
// Gradle cannot substitute a dependency in buildSrc by an included build.
|
||||||
// See: https://github.com/gradle/gradle/issues/3768.
|
// See: https://github.com/gradle/gradle/issues/3768.
|
||||||
// Thus we have to compile sources of the included shared once more
|
// Thus we have to compile sources of the included shared once more to use it in buildSrc.
|
||||||
// and depend on them during buildSrc compilation.
|
if (project.hasProperty("sharedProjectPath")) {
|
||||||
// We don't add this dependency in the runtime scope because build scripts
|
compile project(':shared')
|
||||||
// already depend on kotlin-native-shared and this dependency is correctly
|
|
||||||
// substituted by the included build.
|
|
||||||
if (hasProperty("sharedProjectPath")) {
|
|
||||||
compileOnly project(':shared')
|
|
||||||
} else {
|
} else {
|
||||||
// If there is no composite build against shared, add a dependency on a published jar.
|
// If there is no composite build against shared, add a dependency on a published jar.
|
||||||
compile "org.jetbrains.kotlin:kotlin-native-shared:$sharedVersion"
|
compile "org.jetbrains.kotlin:kotlin-native-shared:$sharedVersion"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ plugins {
|
|||||||
|
|
||||||
val sharedProject = file(property("sharedProjectPath")!!).resolve("src")
|
val sharedProject = file(property("sharedProjectPath")!!).resolve("src")
|
||||||
|
|
||||||
kotlin.sourceSets["main"].kotlin.srcDirs.add(sharedProject)
|
kotlin.sourceSets["main"].kotlin.srcDirs(sharedProject)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|||||||
Reference in New Issue
Block a user