Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions build/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ set -e

WORKSPACE=`pwd`

function xcodebuild_pretty {
XCFORMATTER=true
if hash xcpretty 2>/dev/null; then
XCFORMATTER=xcpretty
fi
set -o pipefail && xcodebuild "$@" 2>&1 | tee -a "$WORKSPACE/build.log" | $XCFORMATTER
}

CMAKE_FLAGS="-G Xcode -DCMAKE_INSTALL_PREFIX=$WORKSPACE/dist"

mkdir -p "$WORKSPACE/cmake-build"
cd "$WORKSPACE/cmake-build"

echo "Building NativeScript.framework..."
rm -f CMakeCache.txt
echo "\tConfiguring..."
cmake .. $CMAKE_FLAGS -DBUILD_SHARED_LIBS=ON > "$WORKSPACE/build.log" 2>&1
echo "\tiPhoneOS..."
xcodebuild -configuration Release -sdk iphoneos -target NativeScript >> "$WORKSPACE/build.log" 2>&1
echo "\tiPhoneSimulator..."
xcodebuild -configuration Release -sdk iphonesimulator -target NativeScript >> "$WORKSPACE/build.log" 2>&1
rm -f "$WORKSPACE/build.log"
echo -e "\tConfiguring..."
cmake .. $CMAKE_FLAGS -DBUILD_SHARED_LIBS=ON 2>&1 | tee -a "$WORKSPACE/build.log"
echo -e "\tiPhoneOS..."
xcodebuild_pretty -configuration Release -sdk iphoneos -target NativeScript
echo -e "\tiPhoneSimulator..."
xcodebuild_pretty -configuration Release -sdk iphonesimulator -target NativeScript

echo "Packaging NativeScript.framework..."
mkdir -p "$WORKSPACE/dist"
Expand All @@ -29,12 +38,12 @@ lipo -create -output "$WORKSPACE/dist/NativeScript.framework/NativeScript" \

echo "Building libNativeScript..."
rm -f CMakeCache.txt
echo "\tConfiguring..."
cmake .. $CMAKE_FLAGS -DEMBED_STATIC_DEPENDENCIES=ON >> "$WORKSPACE/build.log"
echo "\tiPhoneOS..."
xcodebuild -configuration Release -sdk iphoneos -target NativeScript >> "$WORKSPACE/build.log" 2>&1
echo "\tiPhoneSimulator..."
xcodebuild -configuration Release -sdk iphonesimulator -target NativeScript >> "$WORKSPACE/build.log" 2>&1
echo -e "\tConfiguring..."
cmake .. $CMAKE_FLAGS -DEMBED_STATIC_DEPENDENCIES=ON 2>&1 | tee -a "$WORKSPACE/build.log"
echo -e "\tiPhoneOS..."
xcodebuild_pretty -configuration Release -sdk iphoneos -target NativeScript
echo -e "\tiPhoneSimulator..."
xcodebuild_pretty -configuration Release -sdk iphonesimulator -target NativeScript

echo "Packaging libNativeScript..."
mkdir -p "$WORKSPACE/dist/NativeScript/lib"
Expand All @@ -52,13 +61,13 @@ cp \
"$WORKSPACE/dist/NativeScript/include"

echo "Building objc-metadata-generator..."
xcodebuild -configuration Release -target MetadataGenerator >> "$WORKSPACE/build.log" 2>&1
xcodebuild_pretty -configuration Release -target MetadataGenerator
echo "Packaging objc-metadata-generator..."
cp -R "$WORKSPACE/cmake-build/metadataGenerator" "$WORKSPACE/dist/"
cp "$WORKSPACE/build/scripts/metadata-generation-build-step" "$WORKSPACE/dist/metadataGenerator/bin/"

echo "Building Gameraww..."
xcodebuild -configuration Release -sdk iphoneos -target Gameraww >> "$WORKSPACE/build.log" 2>&1
xcodebuild_pretty -configuration Release -sdk iphoneos -target Gameraww
echo "Packaging Gameraww..."
xcrun -sdk iphoneos PackageApplication -v "$WORKSPACE/cmake-build/examples/Gameraww/Release-iphoneos/Gameraww.app" \
-o "$WORKSPACE/cmake-build/examples/Gameraww/Release-iphoneos/Gameraww.ipa" \
Expand All @@ -68,8 +77,8 @@ echo "TNS_IPA_SIZE: "$GAMERAWW_IPA_SIZE"KB"
echo "TNS_IPA_SIZE_KB\\n"$GAMERAWW_IPA_SIZE > "$WORKSPACE/build-stats.csv"

echo "Building TestRunner..."
xcodebuild -configuration Debug -sdk iphoneos -target TestRunner ARCHS="armv7" ONLY_ACTIVE_ARCH=NO >> "$WORKSPACE/build.log" 2>&1
xcodebuild_pretty -configuration Debug -sdk iphoneos -target TestRunner ARCHS="armv7" ONLY_ACTIVE_ARCH=NO
echo "Packaging TestRunner..."
xcrun -sdk iphoneos PackageApplication -v "$WORKSPACE/cmake-build/tests/TestRunner/Debug-iphoneos/TestRunner.app" \
-o "$WORKSPACE/cmake-build/tests/TestRunner/Debug-iphoneos/TestRunner.ipa" \
>> "$WORKSPACE/build.log" 2>&1
>> "$WORKSPACE/build.log" 2>&1
2 changes: 1 addition & 1 deletion build/scripts/buildWebKitFromWithinXcode.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

xcodebuild -target JavaScriptCore -sdk "$SDKROOT" -configuration $CONFIGURATION ARCHS="$ARCHS" ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH $DEPLOYMENT_TARGET_SETTING_NAME=${!DEPLOYMENT_TARGET_CLANG_ENV_NAME}
xcodebuild -target JavaScriptCore -sdk "$SDKROOT" -configuration $CONFIGURATION ARCHS="$ARCHS" ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH $DEPLOYMENT_TARGET_SETTING_NAME=${!DEPLOYMENT_TARGET_CLANG_ENV_NAME} GCC_WARN_INHIBIT_ALL_WARNINGS=YES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fealebenpae Does it make sense to add xcpretty here, too? This would reduce the build log in Xcode, that quite often makes it unresponsive.

Edit: On a second thought, that would make it pass twice through xcpretty and that doesn't work as nice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not do that, because Xcode relies on error messages being printed in the format they are in so that they can be picked up by the issues navigator. Besides, with GCC_WARN_INHIBIT_ALL_WARNINGS set, the endless drove of warnings will cease and the output should be smaller. Also, you can switch away from the output tab while the build is underway to mitigate the unresponsiveness problem.