From e35dbfdfd006d0f3fb13b831db80c2f4213bffd2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 27 May 2020 21:01:23 +0200 Subject: [PATCH] Update documentation on build phases (#209) * Update documentation on build phases * Improve description and example code per review --- docs/Cakefile.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/Cakefile.md b/docs/Cakefile.md index d24136bd..2c977d64 100644 --- a/docs/Cakefile.md +++ b/docs/Cakefile.md @@ -300,15 +300,32 @@ end ##### Shell Script Build Phase -You can create a Shell Script buld phase to run a script when building. +You can create a Shell Script build phase to run a script when building. +The following creates a simple script printing `Hello World`: ```ruby -target.shell_script_build_phase "Build Phase Name", <<-SCRIPT - echo "Hello World" +target.shell_script_build_phase "Build Phase Name", "echo 'Hello World'" +end +``` + +You can optionally define input- and output (file list) paths, combinbed with a multi-line script, like this: + +```ruby +myScript = <<-SCRIPT + echo "This is a multi-line script" + echo "Hello World" SCRIPT +target.shell_script_build_phase "Build Phase Name", myScript do |phase| + phase.input_paths = ["$(SRCROOT)/$(TARGET_NAME)/**/*.txt"] + phase.output_paths = ["$(SRCROOT)/$(TARGET_NAME)/OutputFiles/MyFile.txt"] + phase.input_file_list_paths = ["$(SRCROOT)/$(TARGET_NAME)/**/*.xcfilelist"] + phase.output_file_list_paths = ["$(SRCROOT)/$(TARGET_NAME)/OutputFiles/MyFileList.xcfilelist"] end ``` +Note: to move the build phase before all other build phases (right before the `Compile Sources` phase), use `target.pre_shell_script_build_phase` instead. + + ## Configurations Xcake allows you define a hierarchy of build configuations like you would in Xcode