blob: 2f30b0917d3479a5515c8e9019c2a365091c10ee (
plain)
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
|
#!/usr/bin/env bash
set -e
set -o pipefail
set -u
NAME=Mapbox
OUTPUT=build/macos/pkg
DERIVED_DATA=build/macos
PRODUCTS=${DERIVED_DATA}
BUILDTYPE=${BUILDTYPE:-Release}
SYMBOLS=${SYMBOLS:-YES}
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
trap finish EXIT
rm -rf ${OUTPUT}
HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true
PROJ_VERSION=$(git rev-list --count HEAD)
SEM_VERSION=$( git describe --tags --match=macos-v*.*.* --abbrev=0 | sed 's/^macos-v//' )
SHORT_VERSION=${SEM_VERSION%-*}
step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
xcodebuild \
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
CURRENT_COMMIT_HASH=${HASH} \
-derivedDataPath ${DERIVED_DATA} \
-workspace ./platform/macos/macos.xcworkspace \
-scheme dynamic \
-configuration ${BUILDTYPE} \
-jobs ${JOBS} | xcpretty
step "Copying dynamic framework into place"
mkdir -p "${OUTPUT}/${NAME}.framework"
ditto ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework "${OUTPUT}/${NAME}.framework"
if [[ -e ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM ]]; then
cp -r ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM "${OUTPUT}"
fi
if [[ ${SYMBOLS} = NO ]]; then
step "Stripping symbols from binaries"
strip -Sx "${OUTPUT}/${NAME}.framework/${NAME}"
fi
function get_comparable_uuid {
echo $(dwarfdump --uuid ${1} | sed -n 's/.*UUID:\([^\"]*\) .*/\1/p' | sort)
}
function validate_dsym {
step "Validating dSYM and framework UUIDs…"
DSYM_UUID=$(get_comparable_uuid "${1}")
FRAMEWORK_UUID=$(get_comparable_uuid "${2}")
echo -e "${1}\n ${DSYM_UUID}\n${2}\n ${FRAMEWORK_UUID}"
if [[ ${DSYM_UUID} != ${FRAMEWORK_UUID} ]]; then
echo "Error: dSYM and framework UUIDs do not match."
exit 1
fi
}
if [[ ${BUILDTYPE} == Release ]]; then
validate_dsym \
"${OUTPUT}/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" \
"${OUTPUT}/${NAME}.framework/${NAME}"
fi
step "Copying library resources…"
cp -pv LICENSE.md "${OUTPUT}"
cp -pv platform/macos/docs/pod-README.md "${OUTPUT}/README.md"
sed -n -e '/^## /,$p' platform/macos/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md"
step "Generating API documentation…"
make xdocument OUTPUT="${OUTPUT}/documentation"
step "Checking that all public symbols are exported…"
node platform/darwin/scripts/check-public-symbols.js macOS
|