Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

Uses DEVELOPER_DIR instead of hard-coded path to Xcode#2

Closed
lyricsboy wants to merge 2 commits intosoffes:masterfrom
lyricsboy:lyricsboy/remove-hard-coded-paths
Closed

Uses DEVELOPER_DIR instead of hard-coded path to Xcode#2
lyricsboy wants to merge 2 commits intosoffes:masterfrom
lyricsboy:lyricsboy/remove-hard-coded-paths

Conversation

@lyricsboy
Copy link

Uses a shell script as a post-build action in the schemes to post-process the module maps.

This is a little bit of a hack, but it seems to work fine. What do you think, @soffes ?

The goal is to make this work regardless of where Xcode is installed.

…ctory.

Uses a shell script as a post-build action in the schemes to post-process the module maps.
@soffes
Copy link
Owner

soffes commented Jan 27, 2017

Interesting. How are you setting DEVELOPER_DIR?

@lyricsboy
Copy link
Author

It's set by the build process automatically. The typical value is /Applications/Xcode.app/Contents/Developer

@lyricsboy
Copy link
Author

Don't merge this just yet; it worked locally when I built using Carthage but is failing on CI for some reason.

@lyricsboy
Copy link
Author

OK, I added some magic quotes around shell variables in the script, and that seems to have made my CI environment happy (it uses spaces in the derived data folder path).

This works for me now, but there are still a couple of caveats:

  • it doesn't make the built product any more portable. Using a CommonCrypto.framework built with Xcode at a different path than the machine using it to build the app will still fail (e.g. build the framework, zip it up using carthage_cache and distribute it to an environment with a different path to Xcode).
  • the better fix would be to somehow use relative paths to the system include, or variable expansion in the module map in a supported way. I'm not sure that either of these are possible with the current module map design.

@soffes
Copy link
Owner

soffes commented Feb 3, 2017

@lyricsboy thanks for checking all of those variations. Do you have any ideas to solve this?

@lyricsboy
Copy link
Author

None yet. I'm not familiar enough with module maps to say for certain if there's a better supported way. I see these changes as a marginal functional improvement, in that they support building with a non-traditional Xcode path.

If you want to merge them, I think it would be good for me to document this fanciness in the README first.

@soffes
Copy link
Owner

soffes commented Feb 3, 2017

I'll probably keep it simple to avoid unexpected behavior of mixing like you discovered. Thanks for your work on this.

I don't know what I'm doing either :) Just figured out enough to get this to work. It's a real shame this is necessary in the first place.

@iandundas
Copy link

iandundas commented Oct 4, 2017

This was super useful & solved our issue, thanks @lyricsboy.

If anyone needs it the pull request branch is available here, i.e. github "iandundas/CommonCrypto" "developer_dir" in Carthage. I'll leave it there forever.

(I couldn't work out how to point Carthage directly to this PR, so I forked it.)

@soffes
Copy link
Owner

soffes commented Mar 23, 2018

Fixed in e3d71cd

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants