-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbp.sh
executable file
·143 lines (129 loc) · 4.05 KB
/
bp.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# Copyright © 2017-2019 SOFTINUX. All rights reserved.
# Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information.
#These two lines is to set correct directory position if you build from JetBrain Rider
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#.NET Core version (defined into csproj)
NETVERSION="net7.0"
#Extension destination folder
EXT_FOLDER="./src/WebApplication/Extensions"
#Dependencies destination folder
DEP_FOLDER="./src/WebApplication/bin/Debug/$NETVERSION/"
#Publish folder
PUB_FOLDER=".\src\WebApplication\bin\Debug\%netVersion%\publish"
cd "$DIR"
function clean ()
{
echo "###################"
echo "CLEAN SOLUTION"
echo "###################"
dotnet clean
}
function bundles ()
{
echo "###################"
echo "Updating bundles"
echo "###################"
gulp
}
function build ()
{
echo "###################"
echo "BUILD SOLUTION"
echo "###################"
dotnet build /property:GenerateFullPaths=true
}
function generateBareboneCss ()
{
echo "###################"
echo "generateBareboneCss"
echo "###################"
node ./node_modules/sass/sass.js --no-source-map --no-charset ./src/SoftinuxBase.Barebone/Styles/scss/index.scss ./src/SoftinuxBase.Barebone/Styles/barebone.css
}
function generateSecurityCss ()
{
echo "###################"
echo "generateSecurityCss"
echo "###################"
node ./node_modules/sass/sass.js --no-source-map --no-charset ./src/SoftinuxBase.Security/Styles/scss/index.scss ./src/SoftinuxBase.Security/Styles/Security.css
}
function copyexts ()
{
echo "###################"
echo "Copy extensions"
echo "###################"
if [ ! -d "$EXT_FOLDER" ]; then
mkdir -p $EXT_FOLDER
fi
cat extensions.txt | sed 's/\\/\//g' | xargs -I % bash -c "cp % $EXT_FOLDER; echo cp % $EXT_FOLDER"
}
function copydeps ()
{
echo "###################"
echo "Copy Dependencies"
echo "###################"
if [ ! -d "$DEP_FOLDER" ]; then
echo "The dependencies destination folder does not exist."
exit 1
fi
cat dependencies.txt | sed 's/\\/\//g' | xargs -I % bash -c "cp % $DEP_FOLDER; echo cp % $DEP_FOLDER"
}
function cleanbuildfolders ()
{
echo "#########################"
echo "Clean obj and bin folders"
echo "#########################"
find . -iname "bin" -o -iname "obj" | xargs rm -rf
}
function help
{
echo "Available parameter is :"
echo " - clean : clean solution"
echo " - build : only build solution"
echo " - copydeps : only copy dependencies (defined in dependencies.txt)"
echo " - copyexts : only copy extensions (defined in extensions.txt)"
echo " - bundles : only update bundles"
echo -ne "\n"
echo "with no parameter or unsupported parameters, build proccess is:"
echo " - clean solution (not cleanbin)"
echo " - update bundles"
echo " - build solution"
echo " - copy dependencies"
echo " - copy extensions"
}
case $1 in
"clean" )
clean ;;
"build" )
build ;;
"copyexts" )
copyexts ;;
"copydeps" )
copydeps ;;
"bundles" )
bundles ;;
"cleanbin" )
cleanbuildfolders ;;
"-h|--help" )
help ;;
"--help" )
help ;;
"generateBareboneCss")
generateBareboneCss ;;
"generateSecurityCss")
generateSecurityCss ;;
*)
#clean
echo "######################################## EXIT CLEAN ###################################################"
#generateBareboneCss
echo "######################################## EXIT CSS1 ###################################################"
#generateSecurityCss
echo "######################################## EXIT CSS2 ###################################################"
#build
echo "######################################## EXIT BUILD ###################################################"
copydeps
copyexts
;;
esac
#Clean
echo "All done"