Switch native-platform usages to regular dependency

This commit is contained in:
Ilya Chernikov
2017-11-09 16:26:47 +01:00
committed by Vyacheslav Gerasimov
parent 4a47fb3ffb
commit 78d2c655d5
5 changed files with 36 additions and 59 deletions
+15 -1
View File
@@ -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",
+5 -2
View File
@@ -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")}")
+2 -1
View File
@@ -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
+13 -7
View File
@@ -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<String> 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>("shadowJar")) {
from(the<JavaPluginConvention>().sourceSets.getByName("main").output)
from(fatJarContents)
}
sourcesJar()
javadocJar()
+1 -48
View File
@@ -31,8 +31,6 @@
<property name="gradle.libs.repo" value="http://repo.gradle.org/gradle/libs-releases-local"/>
<property name="native-platform-lib-version" value="0.14"/>
<property file="${dependencies.info.file}" prefix="dependencies.info.prev"/>
<target name="update" depends="fetch-third-party,fetch-annotations" description="Update dependencies">
@@ -119,52 +117,7 @@
</sequential>
</macrodef>
<target name="make-native-platform-uberjar">
<property name="dependencies" value="${dependencies}"/>
<property name="download" value="${dependencies}/download"/>
<property name="server" value="${gradle.libs.repo}"/>
<property name="version" value="${native-platform-lib-version}"/>
<property name="common.name" value="native-platform"/>
<property name="common.prefix" value="${server}/net/rubygrapefruit/${common.name}"/>
<macrodef name="get-lib">
<attribute name="suffix"/>
<sequential>
<get src="${common.prefix}@{suffix}/${version}/${common.name}@{suffix}-${version}.jar" dest="${download}/${common.name}@{suffix}.jar" usetimestamp="true"/>
</sequential>
</macrodef>
<mkdir dir="${dependencies}"/>
<mkdir dir="${download}"/>
<get-lib suffix=""/>
<get-lib suffix="-windows-amd64"/>
<get-lib suffix="-windows-i386"/>
<get-lib suffix="-osx-amd64"/>
<get-lib suffix="-osx-i386"/>
<get-lib suffix="-linux-amd64"/>
<get-lib suffix="-linux-i386"/>
<get-lib suffix="-freebsd-amd64-libcpp"/>
<get-lib suffix="-freebsd-amd64-libstdcpp"/>
<get-lib suffix="-freebsd-i386-libcpp"/>
<get-lib suffix="-freebsd-i386-libstdcpp"/>
<jar destfile="${dependencies}/${common.name}-uberjar.jar">
<zipfileset src="${download}/${common.name}.jar" includes="**" />
<zipfileset src="${download}/${common.name}-windows-amd64.jar" includes="**" />
<zipfileset src="${download}/${common.name}-windows-i386.jar" includes="**" />
<zipfileset src="${download}/${common.name}-osx-amd64.jar" includes="**" />
<zipfileset src="${download}/${common.name}-osx-i386.jar" includes="**" />
<zipfileset src="${download}/${common.name}-linux-amd64.jar" includes="**" />
<zipfileset src="${download}/${common.name}-linux-i386.jar" includes="**" />
<zipfileset src="${download}/${common.name}-freebsd-amd64-libcpp.jar" includes="**" />
<zipfileset src="${download}/${common.name}-freebsd-amd64-libstdcpp.jar" includes="**" />
<zipfileset src="${download}/${common.name}-freebsd-i386-libcpp.jar" includes="**" />
<zipfileset src="${download}/${common.name}-freebsd-i386-libstdcpp.jar" includes="**" />
</jar>
</target>
<target name="fetch-third-party" depends="get-ivy-library, make-dependency-dirs, make-native-platform-uberjar">
<target name="fetch-third-party" depends="get-ivy-library, make-dependency-dirs">
<!-- ProGuard -->
<get-maven-library prefix="net/sf/proguard" lib="proguard-base" version="5.3" target.jar.name.base="proguard" src="false"/>
<get-maven-library prefix="net/sf/proguard" lib="proguard-anttask" version="5.3" target.jar.name.base="proguard-anttask" src="false"/>