-
Notifications
You must be signed in to change notification settings - Fork 913
/
build.sh
87 lines (74 loc) · 2.03 KB
/
build.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
function ShowHelp()
{
echo
echo "Usage: $0 [clean|Build|rebuild]"
echo
echo "$0 without any arguments is equivalent to $0 build"
exit
}
function EndWithError()
{
echo
echo "** ERROR: Build failed and aborted! **"
exit
}
#Check parameters
case $1 in
help | -h) ShowHelp;;
build | -b) BUILDTYPE="CoreBuild";;
clean | -c) BUILDTYPE="clean";;
rebuild | -r) BUILDTYPE="rebuild";;
"") BUILDTYPE="CoreBuild";;
*) echo; echo "Unsupported commandline switch!"; EndWithError
esac
#Search mono, msbuild and nuget
if [ -z $(command -v "mono") ]; then
echo "mono not found!"
echo "please download from official website <http://www.mono-project.com>";
EndWithError
fi
if [ -z $(command -v "msbuild") ]; then
echo "msbuild not found!"
echo "please download mono from official website <http://www.mono-project.com>"
EndWithError
fi
if [ -z $(command -v "nuget") ]; then
echo "nuget not found!"
echo "Please install nuget"
EndWithError
fi
# Enter in correct diretory
if [ ${0%/*} == $0 ]; then
cd ${PWD}
elif [ -e ${PWD}/${0%/*} ]; then
cd ${PWD}/${0%/*}
else
cd ${0%/*}
fi
#Try update souce code
git pull
echo
echo "Starting compilation..."
echo
echo "$BUILDTYPE""ing Subtitle Edit - Release|Any CPU..."
echo Check for new translation strings...
echo
msbuild src/UpdateLanguageFiles/UpdateLanguageFiles.csproj -r -t:Rebuild -p:Configuration=Debug -p:Platform=\"Any CPU\" -p:OutputPath=bin/Debug
echo
LanguageToolPath="src/UpdateLanguageFiles/bin/debug/UpdateLanguageFiles.exe"
if [ -e "./"$LanguageToolPath ]; then
mono $LanguageToolPath LanguageBaseEnglish.xml src/ui/Logic/LanguageDeserializer.cs
else
echo "Compile UpdateLanguageFiles!"
fi
echo
# Restore nuget package (the '-r' does nothing on my system)
nuget restore SubtitleEdit.sln
echo
msbuild SubtitleEdit.sln -r -t:SubtitleEdit:$BUILDTYPE -p:Configuration=Release -p:Platform=\"Any CPU\" -maxcpucount -consoleloggerparameters:DisableMPLogging\;Summary\;Verbosity=minimal
if [ $? -eq 1 ]; then
echo EndWithError
fi
echo
echo $BUILDTYPE"ing Subtitle Edit finished!"