diff --git a/test_projects/ios/EarlGreyExample/.gitignore b/test_projects/ios/EarlGreyExample/.gitignore index e771e43857..4003300b15 100644 --- a/test_projects/ios/EarlGreyExample/.gitignore +++ b/test_projects/ios/EarlGreyExample/.gitignore @@ -4,4 +4,3 @@ Pods/ Podfile.lock xcuserdata/ *.xcworkspace/ -dd_tmp diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 1f109da2fb..1185e6001f 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -1,44 +1,71 @@ #!/usr/bin/env bash function setup_ios_env() { + if ! [ -x "$(command -v xcpretty)" ]; then + gem install cocoapods + fi local dir=$(dirname "$BASH_SOURCE") - gem install cocoapods (cd "$dir" && pod install) } +function install_xcpretty() { + if ! [ -x "$(command -v xcpretty)" ]; then + gem install xcpretty + fi +} + +function universal_framework() { + local dir=$(dirname "$BASH_SOURCE") + "$dir/universal_framework.sh" +} + function earl_grey_example() { local dir=$(dirname "$BASH_SOURCE") + local buildDir="$dir/build" + for arg in "$@"; do case "$arg" in '--generate' | '-g') - "$dir/build_example.sh" - ;; - '--copy' | '-c') - echo "TODO" - ;; + install_xcpretty - esac done -} + rm -rf "$buildDir" -function earl_grey_ftl() { - local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do case "$arg" in + xcodebuild build-for-testing \ + -allowProvisioningUpdates \ + -workspace "$dir/EarlGreyExample.xcworkspace" \ + -scheme "EarlGreyExampleSwiftTests" \ + -derivedDataPath "$buildDir" \ + -sdk iphoneos | + xcpretty - '--generate' | '-g') - "$dir/build_ftl.sh" + xcodebuild build-for-testing \ + -allowProvisioningUpdates \ + -workspace "$dir/EarlGreyExample.xcworkspace" \ + -scheme "EarlGreyExampleTests" \ + -derivedDataPath "$buildDir" \ + -sdk iphoneos | + xcpretty ;; '--copy' | '-c') - echo "--copy TODO" + + local productsDir="$dir/build/Build/Products" + + cp -R "$productsDir/*-iphoneos" "$FLANK_FIXTURES_TMP/" + + cp "$productsDir/*.xctestrun" "$FLANK_FIXTURES_TMP/" + + cp \ + "$productsDir/Debug-iphoneos/EarlGreyExampleTests.xctest/EarlGreyExampleTests" \ + "$FLANK_FIXTURES_TMP/objc/" + + cp \ + "$productsDir/Debug-iphoneos/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests" \ + "$FLANK_FIXTURES_TMP/swift/" ;; esac done } -function universal_framework() { - local dir=$(dirname "$BASH_SOURCE") - "$dir/universal_framework.sh" -} - echo "iOS test projects ops loaded"