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 =
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 dxSourcesTar by configurations.creating
@@ -35,14 +37,12 @@ dependencies {
val unzipDxJar by tasks.creating {
dependsOn(buildToolsZip)
inputs.files(buildToolsZip)
val targetFile = File(buildDir, "dx.jar")
outputs.files(targetFile)
outputs.upToDateWhen { targetFile.exists() } // TODO: consider more precise check, e.g. hash-based
outputs.files(File(dxRepoDir, "dx.jar"))
doFirst {
project.copy {
from(zipTree(buildToolsZip.singleFile).files)
include("**/dx.jar")
into(buildDir)
into(dxRepoDir)
}
}
}
@@ -52,8 +52,7 @@ val dxSourcesTargetDir = File(buildDir, "dx_src")
val untarDxSources by tasks.creating {
dependsOn(dxSourcesTar)
inputs.files(dxSourcesTar)
outputs.files(dxSourcesTargetDir)
outputs.upToDateWhen { dxSourcesTargetDir.isDirectory } // TODO: consider more precise check, e.g. hash-based
outputs.dir(dxSourcesTargetDir)
doFirst {
project.copy {
from(tarTree(dxSourcesTar.singleFile))
@@ -67,7 +66,7 @@ val untarDxSources by tasks.creating {
val prepareDxSourcesJar by tasks.creating(Jar::class) {
dependsOn(untarDxSources)
from("$dxSourcesTargetDir/src")
destinationDir = buildDir
destinationDir = dxRepoDir
baseName = "dx"
classifier = "sources"
}
+1 -1
View File
@@ -1,3 +1,3 @@
include "prepare-deps:dx",
include "prepare-deps:android-dx",
"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"
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
@@ -62,7 +66,7 @@ dependencies {
testRuntime(projectDist(":kotlin-reflect"))
testRuntime(projectDist(":kotlin-daemon-client"))
testRuntime(project(":custom-dependencies:android-sdk", configuration = "dxJar"))
testRuntime(androidDxJar())
testRuntime(files(toolsJar()))
testJvm6ServerRuntime(projectTests(":compiler:tests-common-jvm6"))
+2 -4
View File
@@ -6,9 +6,7 @@ configureIntellijPlugin {
}
repositories {
ivy {
artifactPattern("${rootDir.absoluteFile.toURI().toURL()}/buildSrc/prepare-deps/dx/build/[artifact](-[classifier]).jar")
}
androidDxJarRepo(project)
}
dependencies {
@@ -35,7 +33,7 @@ dependencies {
testCompile(projectTests(":compiler:tests-common-jvm6"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompile(commonDep("junit:junit"))
testCompile("my-custom-deps:dx:0")
testCompile(androidDxJar())
}
afterEvaluate {
@@ -16,7 +16,6 @@ repositories {
val androidSdk by configurations.creating
val androidJar by configurations.creating
val dxJar by configurations.creating
val androidPlatform by configurations.creating
val dxSources 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") }
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin {
setPlugins("android", "copyright", "coverage", "gradle", "Groovy", "IntelliLang",
"java-decompiler", "java-i18n", "junit", "maven", "properties", "testng")
@@ -21,7 +25,7 @@ dependencies {
compile(project(":idea:ide-common"))
compile(project(":idea:idea-gradle"))
compile(project(":custom-dependencies:android-sdk", configuration = "dxJar"))
compile(androidDxJar())
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
@@ -63,10 +67,6 @@ sourceSets {
"test" { projectDefault() }
}
tasks.withType<KotlinCompile> {
dependsOn(":custom-dependencies:android-sdk:extractDxJar")
}
projectTest {
dependsOn(androidSdk)
workingDir = rootDir
+4
View File
@@ -4,6 +4,10 @@ apply {
plugin("java")
}
repositories {
androidDxJarRepo(project)
}
configureIntellijPlugin {
setExtraDependencies("intellij-core")
setPlugins("android")