Initial support for converting jars to java9 system modules

Adds a java_system_modules module type that (when
EXPERIMENTAL_USE_OPENJDK9 is set to true) converts a list of
java library modules and prebuilt jars into system modules,
and plumbs the system modules through to the javac command
line.

Also exports the location of the system modules to make
variables, as well as the name of the default system module.

Test: TestClasspath in java_test.go, runs automatically as part of the build
Bug: 63986449
Change-Id: I27bd5d2010092422a27b69c91568e49010e02f40
This commit is contained in:
Colin Cross
2017-09-29 17:58:17 -07:00
parent 070879e69e
commit 1369cdb280
9 changed files with 421 additions and 69 deletions

View File

@@ -0,0 +1,20 @@
#!/bin/bash -e
# Extracts the Java package names of all classes in the .jar files and writes a module-info.java
# file to stdout that exports all of those packages.
if [ -z "$1" ]; then
echo "usage: $0 <module name> <jar1> [<jar2> ...]" >&2
exit 1
fi
module_name=$1
shift
echo "module ${module_name} {"
for j in "$@"; do zipinfo -1 $j ; done \
| grep -E '/[^/]*\.class$' \
| sed 's|\(.*\)/[^/]*\.class$| exports \1;|g' \
| sed 's|/|.|g' \
| sort -u
echo "}"