Difference between revisions of "Xcode"

From havefunsoft wiki
Jump to: navigation, search
m (simutils)
m (xcodebuild)
Line 3: Line 3:
 
However it comes with some handy command-line tools that could be used for building projects. See [https://developer.apple.com/library/ios/technotes/tn2339/_index.html Technical Note TN2339] for FAQ.
 
However it comes with some handy command-line tools that could be used for building projects. See [https://developer.apple.com/library/ios/technotes/tn2339/_index.html Technical Note TN2339] for FAQ.
  
==xcodebuild==
+
==Command Line Utilities==
 +
===xcodebuild===
 
[https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html xcodebuild Man Page]
 
[https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html xcodebuild Man Page]
 
List all available SDKs
 
List all available SDKs
Line 9: Line 10:
 
Build a project by it's (project directory) name and a specified sdk
 
Build a project by it's (project directory) name and a specified sdk
 
  xcodebuild -sdk iphonesimulator9.1 -project testProjGen.xcodeproj
 
  xcodebuild -sdk iphonesimulator9.1 -project testProjGen.xcodeproj
 +
 
==instruments==
 
==instruments==
 
The utility should only be ran via xcrun. Read manual page provided with Xcode command-line utilities installed.
 
The utility should only be ran via xcrun. Read manual page provided with Xcode command-line utilities installed.

Revision as of 22:45, 5 December 2015

The Apple's default IDE is quite hostile to FPC, since it doesn't provide any source of "native" integration. In order for the compiler to be called a custom Run Script is needed to be used.

However it comes with some handy command-line tools that could be used for building projects. See Technical Note TN2339 for FAQ.

Command Line Utilities

xcodebuild

xcodebuild Man Page List all available SDKs

xcodebuild -showsdks

Build a project by it's (project directory) name and a specified sdk

xcodebuild -sdk iphonesimulator9.1 -project testProjGen.xcodeproj

instruments

The utility should only be ran via xcrun. Read manual page provided with Xcode command-line utilities installed.

The following command line runs Simulator booting the specified device. If the simulator is already running it would be rebooted with a the specified device, if it's different to the one already running.

xcrun instruments -w "%identifier%" -t "%template%"
  • %identifier% - is a part of the device name or ID.
  • %template% - if template is specified, then instruments doesn't return. If template is not specified (causes a warning on running) the instruments exists, leaving the device running.

simutils

An utility fo additional control over the simulator. Must be ran via "xcrun"

Lists all available devices in JSON format.

xcrun simctl list devices -j

Running without "devices" would list all devices. "-j" requests JSON format

Run Script

  • in order to return an error, the (bash) script must use "exit" command with non-zero value. FPC returns a non-zero value when compiling failed.
  • do not specify "output files" of the script. Otherwise "Clean" will be required to make the script executed again