-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Copy resources v2 #743
Comments
Related: #245 |
pngcrush comes with Xcode: http://developer.apple.com/library/ios/#qa/qa1681/_index.html |
It would be great to offer the possiblity of defining how each type of resource is optimized. For example,
|
I've used imageoptim with great success in the past |
Here is what I think would be a good way to handle resources. Xcode already has everything to package resources (compile xibs into nibs, compress png images etc.) into a resources bundle, why not leverage it? In MapBox, this problem is solved with a post install hook. In CoconutKit, this problem is solved with a separate repository for CocoaPods only! I think we can do better. I will use the MapBox example to describe what Cocoapods could do when running pod install or pod update. In Pods.xcodeproj:
In MyApp.xcodeproj:
As for resources which are not packed into a resources bundle, maybe cocoapods could just add them to the Cocoapods would need to know when to generate a resources bundle and when copying resources directly into the app. Here is quick proposition for the podspec syntax. I’m not familiar with Ruby, so maybe it doesn’t make much sense. Feel free to suggest something better.
Don’t hesitate to ask me if something is not clear. |
@0xced There are a couple of issues with this.
Nonetheless, it might definitely be worth it to check if adding the resources to the Pods Xcode project and have that process them and store them into the |
I really like where this discussion is going. So the idea is to use Xcode for creating the bundle, and hence doing the processing, is awesome. We could store set the products dir of the resource bundle targets in Advantages:
Disadvantages:
|
My comment was probably a bit to dense. For clarity sake:
|
To expand on what @irrationalfab said: What we want is that when a user updates an existing resource it automatically makes its way into new builds. (The For removed or new resources you will have to run |
As it stands, I think that Xcode does just a couple of things to resources, and keeping a script like we currently have will allow us to deal with all cases. The list we know of is:
Do you know of others? |
After taking a look at the Xcode internals it turns out that it has some specification of store in |
Let me first reply to this concern:
Obviously we can not force the creation of a resources bundle by CocoaPods. That’s precisely why I suggested two different syntaxes for defining resources. For example, the s.resources = 'TSMiniWebBrowser/images/*.png', 'TSMiniWebBrowser/*.xib' That would tell CocoaPods to copy all the resources into the main bundle of the target, which is what the TSMiniWebBrowser code is expecting. For s.resources = { :files => ['MapView/Map/Resources/*.png'], :bundle => 'MapBox' } That would tell CocoaPods to create a Now, about this:
Resources are equally necessary as code, I’m sure we all agree on that. ;-) CocoaPods is already modifying the user’s project by adding the
Finally, about this:
It works perfectly well thanks to Xcode’s built-in dependency mechanism. This is what happened when I modified the Let me give you a few more arguments in favor of suppressing
|
@0xced After giving some thought to it I think that your solution would be the best. Provide support for the bundles on top of the existing implementation. Then we should encourage the lib maintainers to use resource bundles. However I not sure that the syntax that you are proposing would be the best solution. I'm considering the possibility of adding another attribute: s.resources = 'TSMiniWebBrowser/images/*.png', 'TSMiniWebBrowser/*.xib'
s.resource_bundle = 'MapBox', ['MapView/Map/Resources/*.png'] This is so because we are support for the optional specification of the destination folder in the bundle (see the preview of the docs) s.resources = { :frameworks => 'frameworks/CrashReporter.framework' }
s.resource_bundle = 'MapBox', { :resources => 'MapView/Map/Resources/*.png' } There is also the issue #773 which is related. However I'm thinking about adding an attribute similar to |
We should also consider using Usage
|
IMHO this is missing the conversion of strings files into plists. |
@0xced @irrationalfab @Cocoanetics After updating myself on the discussions here, I think it might be better to start with a podspec attribute that allows one to specify a ‘resource bundle’ task in a xcodeproject and have CP use xcodebuild to generate it. This means the current specs that build it from the |
@alloy +1 since resource bundles are generally a good idea for libraries. Otherwise it may come to resource name clashes. |
I wrote this about a year ago: http://www.cocoanetics.com/2012/05/resource-bundles/ Crushing is only one of many more actions:
I want to have a method for: building a specific target from a specific xcodeproj and have the output be added to the Resources. The advantage would be that all projects that have a resource bundle target don't have to use a .bundle trick (which foregoes the processing of files) but could have the resource bundle be created exactly like it would when adding the project as a sub-project and adding the resource bundle as dependency. |
@Cocoanetics Yes, this is what @0xced’s proposal is and what the rest of us agreed on. My latest update was about breaking up the full proposal into:
Do you want to work on the feature that adds support for projects that already have their own resource bundle target? (So the former.) |
@alloy I am not a Ruby programmer. iOS/Mac only. So I am totally useless for that. |
Hi, I'm new here and I think that this issue could be solved along #1011 and #807 . The Pods' syntax would describe either: a) A static library ( b) A static framework ( The Pods target will then just be an aggregate target that has all .a and .framework as dependencies. I believe on OS X frameworks' resources are copied just fine, and for iOS a small script would be necessary to copy the resources from the Xcode-generated |
One question there: if it will be It is often useful to at least be able to look at the datamodel directly from Xcode (especially for us as we use internal pods for some components that provide their own model and often need to look quickly at the datamodel to remind us about the model graph): I appreciate to be able to click on the xcdatamodeld file in the Project Navigator and see the DataModel graph directly in the Xcode editor (actually see #1155 about that). |
The outcome of a discussion @irrationalfab and I had today:
We’re going to:
pod install
time. This includes:Except in the case of a local
:path
pod::path
option is a DURING DEVELOPMENT ONLY feature and should not be used for release products.Updates:
:path
instead of:local
directive, which is going to be deprecatedThe text was updated successfully, but these errors were encountered: