Strip module-info.class files when combining jars
Combining static jars from dependencies may bring in module-info.class
files, which don't make sense once multiple modules have been combined,
and sometimes confuse downstream tools like desugar. Strip them out
like make does when combining jars.
Test: m checkbuild
Change-Id: I560c5acfcc6e1be9adf604c22cf200581f92f702
diff --git a/java/builder.go b/java/builder.go
index dd0d927..56c7b33 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -383,6 +383,10 @@
}
}
+ // Remove any module-info.class files that may have come from prebuilt jars, they cause problems
+ // for downstream tools like desugar.
+ jarArgs = append(jarArgs, "-stripFile module-info.class")
+
if stripDirs {
jarArgs = append(jarArgs, "-D")
}