4 MAIN_PROJECT
="ArchiSteamFarm"
5 STEAM_TOKEN_DUMPER_NAME
="${MAIN_PROJECT}.OfficialPlugins.SteamTokenDumper"
6 TESTS_PROJECT
="${MAIN_PROJECT}.Tests"
7 SOLUTION
="${MAIN_PROJECT}.sln"
8 CONFIGURATION
="Release"
10 OUT_ASF
="${OUT}/result"
11 PLUGINS
="${MAIN_PROJECT}.OfficialPlugins.ItemsMatcher ${MAIN_PROJECT}.OfficialPlugins.MobileAuthenticator"
21 echo "Usage: $0 [--clean] [--no-analysis] [--no-asf-ui] [--no-pull] [--no-shared-compilation] [--no-test] [debug/release]"
27 "Darwin") SCRIPT_PATH
="$(readlink "$0")" ;;
28 "FreeBSD") SCRIPT_PATH
="$(readlink -f "$0")" ;;
29 "Linux") SCRIPT_PATH
="$(readlink -f "$0")" ;;
30 *) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
33 SCRIPT_DIR
="$(dirname "$SCRIPT_PATH")"
39 debug|Debug
) CONFIGURATION
="Debug" ;;
40 release|Release
) CONFIGURATION
="Release" ;;
41 --analysis) ANALYSIS
=1 ;;
42 --no-analysis) ANALYSIS
=0 ;;
44 --no-asf-ui) ASF_UI
=0 ;;
46 --no-clean) CLEAN
=0 ;;
49 --shared-compilation) SHARED_COMPILATION
=1 ;;
50 --no-shared-compilation) SHARED_COMPILATION
=0 ;;
53 --help) PRINT_USAGE
; exit 0 ;;
54 *) PRINT_USAGE
; exit 1
58 trap "trap - TERM && kill -- -$$" INT TERM
60 if ! command -v dotnet
>/dev
/null
; then
61 echo "ERROR: dotnet CLI tools are not installed!"
67 if [ "$PULL" -eq 1 ] && [ -d ".git" ] && command -v git
>/dev
/null
; then
68 git pull
--recurse-submodules=on-demand || true
71 if [ ! -f "$SOLUTION" ]; then
72 echo "ERROR: $SOLUTION could not be found!"
77 "Darwin") os_type
="osx" ;;
78 "FreeBSD") os_type
="freebsd" ;;
79 "Linux") os_type
="linux" ;;
80 *) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
83 cpu_architecture
="$(uname -m)"
85 case "$cpu_architecture" in
86 "aarch64") cpu_architecture
="arm64" ;;
87 "amd64") cpu_architecture
="x64" ;;
89 "armv7l") cpu_architecture
="arm" ;;
90 "x86_64") cpu_architecture
="x64" ;;
91 *) echo "ERROR: Unknown CPU architecture: ${cpu_architecture}. If you believe that our script should work on your machine, please let us know."; exit 1
94 echo "INFO: Detected ${os_type}-${cpu_architecture} machine."
96 if [ "$ASF_UI" -eq 1 ]; then
97 if [ -f "ASF-ui/package.json" ] && command -v npm
>/dev
/null
; then
98 echo "INFO: Building ASF-ui..."
100 # ASF-ui doesn't clean itself after old build
103 npm ci
--no-progress --prefix ASF-ui
104 npm run-script deploy
--no-progress --prefix ASF-ui
106 # ASF's output www folder needs cleaning as well
107 rm -rf "${OUT_ASF}/www"
109 echo "WARNING: ASF-ui dependencies are missing, skipping build of ASF-ui..."
113 DOTNET_FLAGS
="-c $CONFIGURATION -p:ContinuousIntegrationBuild=true -p:UseAppHost=false --nologo"
114 PUBLISH_FLAGS
="-r ${os_type}-${cpu_architecture} --no-self-contained"
116 if [ "$ANALYSIS" -eq 0 ]; then
117 DOTNET_FLAGS
="$DOTNET_FLAGS -p:AnalysisMode=AllDisabledByDefault"
120 if [ "$SHARED_COMPILATION" -eq 0 ]; then
121 DOTNET_FLAGS
="$DOTNET_FLAGS -p:UseSharedCompilation=false"
124 if [ "$CLEAN" -eq 1 ]; then
125 dotnet clean
$DOTNET_FLAGS
129 if [ "$TEST" -eq 1 ]; then
130 dotnet
test "$TESTS_PROJECT" $DOTNET_FLAGS
133 echo "INFO: Building ${MAIN_PROJECT}..."
135 dotnet publish
"$MAIN_PROJECT" -o "$OUT_ASF" $DOTNET_FLAGS $PUBLISH_FLAGS
137 if [ -n "${STEAM_TOKEN_DUMPER_TOKEN-}" ] && [ -f "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" ] && command -v git
>/dev
/null
; then
138 git checkout
-- "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"
139 sed "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" > "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new";
140 mv "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"
142 echo "INFO: Building ${STEAM_TOKEN_DUMPER_NAME}..."
144 dotnet publish
"$STEAM_TOKEN_DUMPER_NAME" -o "${OUT_ASF}/plugins/${STEAM_TOKEN_DUMPER_NAME}" $DOTNET_FLAGS $PUBLISH_FLAGS
145 git checkout
-- "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"
147 echo "WARNING: ${STEAM_TOKEN_DUMPER_NAME} dependencies are missing, skipping build of ${STEAM_TOKEN_DUMPER_NAME}..."
150 for plugin
in $PLUGINS; do
151 echo "INFO: Building ${plugin}..."
153 dotnet publish
"$plugin" -o "${OUT_ASF}/plugins/${plugin}" $DOTNET_FLAGS $PUBLISH_FLAGS
157 echo "SUCCESS: Compilation finished successfully! :)"