Omit module-info.class when unzipping jar files.
During the Android build process, multiple .jar files are
unzipped into the same directory. If the .jar is an OpenJDK 9
modular jar (with a module-info.class in the root directory),
the last module-info.class extracted will overwrite any earlier
module-info.class files extracted, and will cause all extracted
class files to be considered part of that module.
Therefore, this would break compilation under OpenJDK 9 (with
-target 1.9 -source 1.9). This CL fixes this by omitting the
module-info.class file (if present) when extracting the .jar.
This essentially turns any modular jar into a regular jar,
replacing the module with corresponding classes on the classpath.
This is sufficient for now because Android does not currently
support module dependencies.
Test: Treehugger
Bug: 38177569
Change-Id: Ia184e64d2f24b8ca79aeab1c00bd5da0386530bf
diff --git a/core/definitions.mk b/core/definitions.mk
index d3277b5..b92c52d 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2175,7 +2175,7 @@
echo Missing file $$f; \
exit 1; \
fi; \
- unzip -qo $$f -d $(2); \
+ unzip -qo $$f -d $(2) -x module-info.class; \
done
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF)
endef