CocoaPods / cocoapods-downloader

A small library that provides downloaders for various source types (HTTP/SVN/Git/Mercurial)
MIT License
84 stars 72 forks source link

Vendored framework not matched when only file in pod source #95

Open asutula opened 4 years ago

asutula commented 4 years ago

Report

What did you do?

I created a Podspec that spec.source references a tgz file containing an already-compiled iOS framework. This tgz file is hosted in a GitHub release. I then tried to lint the Podspec.

What did you expect to happen?

I expected the podspec lint to complete successfully.

What happened instead?

The lint failed with:

- ERROR | [iOS] file patterns: The `vendored_frameworks` pattern did not match any file

I tracked this down to a quirk where this error only happens if the .framework directory is the only thing in the spec.source referenced a tgz file. If I touch dummy to create an empty file, add that along with the .framework to a tgz file, and reference that as the spec.source, the podspec passes lint just fine.

CocoaPods Environment

Stack

   CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 11.1 (11A1027)
         Git : git version 2.21.0 (Apple Git-122)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/aaron/.gem/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Project that demonstrates the issue

A "broken" release of the tgz file (containing only the .framework) is located at https://github.com/textileio/grpc-ipfs-lite/releases/download/v0.0.1-rc0/grpc-ipfs-lite_v0.0.1-rc0_ios-framework.tar.gz.

A working release of the tgz file (containing the .framework and an empty dummy file) is located at https://github.com/textileio/grpc-ipfs-lite/releases/download/v0.0.1-rc1/grpc-ipfs-lite_v0.0.1-rc1_ios-framework.tar.gz.

I've attached a zip containing two pod specs, one referencing each of the above tgz files. You can lint each one and see the results. Archive.zip

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

amorde commented 4 years ago

Apologies this wasn't ever addressed, but it looks like this was due to the default behavior of flattening certain archive formats (.tar.gz included).

To change this, add :flatten => false to the hash for the source attribute.

Relevant code: https://github.com/CocoaPods/cocoapods-downloader/blob/171340fd69918d5dd2c930b072587cc7436481fb/lib/cocoapods-downloader/remote_file.rb#L52-L53

I think this could definitely be improved. Here's the logic that handles flattening - we could check if the only folder is a .framework or something similar

https://github.com/CocoaPods/cocoapods-downloader/blob/171340fd69918d5dd2c930b072587cc7436481fb/lib/cocoapods-downloader/remote_file.rb#L117-L124