CocoaPods / cocoapods-packager

CocoaPods plugin which allows you to generate a static library from a podspec.
Other
1.14k stars 220 forks source link

Dependency ModuleMap generation error (.modulemap' not found / underlying Objective-C module not found) #267

Open mariusjcb opened 3 years ago

mariusjcb commented 3 years ago

Context:

I need to import multiple versions of a specific framework (Lottie; lottie-ios) in my iOS app. For instance I'm trying to do a workaround by creating a cocoapod library for each version just to expose some wrappers over the dependency framework (Lottie). I tested it in a Example project and it works fine. I am able to run the project and it imports dependency framework (lottie-ios) but also my wrapper library (LOTTIE_3.2.1) correctly.

Problem:

To avoid framework hell I would like to find a way to "embed" each version of lottie-ios framework in my cocoapods wrapper libraries (e.g. my pod LOTTIE_3.2.1 will embed lottie-ios version 3.2.1). For this I tried cocoapods-packager but it refuses to compile. (tried with both Xcode 11.7 and Xcode 12)

ERROR:

<unknown>:0: error: module map file '/var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/build/Release-iphoneos/lottie-ios/Lottie.modulemap' not found
    <unknown>:0: error: module map file '/var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/build/Release-iphoneos/lottie-ios/Lottie.modulemap' not found
    <unknown>:0: error: underlying Objective-C module 'LOTTIE_3_2_1' not found
    /var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/Pods/LOTTIE_3.2.1/LOTTIE_3.2.1/Classes/LottieVersionable.swift:1:8: error: cannot load underlying module for 'Lottie'
    import Lottie
           ^

Environment:

  1. Ruby 2.6.0
  2. Cocoapods-Packager 1.5.0 (master, not the tag/release)
  3. Cocoapods 1.10.1
  4. Xcode 12 & 11.7

    Podspec:

    Pod::Spec.new do |s|
    s.name             = 'LOTTIE_3.2.1'
    s.version          = '0.1.0'
    s.summary          = 'A short description of LOTTIE_3.2.1.'
    
    s.description      = <<-DESC
    TODO: Add long description of the pod here.
                       DESC
    s.swift_version    = '5.2'
    s.homepage         = 'https://google.com'
    s.license          = { :type => 'MIT', :file => 'LICENSE' }
    s.author           = { 'Marius Ilie' => 'mail@mail.com' }
    s.source           = { :git => '~/LOTTIE_3.2.1/.git', :tag => s.version.to_s }
    
    s.swift_version = '5.0'
    s.ios.deployment_target = '9.0'
    s.osx.deployment_target = '10.10'
    s.tvos.deployment_target = '9.0'
    
    s.ios.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
    s.tvos.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
    s.osx.frameworks = ['AppKit', 'CoreGraphics', 'QuartzCore']
    
    s.source_files = 'LOTTIE_3.2.1/Classes/**/*'
    s.dependency 'lottie-ios', '3.2.1'
    
    s.pod_target_xcconfig = {
    'OTHER_SWIFT_FLAGS' => '-DLOTTIE_3',
    }
    end

LottieVersionable.swift Class:

import Lottie

fileprivate protocol LOTAnimationViewVersionable {
    func setAnimationData(_ data: Data)
}

#if LOTTIE_3
public typealias LOTAnimationView = AnimationView
#endif

extension LOTAnimationView: LOTAnimationViewVersionable {
    #if LOTTIE_3
    func setAnimationData(_ data: Data) {
        self.animation = try? JSONDecoder().decode(Animation.self, from: data)
    }
    #elseif LOTTIE_2
    func setAnimationData(_ data: Data) {
        // todo
    }
    #else
    func setAnimationData(_ data: Data) {
        fatalError("WRONG LOTTIE VERSION")
    }
    #endif
}

Command: bundle exec pod package LOTTIE_3.2.1.podspec

Command Output: terminal-output.log

TyrantDante commented 3 years ago

try https://github.com/TyrantDante/cocoapods-framework.git

RMKitty commented 3 years ago

I have the same error . Have you solution to the problem ?