-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenRelease.sh
executable file
·62 lines (53 loc) · 2.24 KB
/
genRelease.sh
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
#!/usr/bin/env bash
# In case of git you should have defined the $MODELICALIBRARIES location
# either system wide or just right here:
#MODELICALIBRARIES=/path/to/git-repo
# Which HTML generator should we use, [omc|dymola|no]:
genHTML=omc
# for syntax check only set genIcons to false
# (icon generation is very time consuming)
export genIcons=true
tag=${1:?}
currDir=`pwd`
releaseDir="Modelica_${tag:1}"
export releaseVersion="`echo ${tag:1} |cut -d+ -f1`"
export MODELICAPATH="/tmp/MSLrelease/$releaseDir"
export outDir="$currDir/out"
# relative sub folder for the HTML files:
export htmlDir="/Resources/helpOM/"
# Clean up of previous script runs
rm -rf "/tmp/MSLrelease"
mkdir -p "$MODELICAPATH"
echo "Exporting archive using Git (with keyword expansion and filtering)..."
# Export using git
git archive --remote=$MODELICALIBRARIES $tag | tar -x -C "$MODELICAPATH"
echo "...finished."
# Creating directory structure with release numbers
mv "$MODELICAPATH/Modelica" "$MODELICAPATH/Modelica $releaseVersion"
mv "$MODELICAPATH/ModelicaServices" "$MODELICAPATH/ModelicaServices $releaseVersion"
mv "$MODELICAPATH/ModelicaReference" "$MODELICAPATH/ModelicaReference $releaseVersion"
if [ "$genHTML" = "omc" ]; then
echo "Calling OpenModelica to generate the HTML documentation..."
# omc +showErrorMessages +d=failtrace "$currDir/genDocOMC.mos"
mkdir -p "$outDir"
cd "$outDir"
omc "$currDir/genDocOMC.mos"
elif [ "$genHTML" = "dymola" ]; then
echo "Calling Dymola to generate HTML documentaion (NOT WORKING YET)..."
# mkdir -p Modelica/Resources/help # not yet created by Dymola (bug)
# dymola "$currDir/genDocDymola.mos"
echo "NO HTML documentation generated!"
else
echo "Running without HTML generation"
fi
# Remove stuff that should not be part of the release:
cd "$MODELICAPATH"
rm -rf "$MODELICAPATH/ModelicaTest"
rm -rf "$MODELICAPATH/ModelicaTestOverdetermined.mo"
mv "$MODELICAPATH/Modelica ${releaseVersion}${htmlDir}MissingFiles.log" "$outDir"
# Fix the README.md to work in the release zip
sed -e "s#Modelica/Resources#Modelica%20${releaseVersion}/Resources#" -i "$MODELICAPATH/README.md"
# Create the release zip file
echo "Generating the zip file..."
zip -qrFS "$outDir/ModelicaStandardLibrary_${tag}.zip" .
echo "...finished."