From 2bdbb6e93522b525f0322863baf9aeb5fd879d78 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Sun, 6 Aug 2017 12:57:36 +0100 Subject: [PATCH] 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 --- core/definitions.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/definitions.mk b/core/definitions.mk index d3277b5ec7..b92c52d3d1 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2175,7 +2175,7 @@ define unzip-jar-files 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