forked from pact-foundation/pact-core-mock-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-macos.sh
More file actions
executable file
·42 lines (32 loc) · 1.21 KB
/
Copy pathrelease-macos.sh
File metadata and controls
executable file
·42 lines (32 loc) · 1.21 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
#!/bin/bash
set -e
set -x
RUST_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")/.." && pwd )"
source "$RUST_DIR/scripts/gzip-and-sum.sh"
ARTIFACTS_DIR=${ARTIFACTS_DIR:-"$RUST_DIR/release_artifacts"}
mkdir -p "$ARTIFACTS_DIR"
export CARGO_TARGET_DIR=${CARO_TARGET_DIR:-"$RUST_DIR/target"}
# We target the oldest supported version of macOS.
export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12}
# All flags passed to this script are passed to cargo.
cargo_flags=( "$@" )
# Build the x86_64 darwin release
build_x86_64() {
cargo build --target x86_64-apple-darwin "${cargo_flags[@]}"
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/pact-mock-server" \
"$ARTIFACTS_DIR/pact-mock-server-macos-x86_64.gz"
fi
}
# Build the aarch64 darwin release
build_aarch64() {
cargo build --target aarch64-apple-darwin "${cargo_flags[@]}"
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/pact-mock-server" \
"$ARTIFACTS_DIR/pact-mock-server-macos-aarch64.gz"
fi
}
build_x86_64
build_aarch64