diff --git a/buildSrc/src/main/kotlin/RunR8.kt b/buildSrc/src/main/kotlin/RunR8.kt deleted file mode 100644 index b0fccf89fc..0000000000 --- a/buildSrc/src/main/kotlin/RunR8.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -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 - -/* - * Task used by our ui/android tests to test minification results - * and keep track of size of the binary. - * TODO move back to kotlinx-coroutines-android when it's migrated to the kts - */ -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("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() - } -} diff --git a/ui/kotlinx-coroutines-android/build.gradle.kts b/ui/kotlinx-coroutines-android/build.gradle.kts index 2af2d4f3a9..9cec1dc9f0 100644 --- a/ui/kotlinx-coroutines-android/build.gradle.kts +++ b/ui/kotlinx-coroutines-android/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { testImplementation("org.robolectric:robolectric:${version("robolectric")}") testImplementation("org.smali:baksmali:${version("baksmali")}") - "r8"("com.android.tools.build:builder:7.0.0-alpha14") + "r8"("com.android.tools.build:builder:7.1.0-alpha01") } val optimizedDexDir = File(buildDir, "dex-optim/") @@ -41,24 +41,65 @@ val runR8NoOptim by tasks.registering(RunR8::class) { dependsOn("jar") } -// TODO: Disable the test until we have published version of R8 that supports Kotlin 1.5.0 metadata - -//tasks.test { -// // Ensure the R8-processed dex is built and supply its path as a property to the test. -// dependsOn(runR8) -// dependsOn(runR8NoOptim) -// -// inputs.files(optimizedDexFile, unOptimizedDexFile) -// -// systemProperty("dexPath", optimizedDexFile.absolutePath) -// systemProperty("noOptimDexPath", unOptimizedDexFile.absolutePath) -// -// // Output custom metric with the size of the optimized dex -// doLast { -// println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") -// } -//} +tasks.test { + // Ensure the R8-processed dex is built and supply its path as a property to the test. + dependsOn(runR8) + dependsOn(runR8NoOptim) + + inputs.files(optimizedDexFile, unOptimizedDexFile) + + systemProperty("dexPath", optimizedDexFile.absolutePath) + systemProperty("noOptimDexPath", unOptimizedDexFile.absolutePath) + + // Output custom metric with the size of the optimized dex + doLast { + println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") + } +} externalDocumentationLink( url = "https://developer.android.com/reference/" ) +/* + * Task used by our ui/android tests to test minification results and keep track of size of the binary. + */ +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("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", + "--min-api", "26", + "--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() + } +} +