Reputation: 22597
I have one Xcode project with multiple targets. During development, it is becoming laborious to compile and install each separately.
Is there a way, through scripting or otherwise; that I can automate the build and install to device of multiple targets at once.
Many thanks in advance!
Upvotes: 17
Views: 10878
Reputation: 1224
In Xcode, within Product > Scheme > Manage Schemes, you'll see a list of schemes that were automatically added, i.e. one scheme for each target in the project. Edit the active scheme, then from the Build phase of that scheme add the secondary target. Now when you clean or build this project using the active scheme, it will clean or build both targets.
Note: the active scheme is shown checked on the Product > Scheme menu.
Upvotes: 2
Reputation: 700
xcodebuild
does also support multiple targets it just does not say it anywhere in the man page or documentation
xcodebuild -target targ1 -target targ2
Upvotes: 11
Reputation: 21882
Within a target, you can add other targets as dependencies. So pick one that's going to be your "master" target, or just create another target to act as a container for all your other targets, add your other targets as dependencies, and build that.
Upvotes: 9
Reputation: 69047
Have you tried using xcodebuild
from the command line?
xcodebuild -project projName -alltargets
man xcodebuild
will list all available options.
Upvotes: 15