3

I am using Tuist v2 and trying to add external dependencies to my project using Dependencies.swiftfile:

import ProjectDescription

let dependencies = Dependencies(
    carthage: [],
    swiftPackageManager: [
        .package(url: "https://github.com/onevcat/Kingfisher", .upToNextMajor(from: "7.3.2")),
        .package(url: "https://github.com/pointfreeco/swift-composable-architecture", .upToNextMajor(from: "0.40.2")),
        .package(url: "https://github.com/stripe/stripe-ios", .upToNextMajor(from: "22.8.1")),
        .package(url: "https://github.com/segmentio/analytics-ios", .upToNextMajor(from: "4.1.6")),
        .package(url: "https://github.com/OneSignal/OneSignal-XCFramework", .upToNextMajor(from: "3.11.2")),
        .package(url: "https://github.com/AppsFlyerSDK/segment-appsflyer-ios", .upToNextMajor(from: "6.8.1")),
        .package(url: "https://github.com/newrelic/newrelic-ios-agent-spm", .upToNextMajor(from: "7.3.8")),
        .package(url: "https://github.com/iterable/swift-sdk", .upToNextMajor(from: "6.4.7")),
        .package(url: "https://github.com/kishikawakatsumi/KeychainAccess", .upToNextMajor(from: "4.2.2")),
        .package(url: "https://github.com/airbnb/lottie-ios", .upToNextMajor(from: "3.4.3")),
        .package(url: "https://github.com/pusher/pusher-websocket-swift", .upToNextMajor(from: "10.1.1")),
        .package(url: "https://github.com/Juanpe/SkeletonView", .upToNextMajor(from: "1.30.2")),
        .package(url: "https://github.com/persona-id/inquiry-ios-2", .upToNextMajor(from: "2.4.0")),
        .package(url: "https://github.com/gymshark/ios-stack-kit", .upToNextMajor(from: "1.2.0"))
    ],
    platforms: [.iOS]
)

After defining dependencies I am using them like this as described in docs:

extension TargetDependency {
    static let oneSignal = TargetDependency.external(name: "OneSignal-XCFramework")
    static let kingFisher = TargetDependency.external(name: "Kingfisher")
    static let skeletonView = TargetDependency.external(name: "SkeletonView")
    static let pusher = TargetDependency.external(name: "pusher-websocket-swift")
    static let lottie = TargetDependency.external(name: "lottie-ios")
    static let iterable = TargetDependency.external(name: "swift-sdk")
    static let segment = TargetDependency.external(name: "analytics-ios")
    static let appsFlayer = TargetDependency.external(name: "segment-appsflyer-ios")
    static let stripe = TargetDependency.external(name: "stripe-ios")
    static let tca = TargetDependency.external(name: "swift-composable-architecture")
    static let stackKit = TargetDependency.external(name: "ios-stack-kit")
    static let newRelic = TargetDependency.external(name: "newrelic-ios-agent-spm")
    static let keychain = TargetDependency.external(name: "KeychainAccess")
    static let persona = TargetDependency.external(name: "inquiry-ios-2")
}
public static func joinFeature() -> (source: Self, test: Self) {
    frameworkBuilder(
        name: .feature(.joinFeature),
        dependencies: [
            .target(.feature(.alert)),
            .target(.designSystem),
            .target(.scenes),
            .target(.clientService),
            .tca,
            .kingFisher
        ],
        hasResources: true,
        product: .framework,
        folder: folder
    )
}
static func frameworkBuilder(
    name: TargetName,
    headers: ProjectDescription.Headers? = nil,
    dependencies: [TargetDependency] = [],
    settings: ProjectDescription.Settings? = nil,
    hasResources: Bool = false,
    product: Product = .framework,
    folder: String = ""
) -> (source: Target, test: Target) {
    return (
        source: Target(
            name: name.name,
            platform: .iOS,
            product: product,
            bundleId: "\(name.name).framework",
            deploymentTarget: .iOS(targetVersion: "14.0", devices: [.ipad, .iphone]),
            infoPlist: .default,
            sources: ["Targets/\(folder)\(name.name)/Sources/**"],
            resources: hasResources ? ["Targets/\(folder)\(name.name)/Resources/**"] : [],
            headers: headers,
            dependencies: dependencies,
            settings: settings
        ),
        test: Target(
            name: name.name + "Tests",
            platform: .iOS,
            product: .unitTests,
            bundleId: "\(name.name).framework.test",
            infoPlist: .default,
            sources: ["Targets/\(folder)\(name.name)/Tests/**"]
            dependencies: [.target(name: name.name)]
        )
    )
}

I am having two problems with it: First, when I run the fetch command:

tuist dependencies fetch

It fetches all the dependencies but shows this error:

The dependency kind remoteSourceControl is not supported.
Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

After fetching dependencies I am running generate:

tuist generate

This time I am getting this error:

`OneSignal-XCFramework` is not a valid configured external dependency
Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

I have checked the documentation and the GitHub issues but couldn't find anything helpful.

I am using Tuist v2.7.

UPDATE:

I have found the problem: I was using wrong names when defining .external. I have found the correct names from graph.json file.

Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112
  • I am using v3.x, the same problem "using wrong names when defining `.external` and I have found the correct names from graph.json file." – Carlson Yuan Aug 02 '23 at 09:10

0 Answers0