mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Switch cibuild to xcodebuild and xcpretty
`xctool` runs the tests as logic only whereas `xcodebuild` and XCode run them as application tests. When tests are running logic only a lot of the subsystems that would be available on the simulator are not there, for example keychain and networking. https://github.com/facebook/xctool/issues/269 https://github.com/AFNetworking/AFNetworking/pull/1707 https://github.com/facebook/xctool/issues/367 https://github.com/facebook/xctool/issues/553
This commit is contained in:
parent
b8885e6509
commit
c3b155cfd4
@ -10,9 +10,12 @@ config ()
|
||||
{
|
||||
# A whitespace-separated list of executables that must be present and locatable.
|
||||
# These will each be installed through Homebrew if not found.
|
||||
: ${REQUIRED_TOOLS="xctool cmake libssh2 libtool autoconf automake pkg-config"}
|
||||
: ${REQUIRED_TOOLS="cmake libssh2 libtool autoconf automake pkg-config"}
|
||||
: ${REQUIRED_GEMS="xcpretty"}
|
||||
|
||||
export REQUIRED_TOOLS
|
||||
export REQUIRED_GEMS
|
||||
|
||||
}
|
||||
|
||||
##
|
||||
@ -102,6 +105,11 @@ check_deps ()
|
||||
sudo ln -s "$brew_prefix/$product" "$destination"
|
||||
done
|
||||
fi
|
||||
|
||||
for gem in $REQUIRED_GEMS
|
||||
do
|
||||
gem install "$gem"
|
||||
done
|
||||
}
|
||||
|
||||
bootstrap_submodule ()
|
||||
|
||||
@ -13,7 +13,7 @@ config ()
|
||||
# The workspace to build.
|
||||
#
|
||||
# If not set and no workspace is found, the -workspace flag will not be passed
|
||||
# to `xctool`.
|
||||
# to `xcodebuild`.
|
||||
#
|
||||
# Only one of `XCWORKSPACE` and `XCODEPROJ` needs to be set. The former will
|
||||
# take precedence.
|
||||
@ -22,7 +22,7 @@ config ()
|
||||
# The project to build.
|
||||
#
|
||||
# If not set and no project is found, the -project flag will not be passed
|
||||
# to `xctool`.
|
||||
# to `xcodebuild`.
|
||||
#
|
||||
# Only one of `XCWORKSPACE` and `XCODEPROJ` needs to be set. The former will
|
||||
# take precedence.
|
||||
@ -33,8 +33,8 @@ config ()
|
||||
# If this file does not exist, it is not considered an error.
|
||||
: ${BOOTSTRAP="$SCRIPT_DIR/bootstrap"}
|
||||
|
||||
# Extra options to pass to xctool.
|
||||
: ${XCTOOL_OPTIONS="RUN_CLANG_STATIC_ANALYZER=NO"}
|
||||
# Extra options to pass to xcodebuild.
|
||||
: ${XCODEBUILD_OPTIONS="RUN_CLANG_STATIC_ANALYZER=NO"}
|
||||
|
||||
# A whitespace-separated list of default schemes to build.
|
||||
#
|
||||
@ -44,7 +44,7 @@ config ()
|
||||
export XCWORKSPACE
|
||||
export XCODEPROJ
|
||||
export BOOTSTRAP
|
||||
export XCTOOL_OPTIONS
|
||||
export XCODEBUILD_OPTIONS
|
||||
export SCHEMES
|
||||
}
|
||||
|
||||
@ -86,17 +86,17 @@ find_pattern ()
|
||||
ls -d $1 2>/dev/null | head -n 1
|
||||
}
|
||||
|
||||
run_xctool ()
|
||||
run_xcodebuild ()
|
||||
{
|
||||
if [ -n "$XCWORKSPACE" ]
|
||||
then
|
||||
xctool -workspace "$XCWORKSPACE" $XCTOOL_OPTIONS "$@" \
|
||||
xcodebuild -workspace "$XCWORKSPACE" $XCODEBUILD_OPTIONS "$@" \
|
||||
ONLY_ACTIVE_ARCH=NO \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO 2>&1
|
||||
elif [ -n "$XCODEPROJ" ]
|
||||
then
|
||||
xctool -project "$XCODEPROJ" $XCTOOL_OPTIONS "$@" \
|
||||
xcodebuild -project "$XCODEPROJ" $XCODEBUILD_OPTIONS "$@" \
|
||||
ONLY_ACTIVE_ARCH=NO \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO 2>&1
|
||||
@ -108,7 +108,7 @@ run_xctool ()
|
||||
|
||||
parse_build ()
|
||||
{
|
||||
awk -f "$SCRIPT_DIR/xctool.awk" 2>&1 >/dev/null
|
||||
awk -f "$SCRIPT_DIR/xcodebuild.awk" 2>&1 >/dev/null
|
||||
}
|
||||
|
||||
build_scheme ()
|
||||
@ -122,7 +122,7 @@ build_scheme ()
|
||||
local action=test
|
||||
|
||||
# Determine whether we can run unit tests for this target.
|
||||
run_xctool -scheme "$scheme" run-tests | parse_build
|
||||
run_xcodebuild -scheme "$scheme" test | parse_build
|
||||
|
||||
local awkstatus=$?
|
||||
|
||||
@ -132,7 +132,7 @@ build_scheme ()
|
||||
sdkflags=(-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5")
|
||||
|
||||
# Determine whether the unit tests will run with iphonesimulator
|
||||
run_xctool "${sdkflags[@]}" -scheme "$scheme" run-tests | parse_build
|
||||
run_xcodebuild "${sdkflags[@]}" -scheme "$scheme" tests | parse_build
|
||||
|
||||
awkstatus=$?
|
||||
|
||||
@ -149,11 +149,11 @@ build_scheme ()
|
||||
action=build
|
||||
fi
|
||||
|
||||
run_xctool "${sdkflags[@]}" -scheme "$scheme" $action
|
||||
run_xcodebuild "${sdkflags[@]}" -scheme "$scheme" $action | xcpretty
|
||||
}
|
||||
|
||||
export -f build_scheme
|
||||
export -f run_xctool
|
||||
export -f run_xcodebuild
|
||||
export -f parse_build
|
||||
|
||||
main
|
||||
|
||||
@ -13,23 +13,11 @@ BEGIN {
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/is not valid for Testing/ {
|
||||
exit 2;
|
||||
}
|
||||
|
||||
/[0-9]+: (error|warning):/ {
|
||||
errors = errors $0 "\n";
|
||||
}
|
||||
|
||||
/(TEST|BUILD) FAILED/ {
|
||||
status = 1;
|
||||
/A build only device cannot be used to run this target/ {
|
||||
status = 1
|
||||
}
|
||||
|
||||
END {
|
||||
if (length(errors) > 0) {
|
||||
print "\n*** All errors:\n" errors;
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
exit status;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user