Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Sep 14, 2024 · 3 comments
Closed
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Sep 14, 2024

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:

  • Uninstall the entire package, then reinstall and select only the one I need
  • Remove the other package from Target > Build Phases > Link Binary With Libraries
  • Clean the Build folder
  • Delete the Products folder
  • Delete the DerivedData folder
  • Reset the package caches

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?

@sebaland
Copy link
Member

Hi @occassionally, thanks for reaching out.

Yes, AWSCognitoIdentityProvider is a required dependency of AWSMobileClientXCF.

You can also find the full table of dependencies here

@sebaland sebaland added the question Further information is requested label Sep 18, 2024
@ghost
Copy link
Author

ghost commented Sep 19, 2024

Got it, thank you!

@ghost ghost closed this as completed Sep 19, 2024
Copy link
Contributor

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.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant