Reputation: 111
I've been trying to add a Copy Files build phase to a project template for Xcode 4 but I cannot figure out how to add files to copy.
Here's what I've added to my target. Changes to DstPath, DstSubfolderSpec and RunOnlyForDeploymentPostprocessing are all reflected in projects created from the template. But no files. I have tried adding an array using keys named Files, Definitions, Nodes, nothing has any affect.
Any thoughts or ideas would be greatly appreciated!
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>CopyFiles</string>
<key>DstPath</key>
<string></string>
<key>DstSubfolderSpec</key>
<string>10</string>
<key>RunOnlyForDeploymentPostprocessing</key>
<string>NO</string>
</dict>
</array>
Upvotes: 11
Views: 2682
Reputation: 16463
I found a little gem hidden in some weird python script that gave a "better" (as opposed to nothing) explanation of the mysterious DstSubfolderSpec
…
# dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object.
'BUILT_PRODUCTS_DIR': 16, # Products Directory
: 1, # Wrapper
: 6, # Executables: 6
: 7, # Resources
: 15, # Java Resources
: 10, # Frameworks
: 11, # Shared Frameworks
: 12, # Shared Support
: 13, # PlugIns
There's actually quite a bit of interesting info in the script, (apparently it's part of pythonwebkit, or something).. but regardless, I posted a gist of it here if you want to try and glean any other useful tidbits.
Upvotes: 2
Reputation: 864
So far I have this working:
<dict>
<key>Class</key>
<string>CopyFiles</string>
<key>DstPath</key>
<string>www</string>
<key>DstSubfolderSpec</key>
<string>7</string>
This creates a CopyFiles build phase that copies files to the folder "www" inside of Resources. (This would result in those files living under /www in the app bundle.) However, I haven't yet been able to specify which files get copied. This is similar to this question
Upvotes: 1
Reputation: 63667
I don't know the answer but this may be a workaround. It runs a script with each build.
<key>Targets</key>
<array>
<dict>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>ShellScript</string>
<key>ShellPath</key>
<string>/bin/sh</string>
<key>ShellScript</key>
<string>~/hello.sh</string>
</dict>
Note that the path to the script is absolute. Maybe you can define a path with PathType
Group
to set it relative to a group inside the project (I didn't try).
DstPath
is the destination path of the files to copy (I guess). I don't know what DstSubfolderSpec
is, it only appears in the Command Line Tool with a value of 0. I guess you don't know it either.
Upvotes: 0