mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Build: Extract android-dx to separate project with publishing
This commit is contained in:
111
dependencies/android-dx/build.gradle.kts
vendored
Normal file
111
dependencies/android-dx/build.gradle.kts
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
base
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
apply(from = "../../gradle/versions.gradle.kts")
|
||||
|
||||
val androidBuildToolsVersion = extra["versions.androidBuildTools"] as String
|
||||
val androidDxSourcesVersion = extra["versions.androidDxSources"] as String
|
||||
|
||||
group = "org.jetbrains.kotlin"
|
||||
version = androidBuildToolsVersion
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
url = URI("https://dl.google.com/android/repository")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact]_[revision](-[classifier]).[ext]")
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ivy {
|
||||
url = URI("https://android.googlesource.com/platform/dalvik/+archive/android-$androidDxSourcesVersion")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact].[ext]")
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val androidBuildTools by configurations.creating
|
||||
val androidDxSources by configurations.creating
|
||||
|
||||
val androidDxRevision = androidBuildToolsVersion
|
||||
|
||||
dependencies {
|
||||
androidBuildTools("google:build-tools:$androidBuildToolsVersion:linux@zip")
|
||||
androidDxSources("google:dx:0@tar.gz")
|
||||
}
|
||||
|
||||
val unzipDxJar by tasks.creating {
|
||||
val outputDir = File(buildDir, name)
|
||||
val outputFile = File(outputDir, "dx.jar")
|
||||
|
||||
dependsOn(androidBuildTools)
|
||||
inputs.files(androidBuildTools)
|
||||
outputs.files(outputFile)
|
||||
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(zipTree(androidBuildTools.singleFile).files)
|
||||
include("**/dx.jar")
|
||||
into(outputDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val untarDxSources by tasks.creating {
|
||||
val dxSourcesTargetDir = File(buildDir, name)
|
||||
dependsOn(androidDxSources)
|
||||
inputs.files(androidDxSources)
|
||||
outputs.dir(dxSourcesTargetDir)
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(tarTree(androidDxSources.singleFile))
|
||||
include("src/**")
|
||||
includeEmptyDirs = false
|
||||
into(dxSourcesTargetDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val prepareDxSourcesJar by tasks.creating(Jar::class) {
|
||||
dependsOn(untarDxSources)
|
||||
from(untarDxSources)
|
||||
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
|
||||
val dxArtifact = artifacts.add("default", unzipDxJar.outputs.files.singleFile) {
|
||||
builtBy(unzipDxJar)
|
||||
}
|
||||
|
||||
artifacts.add("default", prepareDxSourcesJar)
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
artifact(dxArtifact)
|
||||
artifact(prepareDxSourcesJar)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("${rootProject.buildDir}/internal/repo")
|
||||
}
|
||||
}
|
||||
}
|
||||
0
dependencies/android-dx/settings.gradle
vendored
Normal file
0
dependencies/android-dx/settings.gradle
vendored
Normal file
Reference in New Issue
Block a user