-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·47 lines (37 loc) · 1.24 KB
/
build
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
#!/usr/bin/env bash
# sane settings for the script interpreter
set -o errexit # exit when a command fails
set -o pipefail # pipes have exit status of the last command that had a non-zero exit code
set -o nounset # exit on attempts to use undeclared variables
[[ "${TRACE:-}" == 'true' ]] && set -o xtrace # prints every expression before executing it when debugging
# ensure we clean up after ourselves
trap 'build_exitcode=$?; echo "Cleaning up"; rm -f nuget.config; exit $build_exitcode' INT TERM EXIT
# configuration
readonly pack_projects='NugetRepack.Tool'
readonly tools_path='.tools'
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
main() {
verify_prerequisites
run_cake "$@"
}
verify_prerequisites() {
verify_dotnet
dotnet tool restore
}
verify_dotnet() {
# Ensure dotnet is available.
if ! [ -x "$(command -v dotnet)" ]; then
echo 'Error: dotnet is not installed.' >&2
exit 1
fi
# Check the version
local found_dotnet_sdk_version="$(dotnet --version)"
echo "Using .NET core SDK version: ${found_dotnet_sdk_version}"
}
run_cake() {
dotnet cake --bootstrap
dotnet cake --projects="${pack_projects}" "$@"
}
main "$@"