-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.sh
executable file
·67 lines (55 loc) · 1.95 KB
/
build.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
#!/usr/bin/env bash
###
### Copyright (c) 2022-2023 Carbon Community
### All rights reserved
###
set -e
echo "** Get the base path of the script"
BASE="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)"
ROOT="$(realpath "${BASE}/../../../")"
"${BASE}/publish_git.sh" ${3}
TARGET=${1:-Debug}
echo "** Set the build target config to ${TARGET}"
echo "** Cleanup the release folder"
rm -rf "${ROOT}/Release/.tmp/${TARGET}" "${ROOT}/Release/Carbon.${TARGET}.tar.gz" || exit 0
if [[ "${DEFINES}" == "" ]]; then
DEFINES=${2}
fi
if [[ "${DEFINES}" == "" ]]; then
echo "** No defines."
else
echo "** Defines: ${DEFINES}"
fi
echo "** Build the solution"
dotnet restore "${ROOT}/Carbon.Core" -v:m --nologo
dotnet clean "${ROOT}/Carbon.Core" -v:m --configuration ${TARGET} --nologo
dotnet build "${ROOT}/Carbon.Core" -v:m --configuration ${TARGET} --no-restore --no-incremental \
/p:UserConstants="${DEFINES}" /p:UserVersion="${VERSION}"
echo "** Copy operating system specific files"
if [[ "${TARGET}" == *"Unix"* ]]; then
cp "${ROOT}/Tools/Helpers/carbon.sh" "${ROOT}/Release/.tmp/${TARGET}/carbon.sh"
cp "${ROOT}/Tools/Helpers/environment.sh" "${ROOT}/Release/.tmp/${TARGET}/carbon/tools"
cp "${ROOT}/Tools/UnityDoorstop/linux/x64/libdoorstop.so" "${ROOT}/Release/.tmp/${TARGET}/libdoorstop.so"
else
cp "${ROOT}/Tools/Helpers/doorstop_config.ini" "${ROOT}/Release/.tmp/${TARGET}"
cp "${ROOT}/Tools/UnityDoorstop/windows/x64/doorstop.dll" "${ROOT}/Release/.tmp/${TARGET}/winhttp.dll"
fi
TAG="$1"
TAG="${TAG//Unix/}"
if [[ "${TARGET}" == *"Unix" ]]; then
if [[ "${TARGET}" == "Debug"* ]]; then
TOS=Linux
else
TOS=Linux
fi
else
if [[ "${TARGET}" == "Debug"* ]]; then
TOS=Windows
else
TOS=Windows
fi
fi
if [ "${2}" != "--no-archive" ]; then
echo "** Create the compressed archive"
tar -zcvf "${ROOT}/Release/Carbon.${TOS}.${TAG}.tar.gz" -C "${ROOT}/Release/.tmp/${TARGET}" $(ls -A ${ROOT}/Release/.tmp/${TARGET})
fi