From 78d2c655d514f2880c5d38ca99df8ebcd157df43 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Thu, 9 Nov 2017 16:26:47 +0100 Subject: [PATCH] Switch native-platform usages to regular dependency --- build.gradle.kts | 16 +++++- buildSrc/build.gradle.kts | 7 ++- buildSrc/src/main/kotlin/dependencies.kt | 3 +- .../daemon/daemon-client/build.gradle.kts | 20 +++++--- update_dependencies.xml | 49 +------------------ 5 files changed, 36 insertions(+), 59 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2988b572a89..5eeb764b13a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,8 @@ buildscript { "https://jcenter.bintray.com/", "https://plugins.gradle.org/m2") "https://plugins.gradle.org/m2", - "http://dl.bintray.com/kotlin/kotlinx") + "http://dl.bintray.com/kotlin/kotlinx", + "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform extra["repos"] = repos @@ -125,6 +126,7 @@ extra["versions.android"] = "2.3.1" extra["versions.kotlinx-coroutines-core"] = "0.14.1" extra["versions.kotlinx-coroutines-jdk8"] = "0.14.1" extra["versions.json"] = "20160807" +extra["versions.native-platform"] = "0.14" // the former "ideaSdk/core" dir contents without intellij-core.jar extra["IntellijCoreDependencies"] = @@ -141,6 +143,18 @@ extra["IntellijCoreDependencies"] = "xpp3-1.1.4-min.jar", "xstream-*.jar") +extra["nativePlatformVariants"] = + listOf("windows-amd64", + "windows-i386", + "osx-amd64", + "osx-i386", + "linux-amd64", + "linux-i386", + "freebsd-amd64-libcpp", + "freebsd-amd64-libstdcpp", + "freebsd-i386-libcpp", + "freebsd-i386-libstdcpp") + extra["compilerModules"] = arrayOf( ":compiler:util", ":compiler:container", diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b5fb46abda8..2b634deb7ab 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -4,6 +4,7 @@ buildscript { val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?) extra["versions.shadow"] = "2.0.1" extra["versions.intellij-plugin"] = "0.3.0-SNAPSHOT" + extra["versions.native-platform"] = "0.14" repositories { buildSrcKotlinRepo?.let { @@ -37,13 +38,15 @@ repositories { maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") // for intellij plugin maven(url = "http://dl.bintray.com/jetbrains/intellij-plugin-service") // for intellij plugin + maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform jcenter() } dependencies { - compile(files("../dependencies/native-platform-uberjar.jar")) + compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}") + compile("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}") + compile("net.rubygrapefruit:native-platform-windows-i386:${property("versions.native-platform")}") compile("com.jakewharton.dex:dex-method-list:2.0.0-alpha") -// compile("net.rubygrapefruit:native-platform:0.14") // TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment // compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}") compile("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}") diff --git a/buildSrc/src/main/kotlin/dependencies.kt b/buildSrc/src/main/kotlin/dependencies.kt index 6c26bf64dcc..547f944d4f4 100644 --- a/buildSrc/src/main/kotlin/dependencies.kt +++ b/buildSrc/src/main/kotlin/dependencies.kt @@ -21,7 +21,8 @@ fun Project.commonDep(coord: String): String { } } -fun Project.commonDep(group: String, artifact: String): String = "$group:$artifact:${rootProject.extra["versions.$artifact"]}" +fun Project.commonDep(group: String, artifact: String, vararg suffixesAndClassifiers: String): String = + "$group:$artifact${suffixesAndClassifiers.filterNot { it.startsWith(':') }.joinToString("")}:${rootProject.extra["versions.$artifact"]}${suffixesAndClassifiers.filter { it.startsWith(':') }.joinToString("")}" fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null, optional: Boolean = false): ConfigurableFileCollection { val dir = if (subdir != null) File(baseDir, subdir) else baseDir diff --git a/compiler/daemon/daemon-client/build.gradle.kts b/compiler/daemon/daemon-client/build.gradle.kts index 16af21748ba..e185c9afeb1 100644 --- a/compiler/daemon/daemon-client/build.gradle.kts +++ b/compiler/daemon/daemon-client/build.gradle.kts @@ -1,3 +1,4 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar description = "Kotlin Daemon Client" @@ -5,14 +6,21 @@ apply { plugin("kotlin") } jvmTarget = "1.6" -val nativePlatformUberjar = preloadedDeps("native-platform-uberjar") +val nativePlatformVariants: List by rootProject.extra + +val fatJarContents by configurations.creating dependencies { compileOnly(project(":compiler:util")) compileOnly(project(":compiler:cli-common")) compileOnly(project(":compiler:daemon-common")) compileOnly(project(":kotlin-reflect-api")) - compileOnly(nativePlatformUberjar) + compileOnly(commonDep("net.rubygrapefruit", "native-platform")) + fatJarContents(project(":compiler:daemon-common")) + fatJarContents(commonDep("net.rubygrapefruit", "native-platform")) + nativePlatformVariants.forEach { + fatJarContents(commonDep("net.rubygrapefruit", "native-platform", "-$it")) + } } sourceSets { @@ -20,11 +28,9 @@ sourceSets { "test" {} } -runtimeJar { - nativePlatformUberjar.forEach { - from(zipTree(it)) - } - from(getSourceSetsFrom(":compiler:daemon-common")["main"].output.classesDirs) +runtimeJar(task("shadowJar")) { + from(the().sourceSets.getByName("main").output) + from(fatJarContents) } sourcesJar() javadocJar() diff --git a/update_dependencies.xml b/update_dependencies.xml index 2175925feee..15088fd1019 100644 --- a/update_dependencies.xml +++ b/update_dependencies.xml @@ -31,8 +31,6 @@ - - @@ -119,52 +117,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +