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

Add support for Linux #221

Merged
merged 5 commits into from
Mar 10, 2023
Merged

Add support for Linux #221

merged 5 commits into from
Mar 10, 2023

Conversation

Shakarang
Copy link
Contributor

Hello!

We've added support for Linux in the package to allow anyone to use it on CI. There were two issues to fix:

  • URLSession APIs are not part of Foundation
  • CommonCrypto does not exist on Linux

URLSession

URLSession is part of FoundationNetworking framework on Linux. We've added the import when the framework exists.

CommonCrypto

As CommonCrypto is not available on Linux, we had to use another way to sign the JWT token. We're using Apple made swift-crypto. It removes a lot of manual operations as the signature is available in their framework.

This framework requires macOS 11, so adding it would drop support for macOS 10.15. However, as the latest Xcode only supports macOS 12, this can be acceptable.

API Changes

We've updated the APIConfiguration initialiser to make it throwable when the given key is not valid. This allows to build the private key only once, and throw an error as soon as possible when we know the key is not correct.

@Shakarang Shakarang requested a review from AvdLee as a code owner March 6, 2023 10:52
@Shakarang Shakarang changed the title Add linux support Add support for Linux Mar 6, 2023
@Shakarang Shakarang force-pushed the add-linux-support branch from d8c836f to 8a42780 Compare March 6, 2023 16:46
Copy link
Owner

@AvdLee AvdLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed PR description, that makes reviewing this high quality PR much easier! I love that we can remove the responsibility of JWT handling to Apple's framework.

Since this is a breaking change, I'll release this under a major version bump. 👌

@SwiftLeeBot
Copy link
Collaborator

SwiftLeeBot commented Mar 7, 2023

Warnings
⚠️ 'InAppPurchases' is deprecated: Deprecated
⚠️ 'InAppPurchases' is deprecated: Deprecated
⚠️ 'PricePoints' is deprecated: Deprecated
⚠️ 'PricePoints' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AgeRatingDeclaration' is deprecated: Deprecated
⚠️ 'AgeRatingDeclaration' is deprecated: Deprecated
⚠️ 'AppStoreVersionSubmission' is deprecated: Deprecated
⚠️ 'AppStoreVersionSubmission' is deprecated: Deprecated
⚠️ 'AgeRatingDeclaration' is deprecated: Deprecated
⚠️ 'InAppPurchases' is deprecated: Deprecated
⚠️ 'PricePoints' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AppPricePoint' is deprecated: Deprecated
⚠️ 'AppStoreVersionSubmission' is deprecated: Deprecated
⚠️ 'AppStoreVersionSubmission' is deprecated: Deprecated
Messages
📖 AppStoreConnect-Swift-SDK-Tests: Executed 11 tests (0 failed, 0 retried, 0 skipped) in 0.056 seconds
📖

View more details on Bitrise

Code Coverage Report

Name Coverage

SwiftLint found issues

Severity File Reason
Warning Package.swift:32 Line should be 140 characters or less: currently 154 characters (line_length)
Warning APIConfigurationTests.swift:9 Imports should be sorted. (sorted_imports)
Warning APIConfigurationTests.swift:29 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning APIConfigurationTests.swift:38 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning APIConfigurationTests.swift:18 Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)
Warning DefaultRequestExecutor.swift:35 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning DefaultRequestExecutor.swift:46 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning DefaultRequestExecutor.swift:60 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning DefaultRequestExecutor.swift:79 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning JWTRequestsAuthenticator.swift:24 Line should be 140 characters or less: currently 145 characters (line_length)
Warning JWTRequestsAuthenticator.swift:29 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning JWT.swift:77 Let and var should be separated from other statements by a blank line. (let_var_whitespace)
Warning JWT.swift:42 Line should be 140 characters or less: currently 141 characters (line_length)
Warning JWT.swift:87 Line should be 140 characters or less: currently 143 characters (line_length)
Warning JWT.swift:105 Line should be 140 characters or less: currently 154 characters (line_length)
Warning JWT.swift:9 Imports should be sorted. (sorted_imports)
Warning Endpoint.swift:58 Line should be 140 characters or less: currently 149 characters (line_length)
Warning Endpoint.swift:66 Line should be 140 characters or less: currently 148 characters (line_length)
Warning Endpoint.swift:74 Line should be 140 characters or less: currently 150 characters (line_length)
Warning Endpoint.swift:82 Line should be 140 characters or less: currently 151 characters (line_length)
Warning Endpoint.swift:113 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning Endpoint.swift:128 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning APIProvider.swift:72 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning APIProvider.swift:9 Imports should be sorted. (sorted_imports)
Warning APIProvider.swift:293 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:303 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:319 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:332 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:343 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:353 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:361 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:102 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning JWTRequestsAuthenticatorTests.swift:18 Method 'setUp()' should call to super function (overridden_super_call)
Warning JWTRequestsAuthenticatorTests.swift:10 Imports should be sorted. (sorted_imports)
Warning JWTRequestsAuthenticatorTests.swift:11 Imports should be sorted. (sorted_imports)
Warning APIProviderTests.swift:43 Method 'setUp()' should call to super function (overridden_super_call)
Warning APIProviderTests.swift:9 Imports should be sorted. (sorted_imports)

Generated by 🚫 Danger Swift against 470c618

@Shakarang
Copy link
Contributor Author

Thanks a lot for the quick review 🚀

@AvdLee
Copy link
Owner

AvdLee commented Mar 9, 2023

@Shakarang could you have a look at the tests? 🙏

@Shakarang
Copy link
Contributor Author

All good now, thanks @AvdLee 🥳

@AvdLee AvdLee merged commit d1cbe56 into AvdLee:master Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants