-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
54 lines (43 loc) · 1.22 KB
/
build.sh
File metadata and controls
54 lines (43 loc) · 1.22 KB
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
if [ $# != 2 ]; then
echo "This script can accept two arguments, but only needs one. They are in this order: representing the version to build and whether or not you are running this in an interactive shell. i.e. ./build.sh 4.0.0.0 true"
read -n1 -r -p "Press any key to exit."
exit 1
fi
function setup {
sed -r --in-place "s/\%\%GLI_PLATFORM_EXTENSION\%\%/$1/g;" Program.cs
}
function cleanup {
git restore .
}
function pub {
echo "Compiling for $1..."
setup $1
dotnet publish -c release -r $1 --self-contained -o ../../build/$1 --p:Version="$2"
cleanup
if stringContain "win" $1; then
mv ../../build/$1/gli.exe ../../artifacts/gli-$1.exe
else
mv ../../build/$1/gli ../../artifacts/gli-$1
fi
}
stringContain() { case $2 in *$1* ) return 0;; *) return 1;; esac ;}
echo "Cleaning previous build & packages..."
rm -rf build
rm -rf artifacts
mkdir artifacts
echo "Building..."
cd src/Cli
pub win-x64 $1
pub linux-x64 $1
pub linux-arm64 $1
pub win-arm64 $1
pub osx-arm64 $1
pub osx-x64 $1
pub win-x86 $1
pub linux-arm $1
pub linux-musl-x64 $1
pub linux-musl-arm64 $1
echo "Complete. You can find builds for all platforms in artifacts/."
if [ $2 != "false" ]; then
read -n1 -r -p "Press any key to exit."
fi