2017-01-05 2 views
1

Я пытаюсь найти способ, чтобы объявить зависимость от subspec «B» до subspec «А» в podspec: «mypodspecfile.podspec», как показано ниже:Как я могу объявить зависимость от subspec 'A' от subspec 'B' в том же файле podspec?

Pod::Spec.new do |s| 
    s.name   = "MyLib-SDK" 
    s.version  = "1.0" 
    s.summary  = "My Library" 
    s.homepage  = "http://myhomepage.com" 

    s.ios.deployment_target = "8.0" 
    s.ios.frameworks = "Foundation", "UIKit", "SystemConfiguration", "Security", "CoreTelephony", "WebKit" 

    s.source  = { :git => "https://github.com/myhome/ios-project.git", :tag => "1.0" } 

    s.subspec 'MyLibrary-A' do |libOne| 
    libOne.source_files = "Headers", "Headers/**/*.h" 
    libOne.exclude_files = "Headers/Exclude" 
    libOne.resources = "SharedAssets/*" 

    libOne.libraries = "z","sqlite3" #Zlib for gzip, sqlite3 for event store 
    libOne.vendored_library = "libMyLibrary_A.a" 
    end 

    s.subspec 'MyLibrary-B' do |libTwo| 
    libTwo.source_files = "Headers", "Headers/**/*.h" 
    libTwo.exclude_files = "Headers/Exclude" 
    libTwo.resources = "SharedAssets/*" 
    libTwo.dependency 'MyLibrary-A' <-- doesn't seem to be working here!! 

    libTwo.libraries = "sqlite3" # sqlite3 for db 
    libTwo.vendored_library = "libMyLibrary_B.a" 
    end 

end 

Когда я выполняю:

$pod spec lint mypodspecfile.podspec --verbose 

-ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for MyLibrary-A depended upon by MyLibrary-B 

Любая помощь будет принята с благодарностью. Спасибо вам!

+0

Может быть, сделать то же самое, как FireBase: https://github.com/CocoaPods/Specs/blob/master/Specs/0/3/5 /Firebase/3.11.0/Firebase.podspec.json? 'libTwo.dependency =" MyLib-SDK/MyLibrary-A "или что-то подобное? – Larme

ответ

0

Вы всегда должны писать полный путь к зависимостям модуля. Ошибка указывает, что контейнеры какао не могут найти файл .podspec для MyLibrary-A в pod repo (s). Чтобы устранить проблему, укажите полный путь 'MyLib-SDK/MyLibrary-A'.

Так что ваш podspec файл должен выглядеть следующим образом:

Pod::Spec.new do |s| 
    s.name   = "MyLib-SDK" 
    s.version  = "1.0" 
    s.summary  = "My Library" 
    s.homepage  = "http://myhomepage.com" 

    s.ios.deployment_target = "8.0" 
    s.ios.frameworks = "Foundation", "UIKit", "SystemConfiguration", "Security", "CoreTelephony", "WebKit" 

    s.source = { :git => "https://github.com/myhome/ios-project.git", :tag => "#{s.version}" } 

    s.subspec 'MyLibrary-A' do |libOne| 
    libOne.source_files = "Headers", "Headers/**/*.h" 
    libOne.exclude_files = "Headers/Exclude" 
    libOne.resources = "SharedAssets/*" 

    libOne.libraries = "z","sqlite3" #Zlib for gzip, sqlite3 for event store 
    libOne.vendored_library = "libMyLibrary_A.a" 
    end 

    s.subspec 'MyLibrary-B' do |libTwo| 
    libTwo.source_files = "Headers", "Headers/**/*.h" 
    libTwo.exclude_files = "Headers/Exclude" 
    libTwo.resources = "SharedAssets/*" 
    libTwo.dependency 'MyLib-SDK/MyLibrary-A' # here is the change 

    libTwo.libraries = "sqlite3" # sqlite3 for db 
    libTwo.vendored_library = "libMyLibrary_B.a" 
    end 

end