diff options
Diffstat (limited to 'tools/package.sh')
| -rw-r--r-- | tools/package.sh | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/tools/package.sh b/tools/package.sh index ce18f63..2569e96 100644 --- a/tools/package.sh +++ b/tools/package.sh | |||
| @@ -33,8 +33,7 @@ echo "=== Generating executable manifests ===" | |||
| 33 | # this line is the entire classpath at runtime. | 33 | # this line is the entire classpath at runtime. |
| 34 | for e in $EXECUTABLES; do | 34 | for e in $EXECUTABLES; do |
| 35 | CPLINE="" | 35 | CPLINE="" |
| 36 | for m in $MODULES; do | 36 | for m in $(deps_of "$e"); do |
| 37 | [ "$m" = "$e" ] && continue | ||
| 38 | CPLINE="$CPLINE${CPLINE:+ }$m.jar" | 37 | CPLINE="$CPLINE${CPLINE:+ }$m.jar" |
| 39 | done | 38 | done |
| 40 | for d in $RUNTIME_LIB_DIRS; do | 39 | for d in $RUNTIME_LIB_DIRS; do |
| @@ -49,6 +48,7 @@ done | |||
| 49 | 48 | ||
| 50 | echo "=== Packaging ===" | 49 | echo "=== Packaging ===" |
| 51 | for m in $MODULES; do | 50 | for m in $MODULES; do |
| 51 | [ "$m" = "$WAR_MODULE" ] && continue # ships as a WAR, below | ||
| 52 | case " $EXECUTABLES " in | 52 | case " $EXECUTABLES " in |
| 53 | *" $m "*) | 53 | *" $m "*) |
| 54 | "$JAR" --create --file "$DIST/$m.jar" --main-class "$(mainclass_of "$m")" \ | 54 | "$JAR" --create --file "$DIST/$m.jar" --main-class "$(mainclass_of "$m")" \ |
| @@ -72,6 +72,39 @@ done | |||
| 72 | 72 | ||
| 73 | [ -f README.pdf ] && cp README.pdf "$DIST/" | 73 | [ -f README.pdf ] && cp README.pdf "$DIST/" |
| 74 | 74 | ||
| 75 | echo "=== Exercise 3: WAR ===" | ||
| 76 | # The WAR carries everything the server needs; Tomcat only provides the servlet API. | ||
| 77 | WARDIR="$TMP/war" | ||
| 78 | rm -rf "$WARDIR" && mkdir -p "$WARDIR/WEB-INF/lib" | ||
| 79 | cp -r "build/classes/$WAR_MODULE" "$WARDIR/WEB-INF/classes" | ||
| 80 | for m in $(deps_of "$WAR_MODULE"); do | ||
| 81 | cp "$DIST/$m.jar" "$WARDIR/WEB-INF/lib/" | ||
| 82 | done | ||
| 83 | for d in $WAR_LIB_DIRS; do | ||
| 84 | for j in lib/"$d"/*.jar; do | ||
| 85 | is_shippable_jar "$j" || continue | ||
| 86 | cp "$j" "$WARDIR/WEB-INF/lib/" | ||
| 87 | done | ||
| 88 | done | ||
| 89 | EX3="$DIST/ex3" | ||
| 90 | mkdir -p "$EX3" | ||
| 91 | "$JAR" --create --file "$EX3/$WAR_NAME.war" -C "$WARDIR" . | ||
| 92 | echo " $EX3/$WAR_NAME.war" | ||
| 93 | "$JAR" --list --file "$EX3/$WAR_NAME.war" | grep 'WEB-INF/lib/.' | sed 's/^/ /' | ||
| 94 | |||
| 95 | echo "=== Exercise 3: client directory ===" | ||
| 96 | CDIR="$EX3/client" | ||
| 97 | mkdir -p "$CDIR/lib" | ||
| 98 | cp "$DIST/$CLIENT.jar" "$CDIR/" | ||
| 99 | for m in $(deps_of "$CLIENT"); do | ||
| 100 | cp "$DIST/$m.jar" "$CDIR/" | ||
| 101 | done | ||
| 102 | for d in $CLIENT_LIB_DIRS; do | ||
| 103 | cp -r "$DIST/lib/$d" "$CDIR/lib/" | ||
| 104 | done | ||
| 105 | cp "$DIST/run-${CLIENT#ui-}.bat" "$CDIR/" | ||
| 106 | ls "$CDIR" | sed 's/^/ /' | ||
| 107 | |||
| 75 | echo "=== Manifest as it actually landed in the jar ===" | 108 | echo "=== Manifest as it actually landed in the jar ===" |
| 76 | # Cheapest check that prevents a Level-0: if Main-Class or Class-Path didn't | 109 | # Cheapest check that prevents a Level-0: if Main-Class or Class-Path didn't |
| 77 | # survive, it surfaces here instead of on the grader's machine. | 110 | # survive, it surfaces here instead of on the grader's machine. |