Frage

Wie kann ich in Xcode ein "Shell -Skript" nennen, das ein Perl -Skript ist, das das kopiert? .app und .dsym Dateien zu einem anderen Verzeichnis?

Ich möchte den Namen des Projekts und/oder das Root -Verzeichnis des Projekts an das Skript übergeben. Ich möchte, dass das Skript jedes Mal, wenn ich in Release- und Verteilungsmodi erstelle, aber nicht im Debug -Modus aufgerufen habe.

War es hilfreich?

Lösung

Right-click on your target and choose Add->New Build Phase->New Run Script Build Phase.

Inside the "Script" text area, add:

if [ ${CONFIGURATION} != "Debug" ]
then
    /usr/bin/perl "${PROJECT_DIR}/myperlscript.pl" "${PRODUCT_NAME}" "${PROJECT_DIR}"
fi

Change the location and name of myperlscript.pl to be the location and name of your script.

Make sure to move the Run Script step to be after Link Binary With Libraries, since you're copying the built .app.

(Might also want to add the "perl" tag to the question)

Andere Tipps

For anyone else who is wondering, you can also do a simple copy via

[Click on Scheme Name] -> Edit Scheme... -> [Select Scheme] -> Run "Target" -> Post-actions

and add a cp command. In my case, for quick testing and ease of use, I wanted to copy my binary back to the project directory so that I could process some data files. I used the following:

cp ${TARGET_BUILD_DIR}/${TARGET_NAME} ${PROJECT_DIR}/"binaryFileName"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top