-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild
executable file
·96 lines (70 loc) · 2.01 KB
/
build
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
#!/bin/bash
set -eu
# read secrets from env file, if available
if [[ -f .env ]] ; then
export $(cat .env | xargs)
fi
if which wslpath; then
PATH=$PATH:$(wslpath 'C:\Windows\Microsoft.NET\Framework\v4.0.30319')
elif which cygpath; then
PATH=$PATH:$(cygpath 'C:\Windows\Microsoft.NET\Framework\v4.0.30319')
fi
win_dst=rsrcs/trayicon.exe
dobuild=
dosign=
dotest=
while test $# -gt 0
do
case "$1" in
--build) dobuild=true
;;
--sign) dosign=true
;;
--test) dotest=true
;;
--*) echo "bad option $1"
;;
*) echo "argument $1"
;;
esac
shift
done
sign() {
FILE_IN="$1"
FILE_OUT="$FILE_IN.signed"
echo "Signing $FILE_IN"
args=(-s -X PUT --data-binary @-)
args=("${args[@]}" -D -)
args=("${args[@]}" -o $FILE_OUT)
response=$(cat $FILE_IN | curl "${args[@]}" $SIGNING_SERVER | sed 's/\r$//' )
if echo "$response" | grep -qe "HTTP/1.. 200 " ; then
mv $FILE_OUT $FILE_IN
echo "$FILE_IN successfully signed."
else
echo "Could not sign $FILE_IN"
exit 1
fi
}
if [[ ! -z "$dobuild" ]] ; then
echo "Running application build"
rm -f $win_dst
v2=C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727
args=(/noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:0 /errorendlocation /preferreduilang:en-US /highentropyva-)
args=("${args[@]}" /reference:$v2\\mscorlib.dll /reference:$v2\\System.dll /reference:$v2\\System.Xml.dll /reference:$v2\\System.Drawing.dll /reference:$v2\\System.Windows.Forms.dll)
args=("${args[@]}" /filealign:512 /utf8output)
files=(src\\Program.cs src\\Properties\\AssemblyInfo.cs src\\ProcessExtensions.cs src\\Utils\\Kernel32.cs)
csc.exe "${args[@]}" /platform:x86 /out:$win_dst /target:winexe "${files[@]}"
fi
if [[ ! -z "$dosign" ]] ; then
if [[ -z "$SIGNING_SERVER" ]] ; then
echo "No signing server defined";
exit 1
fi
echo "Signing binaries"
sign $win_dst
fi
if [[ ! -z "$dotest" ]] ; then
echo "Running test suite"
cmd.exe /c npm install
cmd.exe /c npm test
fi