-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·94 lines (79 loc) · 2.39 KB
/
Copy pathbuild
File metadata and controls
executable file
·94 lines (79 loc) · 2.39 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
source "${SCRIPT_DIR}/scripts/common"
usage() {
cat <<'USAGE'
Usage: ./build [options]
Options:
-c, --configuration <Debug|Release> Build configuration. Default: Debug.
--version-suffix <suffix> Optional prerelease version suffix.
--build-number <number> Optional build number, padded to five digits.
--no-restore Skip dotnet restore.
-h, --help Show this help text.
USAGE
}
configuration="Debug"
version_suffix=""
build_number=""
no_restore=0
while (($#)); do
case "$1" in
-c|--configuration)
shift
linvast_require_value "--configuration" "${1-}"
configuration="$1"
;;
--version-suffix)
shift
linvast_require_value "--version-suffix" "${1-}"
version_suffix="$1"
;;
--build-number)
shift
linvast_require_value "--build-number" "${1-}"
build_number="$1"
;;
--no-restore)
no_restore=1
;;
-h|--help)
usage
exit 0
;;
*)
linvast_die "unknown option '$1'"
;;
esac
shift
done
linvast_validate_configuration "$configuration"
build_number_string=""
prerelease_version=""
if [[ -n "$build_number" ]]; then
if [[ -z "$version_suffix" ]]; then
linvast_die "--build-number requires --version-suffix"
fi
if build_number_string="$(linvast_format_build_number "$build_number")"; then
:
else
build_number_string=""
fi
fi
if [[ -n "$version_suffix" ]]; then
prerelease_version="$(linvast_prerelease_version "$version_suffix" "$build_number_string")"
fi
cd "$LINVAST_REPO_ROOT"
linvast_prepare_nuget_config
trap linvast_restore_nuget_config EXIT
if [[ "$no_restore" -eq 0 ]]; then
dotnet restore "$LINVAST_SOLUTION" -v minimal -m:1
fi
build_args=(dotnet build "$LINVAST_SOLUTION" -v minimal -c "$configuration" --no-restore -m:1)
if [[ -n "$version_suffix" ]]; then
build_args+=(--version-suffix "$version_suffix" -p:Version="$prerelease_version" -p:PackageVersion="$prerelease_version")
fi
if [[ -n "$build_number_string" ]]; then
build_args+=(-p:BuildNumber="$build_number_string")
fi
"${build_args[@]}"