-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild
116 lines (85 loc) · 2.82 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
set -eux
# 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
out_win_x86=dispatcher_win.exe
out_cmd_x86=dispatcher_cmd.exe
out_win_x64=dispatcher_win_x64.exe
out_cmd_x64=dispatcher_cmd_x64.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")
# args=("${args[@]}" \
# -H 'x-container: ' \
# -H 'x-pin: ' \
# -H 'x-thumbprint: ' \
# -H 'x-timestamp: http://timestamp.digicert.com' \
# )
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 $out_win_x86 $out_cmd_x86 $out_win_x64 $out_cmd_x64
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.ServiceProcess.dll /reference:$v2\\System.Management.dll)
args=("${args[@]}" /filealign:512 /utf8output)
files=(src\\Utils\\Job.cs src\\Utils\\Kernel32.cs src\\Program.cs src\\Properties\\AssemblyInfo.cs src\\Utils\\ProcessExtensions.cs src\\Utils\\ParentProcessUtilities.cs src\\Utils\\UWFManagement.cs)
csc.exe "${args[@]}" /platform:x86 /define:DISPACHER_WIN /target:winexe /out:$out_win_x86 "${files[@]}"
csc.exe "${args[@]}" /platform:x86 /target:exe /out:$out_cmd_x86 "${files[@]}"
csc.exe "${args[@]}" /platform:x64 /define:DISPACHER_WIN /target:winexe /out:$out_win_x64 "${files[@]}"
csc.exe "${args[@]}" /platform:x64 /target:exe /out:$out_cmd_x64 "${files[@]}"
fi
if [[ ! -z "$dosign" ]] ; then
if [[ -z "$SIGNING_SERVER" ]] ; then
echo "No signing server defined";
exit 1
fi
echo "Signing binaries"
sign $out_win_x86
sign $out_cmd_x86
sign $out_win_x64
sign $out_cmd_x64
fi
if [[ ! -z "$dotest" ]] ; then
echo "Running test suite"
cmd.exe /c npm install
cmd.exe /c npm test
fi