-
Notifications
You must be signed in to change notification settings - Fork 255
/
build_core.sh
102 lines (62 loc) · 1.77 KB
/
build_core.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
shopt extglob dotglob nullglob
build_ng() {
echo 'Angular Build'
cd CSETWebNg
# Verify Angular CLI installation
if ! command -v ng &> /dev/null
then
echo "Angular CLI not found! Build Cancelled!"
exit 1
fi
echo 'building CSET app'
outputDir="/c/temp/ng-dist_${1}"
ng build --configuration production --base-href ./ --source-map=false | sed "s/^/APP: /" > ../ng-build.log 2> ../ng-errors.log
mkdir -p "${outputDir}" && cp -r dist "${outputDir}/."
echo 'Angular project built.'
echo 'PLEASE WAIT'
}
build_api() {
cd CSETWebApi/csetweb_api/CSETWeb_ApiCore
echo 'Cleaning Project...'
dotnet clean
echo 'Publishing project...'
outputDirApi="/c/temp/api-publish_${1}"
dotnet publish --configuration Release -o $outputDirApi -v q
rm -f ${outputDirApi}/appsettings.development.json
mkdir -p ../../../dist/CSETWebApi && cp -r "${outputDirApi}/." ../../../dist/CSETWebApi
echo 'API project published.'
echo 'PLEASE WAIT'
}
build_electron() {
cd CSETWebNg
echo 'Packaging CSET as Electron App'
npm run build:electron
package="CSET"
mkdir -p ../dist/electron && cp -r "electron-builds/${package}-win32-x64/." ../dist/electron
echo 'Electron package complete'
}
############################
########## MAIN ##########
############################
userguides/UserGuides.exe -Y
date
if [ -d dist ]
then
echo 'Deleting existing dist folder'
rm -rf dist
fi
ts=$(date +%Y-%m-%d_%H.%M.%S)
echo 'Beginning asynchronous build processes...'
build_ng $ts | sed "s/^/NG BUILD: /" &
build_api $ts | sed "s/^/API BUILD: /" &
echo 'Processes started.'
wait
if [ $# -ne 0 ] && [ $1 == -electron ]
then
build_electron $ts | sed "s/^/ELECTRON BUILD: /"
wait
fi
echo 'All build processes complete.'
date
echo 'CSETWeb BUILD COMPLETE'