Skip to content

Commit

Permalink
Update documentation on build phases (#209)
Browse files Browse the repository at this point in the history
* Update documentation on build phases

* Improve description and example code per review
  • Loading branch information
PatrickKuijpers authored May 27, 2020
1 parent 133af42 commit e35dbfd
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions docs/Cakefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e35dbfd

Please sign in to comment.