Colin Cross | 1369cdb | 2017-09-29 17:58:17 -0700 | [diff] [blame^] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | # Extracts the Java package names of all classes in the .jar files and writes a module-info.java |
| 4 | # file to stdout that exports all of those packages. |
| 5 | |
| 6 | if [ -z "$1" ]; then |
| 7 | echo "usage: $0 <module name> <jar1> [<jar2> ...]" >&2 |
| 8 | exit 1 |
| 9 | fi |
| 10 | |
| 11 | module_name=$1 |
| 12 | shift |
| 13 | |
| 14 | echo "module ${module_name} {" |
| 15 | for j in "$@"; do zipinfo -1 $j ; done \ |
| 16 | | grep -E '/[^/]*\.class$' \ |
| 17 | | sed 's|\(.*\)/[^/]*\.class$| exports \1;|g' \ |
| 18 | | sed 's|/|.|g' \ |
| 19 | | sort -u |
| 20 | echo "}" |