-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Non-deprecated 'jmhJar' configuration (#2032) (+9 squashed commits) Squashed commits: [8d07d36] Use new Kotlin/JS plugin (#1983) * Use new Kotlin/JS plugin * Support legacy DCE mode for 1.4-M2 [d224640] Add Dokka configuration method [56e1c9b] Dokka plugin in 'buildSrc' [dfdd202] Remove unused repositories [4cf1d02] Kotlin DSL - 'javafx' [d8f7d50] Avoid task name duplication [f06a56b] Avoid task name duplication [a09df3d] Separate 'UnpackAar' action [fd5bf6b] Separate 'RunR8' task
- Loading branch information
Showing
19 changed files
with
226 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import java.util.* | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
maven("https://kotlin.bintray.com/kotlin-eap") | ||
maven("https://kotlin.bintray.com/kotlin-dev") | ||
} | ||
|
||
kotlinDslPluginOptions { | ||
experimentalWarning.set(false) | ||
} | ||
|
||
val props = Properties().apply { | ||
file("../gradle.properties").inputStream().use { load(it) } | ||
} | ||
|
||
fun version(target: String): String = | ||
props.getProperty("${target}_version") | ||
|
||
dependencies { | ||
implementation(kotlin("gradle-plugin", version("kotlin"))) | ||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.delegateClosureOf | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
import java.io.File | ||
import java.net.URL | ||
|
||
fun Project.externalDocumentationLink( | ||
url: String, | ||
packageList: File = projectDir.resolve("package.list") | ||
) { | ||
tasks.withType<DokkaTask>().configureEach { | ||
externalDocumentationLink(delegateClosureOf<Builder> { | ||
this.url = URL(url) | ||
packageListUrl = packageList.toPath().toUri().toURL() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
@file:Suppress("UnstableApiUsage") | ||
|
||
import org.gradle.api.provider.* | ||
|
||
infix fun <T> Property<T>.by(value: T) { | ||
set(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.InputFiles | ||
import org.gradle.api.tasks.JavaExec | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.bundling.Zip | ||
import org.gradle.kotlin.dsl.get | ||
import org.gradle.kotlin.dsl.named | ||
import java.io.File | ||
|
||
open class RunR8 : JavaExec() { | ||
|
||
@OutputDirectory | ||
lateinit var outputDex: File | ||
|
||
@InputFile | ||
lateinit var inputConfig: File | ||
|
||
@InputFile | ||
val inputConfigCommon: File = File("testdata/r8-test-common.pro") | ||
|
||
@InputFiles | ||
val jarFile: File = project.tasks.named<Zip>("jar").get().archivePath | ||
|
||
init { | ||
classpath = project.configurations["r8"] | ||
main = "com.android.tools.r8.R8" | ||
} | ||
|
||
override fun exec() { | ||
// Resolve classpath only during execution | ||
val arguments = mutableListOf( | ||
"--release", | ||
"--no-desugaring", | ||
"--output", outputDex.absolutePath, | ||
"--pg-conf", inputConfig.absolutePath | ||
) | ||
arguments.addAll(project.configurations["runtimeClasspath"].files.map { it.absolutePath }) | ||
arguments.add(jarFile.absolutePath) | ||
|
||
args = arguments | ||
|
||
project.delete(outputDex) | ||
outputDex.mkdirs() | ||
|
||
super.exec() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import org.gradle.api.artifacts.transform.InputArtifact | ||
import org.gradle.api.artifacts.transform.TransformAction | ||
import org.gradle.api.artifacts.transform.TransformOutputs | ||
import org.gradle.api.artifacts.transform.TransformParameters | ||
import org.gradle.api.file.FileSystemLocation | ||
import org.gradle.api.provider.Provider | ||
import java.io.File | ||
import java.nio.file.Files | ||
import java.util.zip.ZipEntry | ||
import java.util.zip.ZipFile | ||
|
||
@Suppress("UnstableApiUsage") | ||
abstract class UnpackAar : TransformAction<TransformParameters.None> { | ||
@get:InputArtifact | ||
abstract val inputArtifact: Provider<FileSystemLocation> | ||
|
||
override fun transform(outputs: TransformOutputs) { | ||
ZipFile(inputArtifact.get().asFile).use { zip -> | ||
zip.entries().asSequence() | ||
.filter { !it.isDirectory } | ||
.filter { it.name.endsWith(".jar") } | ||
.forEach { zip.unzip(it, outputs.file(it.name)) } | ||
} | ||
} | ||
} | ||
|
||
private fun ZipFile.unzip(entry: ZipEntry, output: File) { | ||
getInputStream(entry).use { | ||
Files.copy(it, output.toPath()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.