Skip to content

Instantly share code, notes, and snippets.

@ehuynh
Created April 24, 2012 01:35
Show Gist options
  • Save ehuynh/2475334 to your computer and use it in GitHub Desktop.
Save ehuynh/2475334 to your computer and use it in GitHub Desktop.
xcode CLI command

Setting up command line tools

Change the Xcode path sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Create a script folder mkdir scripts Make a copy of the RunPlatformUnitTests file into your scripts folder cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests scripts/ Update line 95 from Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)." to export OTHER_TEST_FLAGS="-RegisterForSystemEvents" RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}"

Update the build phase > run script in your test target to # Run the unit tests in this test bundle. "${SRCROOT}/scripts/RunPlatformUnitTests"

build-and-test

with targets

xcodebuild -target MyApp -sdk iphonesimulator5.1 -configuration Debug xcodebuild -target MyAppTests -sdk iphonesimulator5.1 -configuration Debug TEST_AFTER_BUILD=YES

with schemes

xcodebuild -workspace MyApp.xcworkspace -scheme SchemeName -sdk $IPHONE_SIM_SDK -configuration Debug clean build xcodebuild -workspace MyApp.xcworkspace -scheme SchemeTestName -sdk $IPHONE_SIM_SDK -configuration Debug clean build TEST_AFTER_BUILD=YES

build-test-and-release

xcodebuild -target MyAppTests -sdk iphonesimulator5.1 -configuration Debug TEST_AFTER_BUILD=YES xcodebuild -target MyApp -sdk iphoneos5.1 [ -d archive ] || mkdir archive xcrun -sdk iphoneos5.1 PackageApplication -v build/Release-iphoneos/MyApp.app -o archive/MyApp.ipa

make universal library

xcodebuild -target MyApp -sdk iphonesimulator5.1 clean build xcodebuild -target MyApp -sdk iphoneos5.1 clean build lipo -create "path/to/simulator/libary" "path/to/os/library" -output "path/to/universal/library"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment