繁体   English   中英

Travis CI 构建 [Cocoapod Swift] 失败,没有“此类模块...”错误

[英]Travis CI build [Cocoapod Swift] fails with no 'such module...' error

我有一个用 Swift 编写的存储库,它是一个标准的 cocoapod 工作区(标准格式,带有使用 Quick 和 Nimble 测试创建的示例应用程序,没有 UI 测试),它在我的本地机器(Xcode 11.2.x)上构建(并运行测试)。 1, macOS Catalina 10.15.1) 顺利,但是 Travis CI 构建失败,错误是其中一个模块不存在:

/Users/travis/build/Kentico/kontent-delivery-sdk-swift/Example/KenticoKontentDelivery/KontentModels/Cafe.swift:9:8: no such module 'ObjectMapper'

完整的 Travis CI 日志在这里

.podspec文件:

Pod::Spec.new do |s|
  s.name             = 'KenticoKontentDelivery'
  s.version          = '2.0.0'
  s.summary          = 'Swift SDK for Kentico Kontent Delivery'

  s.description      = <<-DESC
  Swift SDK for Kentico Kontent Delivery.
                       DESC

  s.homepage         = 'https://github.com/kentico/kontent-delivery-sdk-swift'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'makma' => 'martinmakarsky@gmail.com' }
  s.source           = { :git => 'https://github.com/kentico/kontent-delivery-sdk-swift.git', :tag => s.version.to_s }
  s.social_media_url = 'https://twitter.com/kenticokontent'

  s.ios.deployment_target = '8.0'

  s.source_files = 'KenticoKontentDelivery/Classes/**/*'

  s.dependency 'AlamofireObjectMapper', '~> 5.2.0'
  s.dependency 'ObjectMapper', '~> 3.5.1'
  s.dependency 'Kanna', '~> 4.0.2'
  s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }

end

播客文件

use_frameworks!
platform :ios, '12.0'

target 'KenticoKontentDelivery_Example' do
  pod 'KenticoKontentDelivery', :path => '../'
  pod 'AlamofireImage', '~> 3.6.0'
  pod 'ObjectMapper', '~> 3.5.1'
  pod 'AlamofireObjectMapper', '~> 5.2.0'


  target 'KenticoKontentDelivery_Tests' do
    inherit! :search_paths

    pod 'Quick', '~> 2.2.0'
    pod 'Nimble', '~> 7.0'
    pod 'ObjectMapper', '~> 3.5.1'
    pod 'AlamofireObjectMapper', '~> 5.2.0'
  end
end

.travis.yml

osx_image: xcode11.1
language: objective-c
cache: cocoapods
podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod repo update
- pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/KenticoKontentDelivery.xcworkspace -scheme KenticoKontentDelivery-Example -sdk iphonesimulator -destination 'name=iPhone 8' ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
  provider: script
  script: sh ./scripts/push.sh
  skip_cleanup: true
  on:
    tags: true

我尝试了什么:

  • 更改所有依赖项的版本
  • 更改了 osx_image 版本

我终于调整了设置,以便能够在 Travis CI 上成功运行。 我不确定哪个设置会影响结果,但是,在这些更改之后,构建和测试运行顺利。

  • IPHONEOS_DEPLOYMENT_TARGET降级到版本 11
  • Podfile中设置platform:ios, '11.0'
  • .podspec中设置s.ios.deployment_target = '11.0'
  • 设置s.swift_versions = '5.0'
  • 删除.swift-version文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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