-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-common.sh
45 lines (37 loc) · 2.18 KB
/
build-common.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
#!/bin/bash
if [ ! -d $targetdir ]; then mkdir $targetdir ; fi
if [ ! -d $targetdir/$package-$UBLstage-$label ]; then
mkdir $targetdir/$package-$UBLstage-$label
fi
if [ ! -d $targetdir/$package-$UBLstage-$label/archive-only-not-in-final-distribution/ ]; then
mkdir $targetdir/$package-$UBLstage-$label/archive-only-not-in-final-distribution/
fi
echo Building package...
java -Dant.home=utilities/ant -classpath utilities/saxon/saxon.jar:utilities/ant/lib/ant-launcher.jar:utilities/saxon9he/saxon9he.jar:. org.apache.tools.ant.launch.Launcher -buildfile build.xml "-Dtitle=$title" "-Dpackage=$package" "-DUBLversion=$UBLversion" "-DUBLprevStageVersion=$UBLprevStageVersion" "-DUBLprevStage=$UBLprevStage" "-DUBLprevVersion=$UBLprevVersion" "-Drawdir=$rawdir" "-DlibraryGoogle=$libGoogle" "-DdocumentsGoogle=$docGoogle" "-DsignatureGoogle=$sigGoogle" "-Ddir=$targetdir" "-DUBLstage=$UBLstage" "-Dlabel=$label" "-DisDraft=$isDraft" "-Drealtauser=$4" "-Drealtapass=$5"
serverReturn=$?
sleep 2
mv build.console.$label.txt $targetdir/$package-$UBLstage-$label-archive-only/
echo $serverReturn >$targetdir/$package-$UBLstage-$label-archive-only/build.exitcode.$label.txt
touch $targetdir/$package-$UBLstage-$label-archive-only/build.console.$label.txt
# reduce GitHub storage costs by zipping results and deleting intermediate files
pushd $targetdir
if [ -f $package-$UBLstage-$label-archive-only.zip ]; then rm $package-$UBLstage-$label-archive-only.zip ; fi
7z a $package-$UBLstage-$label-archive-only.zip $package-$UBLstage-$label-archive-only
if [ -f $package-$UBLstage-$label.zip ]; then rm $package-$UBLstage-$label.zip ; fi
7z a $package-$UBLstage-$label.zip $package-$UBLstage-$label
popd
if [ "$targetdir" = "target" ]
then
if [ "$2" = "github" ]
then
if [ "$6" = "DELETE-REPOSITORY-FILES-AS-WELL" ] #secret undocumented failsafe
then
# further reduce GitHub storage costs by deleting repository files
find . -not -name target -not -name .github -maxdepth 1 -exec rm -r -f {} \;
mv $targetdir/$package-$UBLstage-$label-archive-only.zip .
mv $targetdir/$package-$UBLstage-$label.zip .
rm -r -f $targetdir
fi
fi
fi
exit 0 # always be successful so that github returns ZIP of results