JamitLabs / Accio

A dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.
MIT License
660 stars 32 forks source link

Expect `Info.plist` in correct location #77

Closed tcurdt closed 5 years ago

tcurdt commented 5 years ago

According to https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html the correct location for the Info.plist is FRAMEWORK.framework/Resources/Info.plist. Yet the verification code was expecting it at FRAMEWORK.framework/Info.plist and failed the integration into the Xcode project.

The PR adjusts the location and swift test passes. It also works in my test project. This should fix #73 and #76

tcurdt commented 5 years ago

I was wondering the very same thing about the location of the Info.plist. The documentation is a big vague here https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW26

For one it says:

Bundle structures can vary depending on the type of the bundle and the target platform. The following sections describe the bundle structures used most commonly in both macOS and iOS.

yet the following suggests that the Resources/Info.plist is the place to check

The system identifies a framework bundle by the .framework extension on its directory name. The system also uses the Info.plist file inside the framework’s Resources directory to gather information about the configuration of the framework

(otherwise framework version also would not work).

That said I checked what I have on disk and found these examples for iOS

/System/iOSSupport/System/Library/Frameworks/WebKit.framework/Versions/A/Resources/Info.plist
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Info.plist

To me this suggests that altering the behaviour per target of even better checking in both places could be the best strategy.

tcurdt commented 5 years ago

How do we go forward? Should amend the PR to support both locations, @Dschee?

Jeehut commented 5 years ago

Can't we just make Accio more resilient against the placement of the Info.plist file in general? E.g. by checking multiple places (maybe even regardless of the target platform? or by having a different check order per platform?) and use whatever we find. As an additional step, couldn't we simply create a basic Info.plist file if none is existing where we expect one?

As far as I remember, this was exactly the planned approach of @mrylmz. He probably just didn't have the time to finish it or maybe he just didn't think of macOS targets? I don't remember in detail, but feel free to take the approach suggested above. Then I think, we can safely merge this.

mrylmz commented 5 years ago

@Dschee there is a difference between a project Info.plist for building and a Info.plist of a build Framework, they contain different informations and as i know the final Info.plist of the build Framework is guaranteed to be existend.

It would be ok if we just check multiple known Info.plist locations as solution.

Jeehut commented 5 years ago

Okay, then let's opt for that.

tcurdt commented 5 years ago

@mrylmz If there is a difference the question is whether we need to handle the content differently depending on where they are. I didn't check that. Do you have more information on that?

tcurdt commented 5 years ago

I've updated the PR to reflect the agreed upon path forward. HTH

tcurdt commented 5 years ago

I've updated the PR as suggested.

tcurdt commented 5 years ago

@Dschee anything else that needs fixing so this can be merged?