What I am trying to achieve is editing code in vim then running make and that would invoke the same functionality as Cmd+R in Xcode: build and launch a simulator with latest changes.
What actual commands are invoked and what parameters are used in this process? Is there a way to view this from Xcode?
Try running xcodebuild from project's directory. Running with --help parameter will reveal all the stuff that you need - which project to build, which target to run, which sdk to use (iphoneos or iphonesimulator). Usually the call looks like this:
xcodebuild -project MyProject -target MyApplication -configuration Release -sdk iphonesimulator5.1
Related
Does xcode use of the xcodebuild command behind the scenes to build?
If so, how can I find the exact xcodebuild command that is run?
I checked the report navigator but couldn't find it in there.
I would have thought that running xcodebuild -sdk iphonesimulator -configuration Debug -project <myproject>.xcodeproj -scheme <myscheme> would be identical to selecting product -> build in xcode (with a scheme/destination matching the command line), but they seem to have slightly different behavior.
For example, when running the command line above with the -showBuildSettings option, I noticed that BUILD_ACTIVE_RESOURCES_ONLY=NO even though it should be set to YES according to the target's build settings. When running product -> build from xcode, the build settings logs (generated by following #Slipp D. Thompson's answer here) show BUILD_ACTIVE_RESOURCES_ONLY=YES.
There are few other strange differences I noticed as well.
No. One could do an experiment: move all xcodebuild binaries in some local folder and check that Xcode still able to build some application.
Since Apple presents xcodebuild as a self contained command line tool for building Xcode projects, it is reasonable to suspect that use code sharing between both tools.
I'm trying to build an Xcode project through the terminal. My project uses a submodule called SwiftRichString which I'm importing in one of my files.
On my terminal, I tried:
xcodebuild -project MyProject.xcodeproj
But this says that it cannot find the module called SwiftRichString, as expected.
So then I tried,
xcodebuild -scheme SwiftRichString
This worked and said "Build Succeeded", but then if I try to do
xcodebuild -project MyProject.xcodeproj
it fails just like before.
If I go to Xcode and go to Product>Scheme>SwiftRichString and build it, it succeeds building. Then if I build my project within Xcode, it works, but it doesn't build in terminal.
I have an Xcode project that I myself did not author. It has a multi-stage build sequence that is not trivial. For the purposes of static-analysis I am attempting to build it from command line using xcode build. However, the command line invocation produces errors in the build that the GUI build does not.
Is there a sure-fire way to get an Xcode project to build exactly as it did in the command line as in the GUI?
I would be wonderful is there was a way to export an XCODEBUILD invocation from the GUI that covered all the build phases. Is this possible?
I am using an invocation like:
xcodebuild -workspace "PROJECT.xcworkspace" -scheme "MY SCHEME NAME" -sdk iphonesimulator8.1 -configuration Debug
Ok, so I know how to change XCode build setting to Legacy using the UI shown below.
But how do I build an app from the console using that Legacy setting? I think it has something to do with the command xcodebuild -derivedDataPath <path>. But how do I set it to legacy?
There is no Legacy setting from xcodebuild, although you could use CONFIGURATION_BUILD_DIR to change the default build path:
xcodebuild -project 'MyProject.xcodeproj' \
-configuration 'Release' \
-sdk macosx10.10 CONFIGURATION_BUILD_DIR=/Path/To/Build/Release
If you wanted to build a Debug version just change the configuration flag. If the path is a nonexistent directory xcodebuild should create it automatically.
I've been searching for how to configure Bamboo (a continuous integration system) to build an Xcode project. This should be pretty simple, as it is just getting it to run a shell command such as:
xcodebuild -project ProjectName -target TargetName -configuration ConfigType
However this is proving more difficult than expected. I've investigated creating a "custom builder" for the xcodbuild command (tells Bamboo about the command) but then it only seems to let you pass ONE argument to the command not the multiple that the xcodebuild command requires. Any help or pointers would be much appreciated, including links to any appropriate examples (I couldn't find any.) Thanks.
OK, I got a "HelloWorld" example working by choosing the "script" option with a shell script rather than a "custom builder" and trying to tell Bamboo how to use xcodebuild command directly. Just specified a script like below.
#!/bin/bash
/usr/bin/xcodebuild -project TestProject/TestProject.xcodeproj -target TestProject -configuration Release build
That might have done the trick but there is a more generic way to do it.
You can define in your agent capabilities as a Command to execute /usr/bin/xcodebuild. Then in your tasks after you checkout your code, you can define a task Command, and you can select Xcode from the drop down list and provide the arguments needed for the project in the relevant input -workspace YourProject.xcworkspace -scheme YourProject. This approach provides more flexibility since Xcode installation can differ from agent to agent but bamboo will still be able to forward your builds properly where they can be build.