Add build target for resource shrinker cli
This creates a build target for standalone resource shrinker
This is producing the same results on SystemUI when run as the current version in platform
Bug: 287398085
Change-Id: Ibe00bf58ff6f89d4e50d66d073481e13deea32b4
diff --git a/d8_r8/r8lib/build.gradle.kts b/d8_r8/r8lib/build.gradle.kts
index 60365ab..2e4bfa7 100644
--- a/d8_r8/r8lib/build.gradle.kts
+++ b/d8_r8/r8lib/build.gradle.kts
@@ -97,4 +97,19 @@
true,
listOf(deps))
}
+
+ val resourceshrinkercli by registering(Exec::class) {
+ dependsOn(r8WithRelocatedDepsTask)
+ val r8 = r8WithRelocatedDepsTask.outputs.files.getSingleFile()
+ val keepTxt = getRoot().resolveAll("src", "main", "resourceshrinker_cli.txt")
+ inputs.file(keepTxt)
+ val output = file(Paths.get("build", "libs", "resourceshrinkercli.jar"))
+ outputs.file(output)
+ commandLine = createR8LibCommandLine(
+ r8,
+ r8,
+ output,
+ listOf(keepTxt),
+ false)
+ }
}
diff --git a/src/main/resourceshrinker_cli.txt b/src/main/resourceshrinker_cli.txt
new file mode 100644
index 0000000..58424d9
--- /dev/null
+++ b/src/main/resourceshrinker_cli.txt
@@ -0,0 +1,7 @@
+# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+-keep class com.android.build.shrinker.ResourceShrinkerCli {
+ public static void main(java.lang.String[]);
+}