change build scripts to work with TeamCity

This commit is contained in:
Owen Quinlan 2021-11-19 22:09:36 +11:00
parent 69023df428
commit 55a1d48824
2 changed files with 7 additions and 6 deletions

View file

@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
go mod download go mod download
package="$PWD/Locate ID/LocateID.go" package="./LocateID.go"
package_split=(${package//\// }) package_split=(${package//\// })
package_name="LocateID" package_name="LocateID"
@ -15,11 +16,11 @@ do
GOOS=${platform_split[0]} GOOS=${platform_split[0]}
GOARCH=${platform_split[1]} GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then if [ "$GOOS" = "windows" ]; then
output_name+='.exe' output_name+='.exe'
fi fi
env GOOS=$GOOS GOARCH=$GOARCH GOPATH="$PWD/Locate ID/" go build -o "./Locate ID/build/$output_name" $package env GOOS="$GOOS" GOARCH="$GOARCH" go build -o ./build/$output_name $package
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...' echo 'An error has occurred! Aborting the script execution...'
exit 1 exit 1

View file

@ -2,7 +2,7 @@
go mod download go mod download
package="$PWD/User ID Parser/IdParser.go" package="./IdParser.go"
package_split=(${package//\// }) package_split=(${package//\// })
package_name="IdParser" package_name="IdParser"
@ -15,11 +15,11 @@ do
GOOS=${platform_split[0]} GOOS=${platform_split[0]}
GOARCH=${platform_split[1]} GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then if [ "$GOOS" = "windows" ]; then
output_name+='.exe' output_name+='.exe'
fi fi
env GOOS=$GOOS GOARCH=$GOARCH GOPATH="$PWD/User ID Parser/" go build -o ./User ID Praser/build/$output_name $package env GOOS="$GOOS" GOARCH=$GOARCH go build -o "./build/$output_name" $package
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...' echo 'An error has occurred! Aborting the script execution...'
exit 1 exit 1