簡體   English   中英

通過 Xcode 11 中的 Fastlane 構建 SPM Package 不起作用

[英]Build SPM Package via Fastlane in Xcode 11 does not work

我最近將我的 package 管理器從 Cocoapods 更新為 SPM,因為 Xcode 11 已經集成了它。 我所有的庫都已經支持 SPM,所以我試了一下。 It all works fine during Xcode debug building, but I'm currently using Fastlane to automate the deployment and testing process, and my spm package fails during the testing step because my package doesn't support MacOs, but some dependencies do, so it somehow試圖強迫我提供 MacOS 支持。 不幸的是,我目前不能這樣做。

您是否知道我是否錯誤地使用了 spm,或者這是 spm 的錯誤? RxSwift 也支持 MacOs,但 spm 似乎對這個特定的 package 沒有問題,只有 Kingfisher、RxSwiftExt 和 Willow 受到影響。

這是錯誤:

error: the product 'Kingfisher' requires minimum platform version 10.12 for macos platform
error: the product 'RxSwiftExt' requires minimum platform version 10.11 for macos platform
error: the product 'Willow' requires minimum platform version 10.11 for macos platform

這是我來自 fastlane/swift 的測試語句

swift test --build-path ./build --package-path Core --configuration debug

這是我的 Package.swift

// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Core",
    platforms: [
        .iOS(.v11)
    ],
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "Core",
            type: .static,
            targets: ["Core"]),
    ],
    dependencies: [
        // Local Dependencies
        .package(path: "../RxKingfisher"),
        // Remote Dependencies
       .package(url: "https://github.com/Nike-Inc/Willow.git",   Package.Dependency.Requirement.branch("master")),
        .package(url: "https://github.com/ReactiveX/RxSwift", .branch("master")),
        .package(url: "https://github.com/Quick/Nimble", .branch("master")),
        .package(url: "https://github.com/Quick/Quick", .branch("master")),
        .package(url: "https://github.com/realm/realm-cocoa", .branch("master")),
        .package(url: "https://github.com/RxSwiftCommunity/RxRealm", .branch("master")),
        .package(url: "https://github.com/RxSwiftCommunity/Action", .branch("master")),
        .package(url: "https://github.com/RxSwiftCommunity/RxSwiftExt", .branch("master")),
        .package(url: "https://github.com/onevcat/Kingfisher", .branch("master")),
        .package(url: "https://github.com/Swinject/Swinject", .branch("master")),
        .package(url: "https://github.com/RxSwiftCommunity/RxDataSources", .branch("master")),
        // We need to change to the master branch after it was merged
        .package(url: "https://github.com/jrendel/SwiftKeychainWrapper", Package.Dependency.Requirement.revision("8b0da97503be8db3b008581a30fdec71046136a7"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "Core",
            dependencies: [
                // Remote
                "Realm", "RealmSwift", "RxDataSources", "RxRealm", "Kingfisher", "RxSwift", "Action", "SwiftKeychainWrapper", "RxSwiftExt", "Swinject", "Willow",
                // Locals
                "RxKingfisher"
            ]),
        .testTarget(
            name: "CoreTests",
            dependencies: ["Core", "Quick", "Nimble", "RxTest", "RxBlocking"])
    ]
)


不確定swift命令的語法,但是通過xcodebuild設置目標對我有幫助。

xcodebuild -quiet clean test -project YourProject.xcodeproj -scheme YourScheme -destination 'platform=iOS Simulator,name=iPhone 8'

似乎為 Package.swift 中的platforms設置 iOS 您仍然可以將 Mac 作為可用的構建目標,它位於列表的開頭並最終在這種情況下使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM