tuist / tuist

Tuist's CLI
https://tuist.dev
MIT License
4.61k stars 559 forks source link

The product AWSCore of package aws-sdk-ios-spm cannot be found. #4303

Closed bvirlet closed 2 years ago

bvirlet commented 2 years ago

Hello,

I posted this as a discussion, but after investigating today it sounds like this could be an actual issue with Tuist, as I have found that the error message was raised by Tuist.

Discussed in https://github.com/tuist/tuist/discussions/4287

Originally posted by **bvirlet** March 26, 2022 Hi folks, I'm getting the following error with `tuist fetch`: ``` The product AWSCore of package aws-sdk-ios-spm cannot be found. ``` My Dependencies.swift contains: ``` import ProjectDescription let dependencies = Dependencies( swiftPackageManager: [ … .remote(url: "https://github.com/aws-amplify/aws-sdk-ios-spm", requirement: .upToNextMajor(from: "2.27.4")), … ], platforms: [.iOS] ) ``` I'm referencing the product as follow in a Target's dependency. ``` .external(name: "AWSCore"), ``` (but it looks like the problem is independent from this reference). I haven't been able to find this error message in the Tuist code, so I'm not sure what tool is raising it. Any idea what this could be caused by? Thank you very much! Bruno

Is Tuist considering the Project.swift files when we do tuist fetch, or exclusively the Dependencies.swift?

bvirlet commented 2 years ago

I'm trying to debug while running Tuist and here is what I get:

One of my dependencies has the following Package.swift

    dependencies: [
…
        .package(url: "https://github.com/aws-amplify/aws-sdk-ios-spm", .upToNextMajor(from: "2.23.3")),
…
    ],
    targets: [
        .target(
            name: "MyTarget",
            dependencies: [
…
                .product(name: "AWSCore", package: "aws-sdk-ios-spm"),
                .product(name: "AWSS3", package: "aws-sdk-ios-spm"),

And it seems that this is what causes the issue: When debugging, tuist packageInfos dictionary (in PackageInfoMapper) has information for a package named AWSiOSSDKv2, but it doesn't have any for aws-sdk-ios-spm.

If I change the Package.swift above to use the package name AWSiOSSDKv2, I'm getting the following error:

error: unknown package 'AWSiOSSDKV2' in dependencies of target 'MyTarget'; valid packages are: 'aws-sdk-ios-spm'
bvirlet commented 2 years ago

The problem is that the package in AWS SDK is incorrectly referenced in the dependencies and this has nothing to do with Tuist.

.package(name: "AWSiOSSDKV2", url: "https://github.com/aws-amplify/aws-sdk-ios-spm", .upToNextMajor(from: "2.23.3")),

Sorry about the noise.