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

Problems when building with Xcode 7.3 #10

Closed
Jeehut opened this issue Apr 23, 2016 · 5 comments
Closed

Problems when building with Xcode 7.3 #10

Jeehut opened this issue Apr 23, 2016 · 5 comments
Assignees

Comments

@Jeehut
Copy link

Jeehut commented Apr 23, 2016

I just recently tried to integrate DTTableViewManager to my project which has this project as its dependency. I'm somewhat experienced in installing framework dependencies with Carthage and this project didn't build correctly. So I forked it and now that I opened it, it seems to lack the correct inclusion of Carthage dependencies using the suggested build script phase method. Also the inclusion of Realm without specifying any version number, as well as using the Nimble testing framework with an exact version number all seem to be not the best dependency decisions.

As a result I suggest the following changes:

  • Use the suggested Carthage dependency integration build script method (instead project inclusion)
  • Specify the version of the Realm dependency more clearly (e.g. ~> 0.99)
  • Allow the Nimble dependency to update more often specifying against the master Branch
@DenTelezhkin
Copy link
Owner

Hey, @Dschee!

First, thanks for taking your time and submitting issues and PR's to fix this issue. Version locking will be implemented separately, i'll lock Realm and Nimble to specific versions. Let's discuss Carthage building first, and then decide how to act. I believe this issue is a good place to start, since it highlights all suggested changes.

Build script phase from Carthage

As I understood from documentation, this step is used not in the framework's xcodeproj, but in developer xcodeproj, because of AppStore submission restrictions. It should not be required for framework project.

I've spent really long time studying other repositories setup for projects and CI. It seems like most of the Swift frameworks use setup i use for dependency management - for example https://github.com/Alamofire/Alamofire and https://github.com/Alamofire/AlamofireImage don't use prebuilt binaries, include parent project into sibling project, and use git submodules. This also seems to be in line with this comment from Carthage authors - https://github.com/Carthage/Carthage#known-issues.

I really do want to distribute as .framework, however it seems until Swift 3.0 is released with ABI stability, it's really a no-go.

I believe a good setup right now should have following:

  • Support CocoaPods, Carthage
  • Have source files in Sources directory in preparation to Swift PM
  • Build from code instead of prebuilt binaries for Swift 2.x
  • Build and run tests on CI with or without Carthage, with or without git submodules.

In this sense i really like lyft setup, they build for different platforms, and verify that Carthage successfully builds frameworks.

Looking at current build error with DTTableViewManager it seems like Realm 0.99.0 broke something, and really it has nothing to do with my Xcode project setup, here's some entry from build log:

/bin/sh -c \"/Users/Denys/Projects/FrameworksTest/FrameworksTest/Carthage/Checkouts/DTTableViewManager/Example/DerivedData/DTTableViewManager/Build/Intermediates/Realm.build/Release-iphoneos/Set\ Swift\ Version.build/Script-C04B4BDB1B55C47A00FAE58E.sh\"

fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

error: could not read data from 'FrameworksTest/Carthage/Checkouts/DTTableViewManager/Carthage/Checkouts/DTModelStorage/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmSwift-Info.plist': The file “RealmSwift-Info.plist” couldn’t be opened because there is no such file.
** BUILD FAILED **
The following build commands failed:
ProcessInfoPlistFile FrameworksTest/FrameworksTest/Carthage/Checkouts/DTTableViewManager/Example/DerivedData/DTTableViewManager/Build/Products/Release-iphoneos/RealmSwift.framework/Info.plist RealmSwift/RealmSwift-Info.plist
(1 failure)

I would love to hear your feedback on this, as I have really redone my Carthage setup three or four times already, each time thinking that i'm using the correct one. I would be great to make a setup that would finally work without issues.

@Jeehut
Copy link
Author

Jeehut commented Apr 23, 2016

Hey @DenHeadless, thanks for getting back to me so quickly about this.

First let me just make clear that my main problem was that I couldn't install DTTableViewManager and solving that issue was my main goal. So, if there is any other way of solving this – like using a specific version of Realm – that would be fine with me.

The reason why I also restructured files in my PR and added the suggested method is simply because that combination always worked for me fine so I was sure it would solve the problem (and it did). Other than that I can always understand why one would want to add a tightly integrated dependency as a git submodule (makes debugging so much more convenient) – or not use the build script phase if not necessary. I agree on the goals, too and my changes didn't do anything in another direction.

I still think though that we should use the "normal" way of adding dependencies with Carthage for anything that is not a "tightly integrated" dependency which Realm definitely isn't. So I think the overhead that using submodules brings doesn't pay for itself here – but that's just my taste, I'm fine with submodules, too.

One thing I didn't understand was why the project was placed within the DTModelStorageTests folder. In my opinion it belongs to the root path – the test path simply doesn't seem to make sense. So I changed that and also some more things. I'm not sure though if you are interested in a clean structure like the suggested one.

@DenTelezhkin
Copy link
Owner

Let's do it this way.

I've locked down versions of Realm and Nimble to v0.98.8 and v4.0.1, and made tags that should work for now

DTModelStorage -> 2.4.5
DTTableViewManager -> 4.5.4
DTCollectionViewManager -> 4.5.4.

I've verified locally that these versions work through Carthage. Can you try and check if those work for you?

In the future i'll move code to Sources directory and prepare CI to allow building with Carthage so that issues like this one would not go unnoticed. I'll think more about how to integrate Realm, too. When it will be done, i'll make new releases for all three frameworks, post an update on this issue and close it. Sounds good?

@Jeehut
Copy link
Author

Jeehut commented Apr 24, 2016

I updated DTTableViewManager to 4.5.4 and it's working fine now – the rest sounds good, too, thanks!

@DenTelezhkin
Copy link
Owner

Okay, so i've finally made some improvements to CI and project setups. Unfortunately, carthage builds are too long for TravisCI to handle - https://travis-ci.org/DenHeadless/DTTableViewManager/jobs/129080771

Right now i'm opting too verifying all builds locally, hopefully when Swift 3.0 is released i'll be able to migrate to prebuilt binary frameworks and forget this nightmare.

New releases with new directory structures and Realm 0.102.0:

DTModelStorage -> 2.5.1
DTTableViewManager -> 4.6.1
DTCollectionViewManager -> 4.6.1

I'm going to close all opened issues and PR's and I want to thank you for bringing this stuff up. As I'm not an active Carthage user, i would totally miss this stuff. 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants