Skip to content

Commit b0cc073

Browse files
committed
build: Extract Xcode build configuration as a common variable
Test runner was being built in `Release` while the framework for packaging in `RelWithDebInfo`, which resulted in building almost everything twice
1 parent d61dbd4 commit b0cc073

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

build/scripts/build-nativescript-framework.sh

+14-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -e
44

55
source "$(dirname "$0")/common.sh"
66

7+
CONFIGURATION=$NATIVESCRIPT_XCODE_CONFIGURATION
8+
79
checkpoint "Building NativeScript.framework"
810

911
mkdir -p "$WORKSPACE/cmake-build" && pushd "$_"
@@ -12,33 +14,32 @@ rm -f "CMakeCache.txt"
1214
cmake .. -G"Xcode" -D"BUILD_SHARED_LIBS=ON"
1315
# TODO: fix build when iphoneos build is started first
1416
checkpoint "Building NativeScript.framework - iphonesimulator SDK"
15-
xcodebuild -configuration "RelWithDebInfo" -sdk "iphonesimulator" -target "NativeScript" -quiet
17+
xcodebuild -configuration $CONFIGURATION -sdk "iphonesimulator" -target "NativeScript" -quiet
1618
checkpoint "Building NativeScript.framework - iphoneos SDK"
17-
xcodebuild -configuration "RelWithDebInfo" -sdk "iphoneos" -target "NativeScript" -quiet
19+
xcodebuild -configuration $CONFIGURATION -sdk "iphoneos" -target "NativeScript" -quiet
1820
popd
1921

2022
checkpoint "Packaging NativeScript.framework"
2123
mkdir -p "$DIST_DIR" && pushd "$_"
22-
cp -r "$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphoneos/NativeScript.framework" "."
24+
cp -r "$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphoneos/NativeScript.framework" "."
2325
rm "NativeScript.framework/NativeScript"
2426

2527
# Strip debug information, dSYM package must be used for debugging and symbolicating
26-
strip -S -x "$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphonesimulator/NativeScript.framework/NativeScript" \
27-
"$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphoneos/NativeScript.framework/NativeScript"
28-
echo "CodeSign $WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphonesimulator/NativeScript.framework/NativeScript"
28+
strip -S -x "$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphonesimulator/NativeScript.framework/NativeScript" \
29+
"$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphoneos/NativeScript.framework/NativeScript"
30+
echo "CodeSign $WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphonesimulator/NativeScript.framework/NativeScript"
2931

30-
/usr/bin/codesign --force --sign - --timestamp=none "$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphonesimulator/NativeScript.framework/NativeScript"
32+
/usr/bin/codesign --force --sign - --timestamp=none "$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphonesimulator/NativeScript.framework/NativeScript"
3133

3234
lipo -create -output "NativeScript.framework/NativeScript" \
33-
"$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphonesimulator/NativeScript.framework/NativeScript" \
34-
"$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphoneos/NativeScript.framework/NativeScript"
35-
35+
"$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphonesimulator/NativeScript.framework/NativeScript" \
36+
"$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphoneos/NativeScript.framework/NativeScript"
3637

37-
cp -r "$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphoneos/NativeScript.framework.dSYM" "."
38+
cp -r "$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphoneos/NativeScript.framework.dSYM" "."
3839
rm "NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript"
3940
lipo -create -output "NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript" \
40-
"$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphonesimulator/NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript" \
41-
"$WORKSPACE/cmake-build/src/NativeScript/RelWithDebInfo-iphoneos/NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript"
41+
"$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphonesimulator/NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript" \
42+
"$WORKSPACE/cmake-build/src/NativeScript/$CONFIGURATION-iphoneos/NativeScript.framework.dSYM/Contents/Resources/DWARF/NativeScript"
4243

4344
tar -zcf NativeScript.framework.dSYM.tgz NativeScript.framework.dSYM
4445
rm -rf NativeScript.framework.dSYM

build/scripts/build-testrunner-application.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
set -e
44
set -o pipefail
55

6-
CONFIGURATION="Release"
7-
86
source "$(dirname "$0")/common.sh"
97

8+
CONFIGURATION=$NATIVESCRIPT_XCODE_CONFIGURATION
9+
1010
checkpoint "Building TestRunner application"
1111

1212
mkdir -p "$WORKSPACE/cmake-build" && pushd "$_"
@@ -25,12 +25,14 @@ xcodebuild \
2525
-scheme "TestRunner" \
2626
ARCHS="armv7 arm64" \
2727
ONLY_ACTIVE_ARCH="NO" \
28+
-quiet \
2829

2930
xcodebuild archive \
3031
-archivePath "$WORKSPACE/cmake-build/tests/TestRunner/$CONFIGURATION-iphoneos/TestRunner.xcarchive" \
3132
-configuration "$CONFIGURATION" \
3233
-sdk "iphoneos" \
33-
-scheme "TestRunner"
34+
-scheme "TestRunner" \
35+
-quiet \
3436

3537
popd
3638

@@ -39,7 +41,8 @@ xcodebuild \
3941
-exportArchive \
4042
-archivePath "$WORKSPACE/cmake-build/tests/TestRunner/$CONFIGURATION-iphoneos/TestRunner.xcarchive" \
4143
-exportPath "$WORKSPACE/cmake-build/tests/TestRunner/$CONFIGURATION-iphoneos" \
42-
-exportOptionsPlist "$WORKSPACE/cmake/ExportOptions.plist"
44+
-exportOptionsPlist "$WORKSPACE/cmake/ExportOptions.plist" \
45+
-quiet \
4346

4447
cp "$WORKSPACE/cmake-build/tests/TestRunner/$CONFIGURATION-iphoneos/TestRunner.ipa" "$DIST_DIR"
4548

build/scripts/common.sh

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function checkpoint {
1212

1313
WORKSPACE=$(pwd)
1414
DIST_DIR="$WORKSPACE/dist"
15+
NATIVESCRIPT_XCODE_CONFIGURATION="RelWithDebInfo"
1516

1617
if [ ! -d "$WORKSPACE/build/scripts" ]; then
1718
echo "This script must be run from the root of the repository."

0 commit comments

Comments
 (0)