From b97e82f60446506c96109498b6d4a81e00dd79b6 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Wed, 20 Jun 2018 23:14:16 +0300 Subject: [PATCH] Resolve bootstrap compiler classpath in root buildscript Temporary workaround for bootstrapping. Building the project with plugin version 1.2.60-dev-xxx and deployVersion='1.3-SNAPSHOT' fails because Gradle substitutes kotlin-stdlib dependency of kotlinCompilerClasspath configuration with project dependency ':kotlin-stdlib'. kotlinCompilerClasspath configuration is used to run the compiler, which cannot be started with not yet built ':kotlin-stdlib'. --- build.gradle.kts | 14 ++++++++++++++ build.gradle.kts.182 | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index f9750e4b39d..0d318b272fb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,7 +35,14 @@ buildscript { } } + // a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes + // kotlin-stdlib external dependency with local project :kotlin-stdlib in kotlinCompilerClasspath configuration. + // see also configureCompilerClasspath@ + val bootstrapCompilerClasspath by configurations.creating + dependencies { + bootstrapCompilerClasspath(kotlinDep("compiler-embeddable", bootstrapKotlinVersion)) + classpath("com.gradle.publish:plugin-publish-plugin:0.9.7") classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion)) classpath("net.sf.proguard:proguard-gradle:5.3.3") @@ -353,6 +360,13 @@ allprojects { task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } } task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } } } + + run configureCompilerClasspath@ { + val bootstrapCompilerClasspath by rootProject.buildscript.configurations + configurations.findByName("kotlinCompilerClasspath")?.let { + dependencies.add(it.name, files(bootstrapCompilerClasspath)) + } + } } } diff --git a/build.gradle.kts.182 b/build.gradle.kts.182 index e52e185b070..5452b359d62 100644 --- a/build.gradle.kts.182 +++ b/build.gradle.kts.182 @@ -35,7 +35,14 @@ buildscript { } } + // a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes + // kotlin-stdlib external dependency with local project :kotlin-stdlib in kotlinCompilerClasspath configuration. + // see also configureCompilerClasspath@ + val bootstrapCompilerClasspath by configurations.creating + dependencies { + bootstrapCompilerClasspath(kotlinDep("compiler-embeddable", bootstrapKotlinVersion)) + classpath("com.gradle.publish:plugin-publish-plugin:0.9.7") classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion)) classpath("net.sf.proguard:proguard-gradle:5.3.3") @@ -352,6 +359,13 @@ allprojects { task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } } task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } } } + + run configureCompilerClasspath@ { + val bootstrapCompilerClasspath by rootProject.buildscript.configurations + configurations.findByName("kotlinCompilerClasspath")?.let { + dependencies.add(it.name, files(bootstrapCompilerClasspath)) + } + } } }