• 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: Installable Command Line Tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installable Command Line Tool


  • Subject: Re: Installable Command Line Tool
  • From: Saagar Jha <email@hidden>
  • Date: Mon, 09 Jan 2017 18:23:55 -0800

I’ve finally got it working, and I’d like to thank both of you for helping out. For posterity, here’s a couple of things that tripped me up, which may or may not seem obvious to others but might be useful to someone:

  1. If your products have the same name except for one being lowercase or whatever, be careful; HFS+ is case preserving but not case sensitive. One of the binaries will overwrite the other if you attempt to copy them to the same directory.
  2. Xcode does not provide an option for Contents/Helpers in its GUI. For that, you can select “Absolute Path” for your destination in the Copy Files Phase and use $(CODESIGNING_FOLDER_PATH)/Contents/Helpers to have the product placed in the correct directory. (rdar://problem/29940005)
  3. Similarly, Bundle/NSBundle will make it difficult to find your executable, if:
    • your executables are the same case insensitive, and you try to use url(forAuxiliaryExecutable:)
    • you put your product in Contents/Helpers, since again, there is no built-in method for accessing the folder as there is for for MacOS (executableURL), Resources (resourceURL), etc. Just stick with Bundle.main.bundleURL.appendingPathComponent(“Contents”, isDirectory: true).appendingPathComponent(“Helpers”, isDirectory: true) (rdar://problem/29940479)

Saagar Jha



On Jan 8, 2017, at 10:39 AM, Ken Thomases <email@hidden> wrote:

On Jan 8, 2017, at 12:23 PM, Chris Hanson <email@hidden> wrote:

On Jan 8, 2017, at 8:59 AM, Saagar Jha <email@hidden> wrote:

Some things ideas I’ve had:
  1. Add the Command Line Tool's product to the app’s Copy Bundle Resources. This seems to be the easiest way, but it seems to be dependent on the last build I did for the Command Line Tool (i.e. if I archived the app after debugging the CLT, the unoptimized binary would be copied over)
This is probably what you'll want to do, by dragging the product reference — which is build-products relative — to the Copy Bundle Resources phase.

Except you should create a different Copy Files build phase to copy to Contents/MacOS or Contents/Helpers or another of the standard locations for code inside the app bundle.[1]  Then, drag the product reference to that Copy Files build phase.  It shouldn't be copied to the Resources.

Because the reference is relative to the build products, it won't copy the one from the Debug directory when building the Release configuration for archiving. It'll expect there to be a built version in the Release directory.

In order to guarantee there is a built version there, you should also add a dependency on the command line tool target to you app target. That ensures you just need to build your app, and the tool will always be built first if needed.

You should also make sure "Skip Install" is turned on for the command line tool target, so when you Archive it's only built, since the app target is responsible for putting it in the right place.

Regards,
Ken

[1]: https://developer.apple.com/library/content/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-TNTAG201


 _______________________________________________
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: 
 >Installable Command Line Tool (From: Saagar Jha <email@hidden>)
 >Re: Installable Command Line Tool (From: Chris Hanson <email@hidden>)
 >Re: Installable Command Line Tool (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Not finding libraries (Howard Moon)
  • Next by Date: markers
  • Previous by thread: Re: Installable Command Line Tool
  • Next by thread: Re: Spontaneous never-ending builds
  • Index(es):
    • Date
    • Thread