blob: 44be54949a9eda188a2157643d17bfadd3975fe7 [file] [log] [blame]
Colin Cross1369cdb2017-09-29 17:58:17 -07001#!/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
6if [ -z "$1" ]; then
7 echo "usage: $0 <module name> <jar1> [<jar2> ...]" >&2
8 exit 1
9fi
10
11module_name=$1
12shift
13
14echo "module ${module_name} {"
15for 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
20echo "}"