-
Notifications
You must be signed in to change notification settings - Fork 13
/
createDistributions
executable file
·206 lines (172 loc) · 5.61 KB
/
createDistributions
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/bash
# set overrides for setlX launcher script
export OVERRIDE_setlXJarDirectory="$PWD/interpreter"
# other locations for tests
setlXlaunchScript="$OVERRIDE_setlXJarDirectory/setlX"
cd "$OVERRIDE_setlXJarDirectory"
echo "=> Cleaning the setlX interpreter's source (1/2) ..."
mvn clean -P dist-clean
cd ..
# run tests
if [[ "$1" != "noTests" && "$2" != "noTests" ]]; then
echo "=> Testing the setlX interpreter ..."
./test_all_examples; rc=$?
if [ $rc -ne 0 ]; then
echo "=> Errors occured while testing the interpreter."
echo "=> Distribution stopped!"
exit 1
fi
fi
if [[ "$1" = "statTests" || "$2" = "statTests" ]]; then
echo "=> Testing the statistical distribution functions ..."
./test_stat_examples; rc=$?
if [ $rc -ne 0 ]; then
echo "=> Errors occured while testing the statistical distribution functions."
echo "=> Distribution stopped!"
exit 1
fi
fi
cd "$OVERRIDE_setlXJarDirectory"
echo "=> Cleaning the setlX interpreter's source (2/2) ..."
mvn clean -P dist-clean
# build the binary version
echo "=> Rebuilding the setlX interpreter ..."
mvn install
if [[ -f "$OVERRIDE_setlXJarDirectory/setlX.jar" && -f "$OVERRIDE_setlXJarDirectory/setlX-gfx.jar" && -f "$OVERRIDE_setlXJarDirectory/setlX-plot.jar" && -f "$OVERRIDE_setlXJarDirectory/setlX-stat.jar" ]]; then
# clean it up again (does not remove the jar)
mvn clean
echo "=> The setlX interpreter was build correctly."
else
echo "=> Building the setlX interpreter failed ..."
# break
exit 1
fi
# ensure some files use Windows line-endings
if [ $(which unix2dos > /dev/null 2>&1; echo $?) -eq 0 ]; then
unix2dos "$OVERRIDE_setlXJarDirectory/setlX.cmd"
fi
# get version from executable (jar)
version=$("$setlXlaunchScript" --version | head -n 1)
# warn if current release is not tagged in git
gitWarning=""
if [ -d "../.git" -a $(which git >/dev/null 2>&1; echo $?) -eq 0 ]
then
if [ $(git tag | grep -c "v$version") -ne 1 ]; then
gitWarning="WARNING: Version number of created distribution is not tagged in git!"
version="$version.experimental"
elif [ $(git diff --name-only "v$version" | wc -l) -gt 0 ]; then
gitWarning="WARNING: Source differs from commit tagged with 'v$version' in git!"
version="$version.experimental"
fi
else
gitWarning="WARNING: Build version could not be verified (git or git-repo missing)"
fi
cd ..
# create version string for file names
versionForFileNames=$(echo $version | tr "." "-")
# goto documentation source
cd documentation
# clean the documentation source
echo "=> Cleaning the documentation's source ..."
make dist-clean
# set version for documentation
echo "$version" > version.tex
# make documentation
echo "=> Rebuilding the documentation ..."
make
if [ -f developmentGuide.pdf -a -f manual.pdf ]
then
# move the finished PDFs where they belong
mv -f *.pdf ../.
# clean it up again
make dist-clean
echo "=> The documentation was build correctly."
else
echo "=> Building the documentation failed ..."
# break
exit 1
fi
# goto pure grammar
cd ../grammar_pure
# clean the pure grammar source
echo "=> Cleaning the pure grammar source ..."
make clean
rm -rf Pure.g4
# update the Pure.g grammar
echo "=> Updating the pure grammar"
make update
if [ -f Pure.g4 ]
then
# clean the pure grammar source (again)
make clean
echo "=> The pure grammar was updated correctly."
else
echo "=> Update the pure grammar failed ..."
# break
exit 1
fi
# goto tutorial's source
cd ../Tutorial
# clean the documentation source
echo "=> Cleaning the tutorial's source ..."
make dist-clean
# make tutorial
echo "=> Rebuilding the tutorial ..."
make
if [ -f tutorial.pdf ]
then
# move the finished PDFs where they belong
mv -f *.pdf ../.
# clean it up again
make dist-clean
echo "=> The tutorial was build correctly."
else
echo "=> Building the tutorial failed ..."
# break
exit 1
fi
# go to project root
cd ..
# create distribution names
binOnly="setlX_v$versionForFileNames.binary_only"
devel="setlX_v$versionForFileNames.devel"
examples="setlX_v$versionForFileNames.examples"
# remove distribution zips if present
rm -f "setlX_v"*".zip"
# remove other stuff
rm -f test_failure.*.result
# create binary only zip
echo -n "=> Creating binary only distribution ... "
mkdir -p zipContents
cp changelog.txt license.txt manual.pdf tutorial.pdf $OVERRIDE_setlXJarDirectory/setlX $OVERRIDE_setlXJarDirectory/setlX.cmd $OVERRIDE_setlXJarDirectory/setlX.jar $OVERRIDE_setlXJarDirectory/setlX-gfx.jar $OVERRIDE_setlXJarDirectory/setlX-plot.jar $OVERRIDE_setlXJarDirectory/setlX-stat.jar zipContents/.
cp -r syntax_highlighting zipContents/.
cp -r interpreter/setlXlibrary zipContents/.
cd zipContents; zip -qr "../$binOnly.zip" . ; cd ..
rm -rf zipContents
echo "done"
# create examples zip
echo -n "=> Creating example code distribution ... "
cp -r example_SetlX_code zipContents
while read -r -d $'\0' filename; do
rm -f "$filename"
done < <( find "zipContents" -type f \( -name "*.stlx.reference" -o -name "*.stlx.input" -o -name "*.real.csv" -o -name "*.sys.csv" -o -name "*.user.csv" \) -print0 )
while read -r -d $'\0' emptyDir; do
rmdir "$emptyDir"
done < <( find "zipContents" -type d -empty -print0 )
cd zipContents; zip -qr "../$examples.zip" . ; cd ..
rm -rf zipContents
echo "done"
# remove the jars
cd "$OVERRIDE_setlXJarDirectory"
mvn clean -P dist-clean
cd ..
# create development zip
echo -n "=> Creating development kit ... "
zip -qr "$devel.zip" . -x \*.zip \*.git\* \*.idea\* \*.iml
echo "done"
if [ -n "$gitWarning" ]
then
echo >&2
echo "$gitWarning" >&2
echo >&2
fi