-
Notifications
You must be signed in to change notification settings - Fork 20
/
makeBigJar
125 lines (108 loc) · 3.53 KB
/
makeBigJar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
set -e
################################################################################
#
# Author: Bob Fisch
#
# Description: create all-in-one jar file with all external jars included
#
################################################################################
#
# Revision List
#
# Author Date Description
# ------ ---- -----------
# Bob Fisch 2008-10-15 First Issue
# Bob Fisch & Philipp Hübner 2009-07-08 Scripting ameliorations
# Bob Fisch 2010-01-25 Update for new libraries and
# signature removing
# Simon Sobisch 2017-03-06 Check for jar;
# adjusted script output;
# using recursive cp for libs
# Simon Sobisch 2018-09-17 Include Apple extensions if
# available;
# changed script output
# Kay Gürtzig 2018-09-18 bsh-2.0b4.jar replaced with bsh-2.0b6.jar
# Simon Sobisch 2020-01-20 added handling for nostart argument,
# default to detached start
# Kay Gürtzig 2022-01-05 bsh-2.0b6.jar replaced with bsh-2.1.0.jar
#
################################################################################
# check for jar in PATH
jar 2>/dev/null 1>&2 || \
(rc=$? && if test $rc -gt 1; then
(echo 'jar not found in $PATH' && exit $rc)
fi)
# delete the old archive (if present)
[ -f structorizer.jar ] && rm structorizer.jar
# create clean directory
[ -d jar ] && rm -R jar
mkdir jar
# copy libs
cp -R lib/* jar
start_compiled="x"
case "$1" in
nostart | no-start | no_start)
start_compiled=""
shift
;;
start | no-sync | no_sync | detached)
start_compiled="x"
shift
;;
start-sync | sync | start_sync )
start_compiled="s"
shift
;;
esac
# change into jar directory
pushd jar >/dev/null
jars="bsh-2.1.0 \
swing-layout-1.0.3 \
freehep-graphics2d-2.1.1 \
freehep-graphicsio-2.1.1 \
freehep-graphicsio-svg-2.1.1 \
freehep-io-2.0.2 \
freehep-swing-2.0.3 \
freehep-util-2.0.2 \
freehep-xml-2.1.1 \
freehep"
# Apple specific stuff is only used if it exists and the compiled class is available
if test -f ../bin/lu/fisch/structorizer/application/AppleStructorizerApplication.class -a \
-f AppleJavaExtensions.jar; then
jars="$jars AppleJavaExtensions"
fi
# decompress jars
echo "Decompressing jars ..."
for jar in $jars
do
echo " $jar"
jar xf "$jar.jar"
done
echo "Done"
# deleting signatures
rm -f META-INF/*.SF
rm -f META-INF/*.DSA
# remove jar files
rm *.jar
# go back
popd >/dev/null
# copy other files
echo; echo "Copying resources..."
cp -R bin/* jar/
echo "Done"
# create a new archive
echo; echo "Create all-on-one archive.."
jar cmf structorizer.big.manifest structorizer.jar -C jar/ .
echo "Done"
# remove the jar-directory
rm -R jar/
if test -n "$start_compiled"; then
# execute the archive
echo; echo "Running Structorizer from all-in-one jar"
if test "$start_compiled" = "s"; then
java -jar structorizer.jar
else
java -jar structorizer.jar &
fi
fi # start block end