简体   繁体   中英

How to import an iOS framework as a git submodule, when the framework has external dependencies

You have the main Project "App" with its own Git repo; you separate out the model into a separate framework project "AppKit" again with its own Git repo. "AppKit" is imported into "App" as a Git submodule & everything is merry.

If "AppKit" has external dependencies -- let's say managed by CocoaPods, the typical import-as-submodule fails since "AppKit"s dependencies are not satisfied by the "App". I want to know if there is any way to achieve this while importing the "AppKit" as Git submodule. Can it be done?

I am aware there are several straightforward solutions to this -

  1. Make "AppKit" a "Carthage"able framework & import it
  2. Make & import "AppKit" as a CocoaPod.

I just wanted a definitive answer (in case it cannot be done as Git Submodule) so I can move on.

Context: Pursuit of the ideal solution to managing a multi-project App (so other ideas / opinions welcome)

Making the question clearer --

Can an iOS framework project be imported as a Git Submodule if it has dependencies of its own. If the sub-dependencies are --

  1. Cocoapods
  2. Carthage
  3. Git submodule

git submodule itself, as part of the Git commands, has no notion of CocoaPod dependencies.

The Cocoa dependency manager itself does have notion of such dependencies, declared as submodules, and managed as such since CocoadPod 0.1.20 (as explained here ).

That means: if AppKit itself is a CocoaPod, it can declared its own dependencies as Git submodules, and CocoaPod will manage (load) them, provided your own project ask for said dependencies, using :submodules => true

s.source   = { :git => 'https://github.com/<you>/AppKit.git', :tag => "2.1.0", :submodules => true }

So:

Can an iOS framework project be imported as a Git Submodule if it has dependencies of its own.

If that project is imported as a CocoaPod, the Cocoa dependency manager can take care of the imported project dependencies if those are git submodules.
But if the imported project is just a Git submodule (without being declared/imported as a CocoaPod), Git itself would not managed said dependencies as "CocoaPod" (since it knows nothing about XCode project dependencies).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM