Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the Run Script and Build Phase in Xcode?

To get Carthage set up, the documentation says that you need to add a Run Script.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks 

and add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/Box.framework $(SRCROOT)/Carthage/Build/iOS/Result.framework $(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework 

This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.

However, I can't find the Build Phases tab anymore or Run Script in the Build Settings search. The Xcode 8 Release Notes mention

Xcode 8 provides completely rewritten AppleScript support. A new scripting dictionary provides the ability to automate Xcode workflows.

Does that mean there is no more Run Script? I looked at AppleScript but honestly it looks overwhelmingly complex. Do I need to learn AppleScript just to add the simple one liner that I used to do in Xcode?

/usr/local/bin/carthage copy-frameworks 
like image 993
Suragch Avatar asked Sep 22 '16 07:09

Suragch


People also ask

How do I check if a script is running in Xcode?

1 Select xcodeproj file of you project -> Select Target -> Select Build Phases -> Click on plus button (upper left corner) -> Select New Run Script Phase. 2If you want to run a script while it is being installed on the device then please check a little checkbox just below the script box.

What is a Run script phase?

The Run Script build phase provides a place to enter any input and output files for your script. Use input and output files to customize your script's behavior and to help the build system understand when to execute your script.

How do I run a shell script in Xcode?

In Terminal, make the shell script an executable by running chmod +x $filename.sh . Add code to your custom build script — including a shebang in the first line; for example #!/bin/sh — and add it to your Git repository. Xcode Cloud runs it automatically when it starts the next build.


2 Answers

It is still there. Make sure you click everywhere indicated in red in the image below.

enter image description here

like image 161
Suragch Avatar answered Sep 22 '22 17:09

Suragch


You can configure different build phases to perform tasks when building a target.

To view the build phases, open the project editor and click Build Phases. To add build phases that don’t appear in the editor, click the Add button (+) and choose a build phase from the pop-up menu.

Project Editor

Use the project editor to view and edit your project and target settings, such as build options, target architectures, and code signing characteristics. In the main window, click the file icon () in the navigator area and select the project below. The project editor appears to the right of the navigator. Choose either the project or a target from the pop-up menu and use the tabs to switch to the different types of settings.

enter image description here

The Run script:

Runs a specified shell script during the build process. This script can reference build settings from the target, such as $(SRCROOT), the directory containing the target’s source files. This build phase also lets you provide a list of input and output files. The script always runs when no input and output files are provided. When input and output files are provided, the script only runs if it has never been run before, one of the input files has changed, or one of the output files is missing. This build phase can be enabled for all builds or only during an installation build, and maybe added multiple times per target.

like image 44
Paresh Mangukiya Avatar answered Sep 23 '22 17:09

Paresh Mangukiya