aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-09-29 17:58:17 -0700
committerColin Cross <ccross@android.com>2017-10-16 15:00:02 -0700
commit1369cdb28013ece5eecf51dc9facc822ea9222b3 (patch)
tree7f1c21ddd0440c663f2d665efd9bef915be7c801 /scripts
parent070879e69eec3647424169767790993330222430 (diff)
downloadbuild_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.tar.gz
build_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.tar.bz2
build_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.zip
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
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/jars-to-module-info-java.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/jars-to-module-info-java.sh b/scripts/jars-to-module-info-java.sh
new file mode 100755
index 00000000..44be5494
--- /dev/null
+++ b/scripts/jars-to-module-info-java.sh
@@ -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 "}"