Update iPhoneExample for Xcode 4.2

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

Update iPhoneExample for Xcode 4.2

Postby mattdipasquale » 20 Aug 2011, 21:52

I'm willing to take on all these requests. But, I wanted to run them by Erik first.

1. I request that we recreate the iPhoneExample project with the latest version of Xcode: Xcode 4.2 and iOS 5 SDK beta 6 (Lion)

In Xcode 4.2, you can run both logic & application unit tests from the simulator.

Actually, when you create a new project with any of the iOS > Application templates and select Include Unit Tests, Xcode creates just one testing target for you that automatically supports application testing.

2. I also add my logic unit tests to the same target. And so, I also request that we make just one Cocoa Touch Static Library, which can be used both for device and simulator, instead of two.

If you want to see the steps to support application unit testing, see this link:
http://j.mp/nCac2Q

3. Finally, I also request that we remove iPhoneExample from the ocmock repository and that Erik create a separate repository on GitHub just for iPhoneExample. Then, we can add ocmock as a submodule to the iPhoneExample repo and add OCMock ass a cross-project reference to the iPhoneExample Xcode project. Below are detailed instructions for a Cocoa Touch Static Library I made called CocoaPlant (not yet published). I based these instructions off the git submodule approach on http://sstoolk.it/

Adding CocoaPlant to Your Project
---------------------------------

1. Add CocoaPlant as a [Git submodule][2] to facilitate updates & contributions.

cd path/to/your/project

# I put third-party code in Vendor, created by the next command.
git submodule add https://github.com/acani/CocoaPlant.git Vendor/CocoaPlant
git submodule update --init
git commit -am 'Add CocoaPlant as a submodule & update --init.'

In the future, you can pull in remote updates with:

git submodule foreach 'git pull --rebase'
git commit -am 'Update submodules to latest commit.'

Add an alias (to `~/.gitconfig`) for the first of the two commands above:

git config --global alias.sup "submodule foreach 'git pull --rebase'"

Then, you can just do:

git sup

2. In Xcode, select your project at the top of the Project Navigator (⌘1), and press Option-Command-N to create a new group. Name it, e.g., "Vendor." Then, create a new group inside Vendor called "CocoaPlant." Finally, with the CocoaPlant group selected, press Option-Command-A to add files to your project, select `CocoaPlant.xcodeproj` in `Vendor`, and confirm that "Copy items into destination group's folder (if needed)" is unchecked, "Create groups for any added folders" is selected, and only your application target is checked. Then, click Add. In Terminal, review and commit your changes.

git diff -w -M --color-words HEAD
git commit -am 'Add Vendor/CocoaPlant groups & CocoaPlant project.'

3. Back in Xcode, select your main Xcode project at the top of the Project Navigator (⌘1), and then, select the target you want to add CocoaPlant to.

4. Select the "Build Phases" tab.

5. Under the "Target Dependencies" group, click the plus button, select CocoaPlant from the menu, and click Add.

6. Under the "Link Binary With Libraries" group, click the plus button, select `libCocoaPlant.a` from the menu, and click Add.

7. Choose the Build Settings tab. Make sure All in the top left of the bar under the tabs.

8. Add `Vendor/CocoaPlant` to "Library Search Path" (Leave the "Recursive" checkbox unchecked.).

9. [Add `-all_load` & `-ObjC` to "Other Linker Flags."][3]

10. Include CocoaPlant in your app's prefix header file, e.g., `AppName-Prefix.pch`:

#import <CocoaPlant/CocoaPlant.h>
mattdipasquale
 

Re: Update iPhoneExample for Xcode 4.2

Postby mattdipasquale » 22 Sep 2011, 16:10

This is now done here: https://github.com/acani/ocmock
mattdipasquale
 
Posts: 3
Joined: 22 Sep 2011, 16:08


Return to OCMock