• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: build post-action script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build post-action script


  • Subject: Re: build post-action script
  • From: Bernie Maier <email@hidden>
  • Date: Sun, 21 May 2017 21:51:24 +1000

I need some help copying some files to a subfolder after the build phase.
Currently the files are copied to the Resources folder in my app bundle. I
want to move them to a subfolder called “Presets"

I tried setting this in the scheme editor:

echo "post-action started";
cd
~/Library/Developer/Xcode/DerivedData/MyApp-gswhkazxvagxzqcwnlhaieaetcvk/Build/Products/Debug/MyApp.app/Contents/Resources;
mkdir Presets;
mv MyFile Presets;

Nothing happens  :-(

What am I doing wrong?

Without trying it again for myself, I can't be certain. But from my initial reading of your description and what I have tried for myself in the past I'm pretty sure that the temptingly named "post-action script" is not what you want.

For starters, when I last tried to use them, build scheme pre-action and post-action scripts had the irritating behaviour of being effectively invisible to the Xcode build log, because their output simply isn't recorded / displayed by Xcode. This Xcode behaviour vastly limits their usefulness, in my opinion.

In any case, the kind of behaviour you want is already adequately covered by defining an appropriate build phase. That is, a build phase that isn't (necessarily) scheme specific, but just is part of how you build your target. You have at least two choices for a custom build phase: 1. Add an additional "Copy Files" build phase and configure the destination to be "Resources" but additionally you can configure a subpath of resources, e.g. "Presets". I actually use this option in my audio plugins builds to copy a custom font used by the plugin UI. 2. Add a "Run script" build phase, which is very similar to what you are attempting to do with your post-action script. Here you can run pretty much whatever you like. As an aside, I'm not sure you are really hard-coding a specific path to cd to; maybe that's yet another shortcoming of the post-action scripts. Within a build phase you certainly have access to environment variables to locate important build directories without hardcoding them.

In summary, if you only have a very small number of files to put in the presets subdirectory, I'm pretty sure the easiest way to do that is with an appropriately configured "Copy Files" build phase, and there is no need to write your own scripts. But if you really want a script, use a "Run scripts" build phase, not a post-action script.

- Bernie

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >build post-action script (From: "J.E. Schotsman" <email@hidden>)

  • Prev by Date: build post-action script
  • Next by Date: Re: build post-action script
  • Previous by thread: build post-action script
  • Next by thread: Re: build post-action script
  • Index(es):
    • Date
    • Thread