Be more precise when relocating with shadowJar.
The patterns used for relocation were overly broad, leading to
unexpected (and unwanted) rewrites on unrelated strings, effectively
disabling the proto lite shaker.
I have made the patterns more precise and we should aim to keep then
that way.
Bug:
Change-Id: I2c50571386650ae436d8df54d613d6bb2175fdfd
diff --git a/build.gradle b/build.gradle
index 9a48a4d..78e7e94 100644
--- a/build.gradle
+++ b/build.gradle
@@ -326,10 +326,16 @@
// In order to build without dependencies, pass the exclude_deps property using:
// gradle -Pexclude_deps R8
if (!project.hasProperty('exclude_deps')) {
- // Relocating dependencies to avoid conflicts.
- relocate 'com.google', 'com.android.tools.r8.com.google'
+ // Relocating dependencies to avoid conflicts. Keep this as precise as possible
+ // to avoid rewriting unrelated strings.
+ relocate 'com.google.common', 'com.android.tools.r8.com.google.common'
+ relocate 'com.google.thirdparty', 'com.android.tools.r8.com.google.thirdparty'
relocate 'joptsimple', 'com.android.tools.r8.joptsimple'
- relocate 'org', 'com.android.tools.r8.org'
+ relocate 'org.apache.commons', 'com.android.tools.r8.org.apache.commons'
+ relocate 'org.objectweb.asm', 'com.android.tools.r8.org.objectweb.asm'
+ relocate 'org.junit', 'com.android.tools.r8.org.junit'
+ relocate 'org.hamcrest', 'com.android.tools.r8.org.hamcrest'
+ relocate 'org.json.simple', 'com.android.tools.r8.org.json.simple'
relocate 'it.unimi.dsi.fastutil', 'com.android.tools.r8.it.unimi.dsi.fastutil'
relocate 'junit', 'com.android.tools.r8.junit'
// Also include dependencies
@@ -348,10 +354,16 @@
// In order to build without dependencies, pass the exclude_deps property using:
// gradle -Pexclude_deps D8
if (!project.hasProperty('exclude_deps')) {
- // Relocating dependencies to avoid conflicts.
- relocate 'com.google', 'com.android.tools.r8.com.google'
+ // Relocating dependencies to avoid conflicts. Keep this as precise as possible
+ // to avoid rewriting unrelated strings.
+ relocate 'com.google.common', 'com.android.tools.r8.com.google.common'
+ relocate 'com.google.thirdparty', 'com.android.tools.r8.com.google.thirdparty'
relocate 'joptsimple', 'com.android.tools.r8.joptsimple'
- relocate 'org', 'com.android.tools.r8.org'
+ relocate 'org.apache.commons', 'com.android.tools.r8.org.apache.commons'
+ relocate 'org.objectweb.asm', 'com.android.tools.r8.org.objectweb.asm'
+ relocate 'org.junit', 'com.android.tools.r8.org.junit'
+ relocate 'org.hamcrest', 'com.android.tools.r8.org.hamcrest'
+ relocate 'org.json.simple', 'com.android.tools.r8.org.json.simple'
relocate 'it.unimi.dsi.fastutil', 'com.android.tools.r8.it.unimi.dsi.fastutil'
relocate 'junit', 'com.android.tools.r8.junit'
// Also include dependencies