Cocoanetics / DTFoundation

Standard toolset classes and categories
BSD 2-Clause "Simplified" License
805 stars 237 forks source link

Create Spec and Subspecs for Cocoapods #18

Closed odrobnik closed 11 years ago

odrobnik commented 11 years ago

We need the spec file for DTFoundation so that it can be a dependency of DTCoreText. Also the elements that have their own static lib targets should be their own sub specs.

odrobnik commented 11 years ago

How do I specify the linking of CoreData.framework for DTDownloadCache?

fabiopelosin commented 11 years ago

I think that the best solution would be to namespace DTDownloadChache and DTBonjour in the file system as well.

FYI you can check the validity of a podspec running:

$ pod spec lint DTFoundation.podspec --verbose
// this requires to temporarily remove the branch information from the source.

You can also inspect what CocoaPods sees by running:

$ pod spec lint DTFoundation.podspec --no-clean
$ open /tmp/CocoaPods/Lint/Pods/Pods.xcodeproj
odrobnik commented 11 years ago

i tried the lint thing, but it fails on my MacBook, something about include being unknown...

I know, I still need to split out DTDownloadCache which uses DoreData and a few other things

Also of course I still need to tag version 1.0.0, but I want to do that once the podspec is complete.

fabiopelosin commented 11 years ago

i tried the lint thing, but it fails on my MacBook, something about include being unknown...

spec.version.to_s should have fixed it.

Awesome looks like we are getting closer to complete the podspec.

odrobnik commented 11 years ago

I also added a 1.0.0 tag. the podspec repo is having issues right now, so I cannot verify it.

odrobnik commented 11 years ago

I seem to have this problem when lint-ing the pod spec:

-> DTFoundation (1.0.0)

This file is part of the Core sub spec, why can pod not find the file?

alloy commented 11 years ago

@Cocoanetics When you run lint with the --no-clean option and then inspect the Xcode project, like @irrationalfab suggested, can you see what the problem is?

odrobnik commented 11 years ago

I see that the NSString+DTPaths is indeed missing. Looks like this is wrong:

spec.subspec 'Core' do |ss|
  ss.source_files = 'Core/Source/*.{h,m}'
  ss.ios.source_files = 'Core/Source/iOS/*.{h,m}'
  ss.osx.source_files = 'Core/Source/OSX/*.{h,m}'
end

How can I configure it correctly to have platform-dependent code in the iOS/OSX folders and platform-independent code in Core/Source

The non-cleaned Pods.xcodeproj only has the iOS source, all the ss.source_files are missing.

alloy commented 11 years ago

Try:

spec.subspec 'Core' do |ss|
  ss.ios.source_files = 'Core/Source/*.{h,m}', 'Core/Source/iOS/*.{h,m}'
  ss.osx.source_files = 'Core/Source/*.{h,m}', 'Core/Source/OSX/*.{h,m}'
end
odrobnik commented 11 years ago

Yes, that did the trick. After cleaning up a few other things I get a successful lint.

odrobnik commented 11 years ago

Now I have both DTFoundation and DTCoreText working, BUT I believe there to be a bug in CocoaPods: there are problems having dependencies on sub-specs from a larger project if these subspecs require a higher deployment target. I raised this issue: https://github.com/CocoaPods/CocoaPods/issues/745

fabiopelosin commented 11 years ago

Btw, this is a bug in CocoaPods which should be fixed in 0.17.

fabiopelosin commented 11 years ago

the previous comment refers to the source files issue

odrobnik commented 11 years ago

I am trying to further separate the things that need UIKIt and AppKit. These show up in pod search, but they don't get installed by pod install, even if I reference DTFoundation/UIKit. Why?

https://github.com/Cocoanetics/DTFoundation/blob/master/DTFoundation.podspec

odrobnik commented 11 years ago

I think I got it working now. Somehow pod was not updating an existing project as it should.

fabiopelosin commented 11 years ago

Where you running pod install or pod update?

odrobnik commented 11 years ago

I was trying both. Neither seemed to add the new UIKit subspec to the Pods project.

fabiopelosin commented 11 years ago

Oh, I see, you didn't change the version. This is an unimplemented feature. CocoaPods does't install all the Pods every-time but just the ones that changed. In the future we should check for the SHA1 of the podspec to see if an already installed version needs to be reinstalled. However for the time being the work around for this situations is to delete the folder of the Pod.