aws-amplify / aws-sdk-ios-spm

This repository enables Swift Package Manager support for the AWS Mobile SDK for iOS
Apache License 2.0
29 stars 15 forks source link

Uninstall single package from grouped packages in Swift Package Manager #130

Closed occassionally closed 1 day ago

occassionally commented 5 days ago

I installed the following packages from the AWS SDK for iOS (https://github.com/aws-amplify/aws-sdk-ios-spm):

AWSCognitoIdentityProvider

AWSMobileClientXCF

I no longer need AWSCognitoIdentityProvider. It was imported into only one file, and then that import was later removed, and I've confirmed that it is not being imported anywhere else.

I can't seem to uninstall only this package. All attempts to do so cause build errors related to AWSMobileClientXCF.

The installation appears in Xcode as a single package called AWSiOSSDKV2, both in the navigator and in the Project > Package Dependencies section, so I can't just remove the one I no longer need.

The only place I can find a mention of AWSCognitoIdentityProvider is in Target > Build Phases > Link Binary With Libraries.

I've tried various combinations of the following steps:

Every time I try to build after performing some or all of these steps, it fails. The exact error depends on which combination of the above steps I attempted.


For example, this is one attempt:

  1. Uninstall the entire package
  2. Delete DerivedData
  3. Clean the build folder
  4. Install the package and select only AWSMobileClientXCF
  5. Clean the build folder
  6. Build - Failure

Errors:

Command SwiftCompile failed with a nonzero exit code

someFileOfMine: Failed to build module 'AWSMobileClientXCF'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK.

arm-64-apple-ios-simulator.private: Could not build Objective-C module 'AWSCognitoIdentityProvider'

AWSCognitoIdentityProvider: 'AWSCore/AWSCore.h' file not found

Immediately after this I did the following:

  1. Close the simulator
  2. Clean the build folder
  3. Build - Failure

Errors this time:

Missing package product 'AWSMobileClientXCF'

someFileOfMine: No such module 'AWSMobileClientXCF'


In AWSiOSSDKV2 > Package.swift, I see this:

extension Target.Dependency {
    // Framework dependencies present in the SDK
    static let awsCore: Self = .target(name: "AWSCore")
    static let awsAuthCore: Self = .target(name: "AWSAuthCore")
    static let awsCognitoIdentityProviderASF: Self = .target(name: "AWSCognitoIdentityProviderASF")
    static let awsCognitoIdentityProvider: Self = .target(name: "AWSCognitoIdentityProvider")
}

Does this mean AWSCognitoIdentityProvider must also be installed? I can't see how that would be the case since I never had installed AWSCore or AWSAuthCore. If this is the case, I can install it again, but I want to be sure so I don't have unused packages installed.


How can I remove this package I no longer need?

ruisebas commented 1 day ago

Hi @occassionally, thanks for reaching out.

Yes, AWSCognitoIdentityProvider is a required dependency of AWSMobileClientXCF.

You can also find the full table of dependencies here

occassionally commented 1 day ago

Got it, thank you!

github-actions[bot] commented 1 day ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.