Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cocoapods distribution #57

Closed
wants to merge 25 commits into from
Closed

Conversation

joeljfischer
Copy link
Contributor

:bowtie: Ready to merge :bowtie:

Closes #5 & #6

Summary

This branch is intended to alter distribution methods for this repository.

  1. Build a iOS 8+ dynamic framework (video)
  2. Add the ability to run tests on that framework
  3. Add an example app that embeds the framework target to the same project
  4. Write a podspec and fix errors currently preventing a Cocoapods build from working
  5. Have the ability to use Carthage for distribution

See this presentation for an overview.

Disadvantages

This would remove the ability to build a "fake framework" target that we currently use for builds. This means that the only way to continue to get iOS 7 support is through Cocoapods (or manually adding the Library directory to their project). We could add an additional target to continue the fake framework support, if we wished, or stick with Cocoapods as the only iOS 7 support.

Dynamic frameworks provide iOS 7 support! Weakly linking them means that despite a warning, everything should work fine in iOS 7 as long as the framework also targets iOS 7+.

In Depth

Build an iOS 7+ framework

iOS moves pretty quickly; dynamic frameworks are worlds better than static libraries and fake frameworks. This means that we should be working towards an implementation that can build proper dynamic frameworks. They're easy to import, and must be supported by cocoapods' current beta release.

Testing

Dynamic framework targets come with a test target automatically. This makes it much easier to implement tests on the library code. It also opens up continuous integration as a possibility.

Example App

Dynamic framework targets come with the ability to be embedded in app targets within the same project. This will make shipping an example app about a million times easier.

CocoaPods

CocoaPods is by far the largest / most comprehensive resource for importing open-source projects into Xcode. We really need to support it. Unfortunately, the current import setup does not work for either frameworks or cocoapods (which will be building frameworks when it can in their next release). This PR supplies a podspec which will need to be verified.

Verifying a podspec is usually pretty easy. You commit, tag, and run a lint command line command to test your repo is setup properly. If it isn't, you commit and tweak until it works. That cannot be done on this repository, unfortunately. We will have to create a test repository that we can tweak, figure out what works, and move that work back here.

Note that unless we explicitly add back in a fake framework target / script, this will be the only way to get this library for sub iOS 8 targets (which is important, I'm just not sure if this is enough. I think it should be).

Carthage

Some developers prefer the Carthage distribution system. Carthage doesn't make changes to the project that's importing the libraries, because it only supports dynamic frameworks. It is virtually free to implement.

Major Version Change

This release also fixes a lot of issues forced into the open by actually building a dynamic framework. These issues are around the main public interface file not properly importing all public headers, and the project not properly hiding all private headers. These changes to scope on headers means that it is now a major version change.

TODOs

Podspec
  • Create a podspec
  • Create a test repository
  • Push this branch to the test repo as master, and create an example tag
  • Alter the podspec to account for the new repo
  • Lint the spec with pod spec lint
  • Remove the comments and unused parameters
Example / Test App
  • Create a test app that embeds the framework
  • Write the example app
Framework
  • Regroup files into Xcode groups
  • Consider separating files into file system folders
  • Review SmartDeviceLink.h framework header vs. scheme public headers. Must be equivalent.
Carthage
  • Figure out what's necessary

joeljfischer and others added 3 commits January 26, 2015 11:16
The project now is by default built into a (iOS 8+) framework

The framework can run attached tests

This framework is embedded into an application which acts as an example application

Cocoapods spec is added
@joeljfischer joeljfischer added the distribution Relating to distribution of the library to developers label Jan 27, 2015
@joeljfischer
Copy link
Contributor Author

@smartdevicelink/ios please (git) checkout this branch and bring me your concerns. I don't want to run a full review on call when this branch isn't yet ready. I'm hoping to get it merged before 4.0.

@joeljfischer
Copy link
Contributor Author

The example repo can be found here: https://github.com/smartdevicelink/sdl_ios_cocoapods_test

Linting the spec (which tests the remote repo itself) is successful.

@joeljfischer joeljfischer added this to the 3.1.0 milestone Feb 5, 2015
Joel Fischer added 2 commits February 5, 2015 17:23
Library files are now within the framework's folder

Fix some warnings
@joeljfischer joeljfischer self-assigned this Feb 6, 2015
@joeljfischer joeljfischer force-pushed the feature/cocoapods-distribution branch from 3699f20 to 5c29191 Compare February 6, 2015 16:07
@joeljfischer
Copy link
Contributor Author

@smartdevicelink/ios This is ready for review.

@joeljfischer
Copy link
Contributor Author

I have identified another task to be completed before this can be merged. The framework header doesn't import everything that the scheme believes to be a public header, and they should be equivalent. Will have to review all differences and decide whether to make them public to the framework header or to move them to project instead of public in the scheme.

@joeljfischer joeljfischer force-pushed the feature/cocoapods-distribution branch from b035252 to f2b4cd3 Compare February 12, 2015 21:47
@joeljfischer
Copy link
Contributor Author

Linted the spec again, everything is still good to go.

@joeljfischer
Copy link
Contributor Author

I'm going to update the main body of this PR above, but I want to summarize the changes here. I have found proof that dynamic frameworks can, in fact, be run on iOS 7+ apps. The framework's target must be iOS 7, and the framework must be weakly linked to the iOS 7 project, the framework can then be imported and used normally.

There will be a warning claiming embedded dylibs/frameworks only run on iOS 8 or later. But that appears to be a bug. The app can be run, framework code runs normally, and the app can be archived in preparation for the app store as well, with no errors.

Credit to this fellow's post for putting me on to the idea. I used his github project to test. I was able to pull out the runtime checks for class existence and the code still ran fine, no need to have the class return an id either.

@joeljfischer joeljfischer force-pushed the feature/cocoapods-distribution branch from a042d12 to a0045cf Compare February 13, 2015 21:57
TCP and iAP connection view controllers, swap between them via the segmented control

Preferences object to thread-safely read and write to user defaults
@joeljfischer joeljfischer force-pushed the feature/cocoapods-distribution branch from a0045cf to f4b7ad6 Compare February 13, 2015 21:59
@joeljfischer
Copy link
Contributor Author

Also note that changes to the public / private -ness of header files means that this is a major version change.

@joeljfischer joeljfischer modified the milestones: 4.0.0, 3.1.0 Feb 16, 2015
@joeljfischer
Copy link
Contributor Author

I have no idea why this says going into master. It will be merged into develop. No need to close this PR, since it will be merged manually and closed manually anyway.

@joeljfischer
Copy link
Contributor Author

I added an overview presentation with some basic bullet points. Read the in depth section above for a more complete overview.

@joeljfischer
Copy link
Contributor Author

Merged to develop

@joeljfischer joeljfischer deleted the feature/cocoapods-distribution branch March 4, 2015 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distribution Relating to distribution of the library to developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a new target that builds a Cocoa Touch Framework for iOS8+
2 participants