Reland "Move kotlin metadata printer out such that it can be used by tests"
This reverts commit 5e695e8ad8a3c59943443e119251435a83821bbd.
Change-Id: I6b6464a297b25a166c97b5b75f023720e1a59990
diff --git a/build.gradle b/build.gradle
index 39b8fc0..23f55dc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -911,14 +911,30 @@
destinationDir file('build/libs')
}
-task testJar(type: ShadowJar, dependsOn: [testClasses, buildLibraryDesugarConversions]) {
- baseName = "r8tests"
+task testJarSources(type: ShadowJar, dependsOn: [testClasses, buildLibraryDesugarConversions]) {
+ baseName = "r8testsbase"
from sourceSets.test.output
// We only want to include tests that use R8 when generating keep rules for applymapping.
include "com/android/tools/r8/**"
include "dalvik/**"
}
+task testJar(type: Exec) {
+ def output = "$buildDir/libs/r8tests.jar"
+ outputs.file output
+ workingDir = projectDir
+ inputs.files (testJarSources.outputs)
+ commandLine baseR8CommandLine([
+ "relocator",
+ "--input",
+ testJarSources.outputs.files[0],
+ "--output",
+ output,
+ "--map",
+ "kotlinx.metadata->com.android.tools.r8.jetbrains.kotlinx.metadata"
+ ])
+}
+
task generateR8LibKeepRules(type: Exec) {
doFirst {
// TODO(b/154785341): We should remove this.