Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Extract support project for shared code (method redirection) #129

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

joemasilotti
Copy link
Contributor

I noticed that there was shared code in the three core projects, UIKit, Foundation, and CoreLocation, all dealing with method redirection (swizzling). This PR extracts the functionality to PCKMethodRedirector in a new top-level project, Support. The three core projects then depend on this new project for their method swizzling.

The extractions required quite a bit of changes to the existing dependency management.

  1. The three projects reference the new headers via a User Search Paths pointing to the Support/Core directory.
  2. UIKit and CoreLocation link to the Support/Core library or framework (iOS vs. OS X).
  3. FoundationCore and FoundationSpecHelper both need the functionality so depend on the Support project. Both of these are tested via the same target which requires the testing target to depend on both. This leads to duplicate symbols when creating the static library. To fix this FoundationSpecHelper now depends on FoundationCore which in turn depends on SupportCore. Note that this does not apply for Frameworks (on OS X) as these are smart enough to figure out PCKMethodRedirector.o is the same and not link it in twice.
  4. All of the new logic is duplicated in the podspec to support sub-dependencies to the Support/Core project.

@idoru and I kicked off the initial extraction and I took it from there. Let's think of this PR as the beginning of a discussion as I am sure this will require some more work to be done before emerging.

It's also over 2000 changes in .xcodeproj files which, as we all know, are no fun to read :-)

Joe Masilotti and Sam Coward and others added 3 commits February 25, 2015 11:00
Projects reference Support project via User Search Paths then in Project
Dependencies and Link Binary With Libraries.

Since both FoundationCore and FoundationSpecHelper need SupportCore,
FoundationSpecHelper now depends on FoundationCore which in turn depends
on SupportCore. This is to get around a duplicate symbol error when
creating and linking the static libraries.
@joemasilotti joemasilotti force-pushed the extract-support-project branch from d6e8608 to 70dd18f Compare February 25, 2015 16:34
@akitchen
Copy link
Contributor

Thanks for taking this on. Yes, there are a lot of changes in the project config for this!

I think it would be good for us to cut a version with the rest of the recent changes before merging this one.

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.

2 participants