-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
54 lines (47 loc) · 1.16 KB
/
run.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
#!/bin/bash
# Check if there are no arguments
if [ -z "$1" ]; then
echo "Please provide an action you would like to perform:"
echo "build - builds both projects: Blazor and WASM"
echo "clean - removes the artifacts from the previous build"
echo "cleanbuild - cleans the previous build and builds both projects: Blazor and WASM"
echo "run - runs the Blazor project"
exit 1
fi
# Set the action from the first argument
action="$1"
# Define functions
build() {
dotnet publish -c Debug "blazorWasm/blazorWasm.csproj"
exit 0
}
clean() {
echo "Cleaning the previous build..."
blazorBin="blazorWasm/bin"
blazorObj="blazorWasm/obj"
dotnetPublish="blazorWasm/wwwroot/dotnet"
for dir in "$blazorBin" "$blazorObj" "$dotnetPublish"; do
[ -d "$dir" ] && rm -rf "$dir"
done
exit 0
}
# Switch-case logic based on the action
case "$action" in
build)
build
;;
clean)
clean
;;
cleanbuild)
clean
build
;;
run)
dotnet run --project "blazorWasm/blazorWasm.csproj"
;;
*)
echo "Invalid action: $action"
exit 1
;;
esac