Switch all usages of dx.jar to the new mechanism, cleanup and refactoring

This commit is contained in:
Ilya Chernikov
2017-12-06 17:47:28 +01:00
committed by Vyacheslav Gerasimov
parent eabbebd458
commit 47507ad694
9 changed files with 35 additions and 20 deletions
+1 -1
View File
@@ -63,4 +63,4 @@ samWithReceiver {
fun Project.`samWithReceiver`(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit = fun Project.`samWithReceiver`(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit =
extensions.configure("samWithReceiver", configure) extensions.configure("samWithReceiver", configure)
tasks["build"].dependsOn(":prepare-deps:dx:build") tasks["build"].dependsOn(":prepare-deps:android-dx:build")
@@ -24,6 +24,8 @@ repositories {
} }
} }
val dxRepoDir = File(buildDir, "libs")
val buildToolsZip by configurations.creating val buildToolsZip by configurations.creating
val dxSourcesTar by configurations.creating val dxSourcesTar by configurations.creating
@@ -35,14 +37,12 @@ dependencies {
val unzipDxJar by tasks.creating { val unzipDxJar by tasks.creating {
dependsOn(buildToolsZip) dependsOn(buildToolsZip)
inputs.files(buildToolsZip) inputs.files(buildToolsZip)
val targetFile = File(buildDir, "dx.jar") outputs.files(File(dxRepoDir, "dx.jar"))
outputs.files(targetFile)
outputs.upToDateWhen { targetFile.exists() } // TODO: consider more precise check, e.g. hash-based
doFirst { doFirst {
project.copy { project.copy {
from(zipTree(buildToolsZip.singleFile).files) from(zipTree(buildToolsZip.singleFile).files)
include("**/dx.jar") include("**/dx.jar")
into(buildDir) into(dxRepoDir)
} }
} }
} }
@@ -52,8 +52,7 @@ val dxSourcesTargetDir = File(buildDir, "dx_src")
val untarDxSources by tasks.creating { val untarDxSources by tasks.creating {
dependsOn(dxSourcesTar) dependsOn(dxSourcesTar)
inputs.files(dxSourcesTar) inputs.files(dxSourcesTar)
outputs.files(dxSourcesTargetDir) outputs.dir(dxSourcesTargetDir)
outputs.upToDateWhen { dxSourcesTargetDir.isDirectory } // TODO: consider more precise check, e.g. hash-based
doFirst { doFirst {
project.copy { project.copy {
from(tarTree(dxSourcesTar.singleFile)) from(tarTree(dxSourcesTar.singleFile))
@@ -67,7 +66,7 @@ val untarDxSources by tasks.creating {
val prepareDxSourcesJar by tasks.creating(Jar::class) { val prepareDxSourcesJar by tasks.creating(Jar::class) {
dependsOn(untarDxSources) dependsOn(untarDxSources)
from("$dxSourcesTargetDir/src") from("$dxSourcesTargetDir/src")
destinationDir = buildDir destinationDir = dxRepoDir
baseName = "dx" baseName = "dx"
classifier = "sources" classifier = "sources"
} }
+1 -1
View File
@@ -1,3 +1,3 @@
include "prepare-deps:dx", include "prepare-deps:android-dx",
"prepare-deps:intellij-sdk" "prepare-deps:intellij-sdk"
@@ -0,0 +1,11 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
artifactPattern("${project.rootDir.absoluteFile.toURI().toURL()}/buildSrc/prepare-deps/android-dx/build/libs/[artifact](-[classifier]).jar")
}
fun androidDxJar() = "my-custom-deps:dx:0"
+5 -1
View File
@@ -6,6 +6,10 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin { configureIntellijPlugin {
setExtraDependencies("intellij-core") setExtraDependencies("intellij-core")
} }
@@ -62,7 +66,7 @@ dependencies {
testRuntime(projectDist(":kotlin-reflect")) testRuntime(projectDist(":kotlin-reflect"))
testRuntime(projectDist(":kotlin-daemon-client")) testRuntime(projectDist(":kotlin-daemon-client"))
testRuntime(project(":custom-dependencies:android-sdk", configuration = "dxJar")) testRuntime(androidDxJar())
testRuntime(files(toolsJar())) testRuntime(files(toolsJar()))
testJvm6ServerRuntime(projectTests(":compiler:tests-common-jvm6")) testJvm6ServerRuntime(projectTests(":compiler:tests-common-jvm6"))
+2 -4
View File
@@ -6,9 +6,7 @@ configureIntellijPlugin {
} }
repositories { repositories {
ivy { androidDxJarRepo(project)
artifactPattern("${rootDir.absoluteFile.toURI().toURL()}/buildSrc/prepare-deps/dx/build/[artifact](-[classifier]).jar")
}
} }
dependencies { dependencies {
@@ -35,7 +33,7 @@ dependencies {
testCompile(projectTests(":compiler:tests-common-jvm6")) testCompile(projectTests(":compiler:tests-common-jvm6"))
testCompileOnly(project(":kotlin-reflect-api")) testCompileOnly(project(":kotlin-reflect-api"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
testCompile("my-custom-deps:dx:0") testCompile(androidDxJar())
} }
afterEvaluate { afterEvaluate {
@@ -16,7 +16,6 @@ repositories {
val androidSdk by configurations.creating val androidSdk by configurations.creating
val androidJar by configurations.creating val androidJar by configurations.creating
val dxJar by configurations.creating
val androidPlatform by configurations.creating val androidPlatform by configurations.creating
val dxSources by configurations.creating val dxSources by configurations.creating
val buildTools by configurations.creating val buildTools by configurations.creating
+5 -5
View File
@@ -2,6 +2,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply { plugin("kotlin") } apply { plugin("kotlin") }
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin { configureIntellijPlugin {
setPlugins("android", "copyright", "coverage", "gradle", "Groovy", "IntelliLang", setPlugins("android", "copyright", "coverage", "gradle", "Groovy", "IntelliLang",
"java-decompiler", "java-i18n", "junit", "maven", "properties", "testng") "java-decompiler", "java-i18n", "junit", "maven", "properties", "testng")
@@ -21,7 +25,7 @@ dependencies {
compile(project(":idea:ide-common")) compile(project(":idea:ide-common"))
compile(project(":idea:idea-gradle")) compile(project(":idea:idea-gradle"))
compile(project(":custom-dependencies:android-sdk", configuration = "dxJar")) compile(androidDxJar())
testCompile(projectDist(":kotlin-test:kotlin-test-jvm")) testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false } testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
@@ -63,10 +67,6 @@ sourceSets {
"test" { projectDefault() } "test" { projectDefault() }
} }
tasks.withType<KotlinCompile> {
dependsOn(":custom-dependencies:android-sdk:extractDxJar")
}
projectTest { projectTest {
dependsOn(androidSdk) dependsOn(androidSdk)
workingDir = rootDir workingDir = rootDir
+4
View File
@@ -4,6 +4,10 @@ apply {
plugin("java") plugin("java")
} }
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin { configureIntellijPlugin {
setExtraDependencies("intellij-core") setExtraDependencies("intellij-core")
setPlugins("android") setPlugins("android")