AvdLee / appstoreconnect-swift-sdk

The Swift SDK to work with the App Store Connect API from Apple.
Other
1.48k stars 198 forks source link

Use Swift Package Plugin for generating OpenAPI code #191

Closed liamnichols closed 2 years ago

liamnichols commented 2 years ago

šŸ‘‹ I'm currently working on CreateAPI/CreateAPI#48 and have been playing around with different ways to use Swift Package Plugin's to streamline workflows. Given that this project has been on my radar recently, I wanted to explore how we'd go about using plugins to replace your current workflows. The main motivation for all of this was purely for research, but I wanted to raise a PR anyway to see if it would interest you or not.

This approach uses the new artifactbundle format to defined CreateAPI as a binaryTarget dependency which may or may not streamline installing the appropriate version of CreateAPI on your machine. I then define a new CommandPlugin that wraps the invocation to the create-api cli allowing you to instead trigger generating with the following command:

$ swift package --allow-writing-to-package-directory generate-open-api

Things are relatively straightforward overall but the only downside that I came across while testing this is when it comes to supporting Swift 5.5. Since you can't define the plugin in Package.swift when supporting 5.5, I had to bump swift-tools-version to 5.6 and then add Package@swift-5.5.swift instead. This means that you'll have to keep both files around until you were to drop Swift 5.5/Xcode 13.3 support.

Anyway, let me know what you think. I'm happy to to make any adjustments you might like, but I'm also happy to close this if you don't see it being worthwhile at the moment. Thanks!

SwiftLeeBot commented 2 years ago
Warnings
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
Messages
:book: View more details on Bitrise
:book: AppStoreConnect-Swift-SDK-Tests: Executed 9 tests (0 failed, 0 retried, 0 skipped) in 0.155 seconds

SwiftLint found issues

Severity File Reason
Warning Package.swift:27 Line should be 140 characters or less: currently 154 characters (line_length)

Code Coverage Report

Name Coverage

Generated by :no_entry_sign: Danger Swift against 61c9ecef122f070b19a3cbb6f91c2e7df66fecb8

liamnichols commented 2 years ago

Do you need anything from me on this? I didn't notice that it was still open šŸ˜„

AvdLee commented 2 years ago

Do you need anything from me on this? I didn't notice that it was still open šŸ˜„

Nope, once CI finishes I'll merge it in!

SwiftLeeBot commented 2 years ago

Congratulations! :tada: This was released as part of Release 2.3.0 :rocket:

Generated by GitBuddy