Skip to content

Commit

Permalink
Merge pull request #233 from lvalenta/master
Browse files Browse the repository at this point in the history
Fix compilation in Linux environment
  • Loading branch information
AvdLee authored May 24, 2023
2 parents df11b1c + e1bf8fb commit f2c1d8f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
25 changes: 17 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
// swift-tools-version:5.6
import PackageDescription

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/CreateAPI/URLQueryEncoder.git", from: "0.2.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "2.5.0")
]

var targetDependencies: [Target.Dependency] = [
.productItem(name: "URLQueryEncoder", package: "URLQueryEncoder"),
.productItem(name: "Crypto", package: "swift-crypto")
]

#if os(Linux)
dependencies.append(.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.14.0"))
targetDependencies.append(.product(name: "OpenCombine", package: "OpenCombine"))
#endif

let package = Package(
name: "AppStoreConnect-Swift-SDK",
platforms: [
Expand All @@ -11,18 +26,12 @@ let package = Package(
products: [
.library(name: "AppStoreConnect-Swift-SDK", targets: ["AppStoreConnect-Swift-SDK"])
],
dependencies: [
.package(url: "https://github.com/CreateAPI/URLQueryEncoder.git", from: "0.2.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "2.3.0"),
],
dependencies: dependencies,
targets: [
.testTarget(name: "AppStoreConnect-Swift-SDK-Tests", dependencies: ["AppStoreConnect-Swift-SDK"], path: "Tests"),
.target(
name: "AppStoreConnect-Swift-SDK",
dependencies: [
.productItem(name: "URLQueryEncoder", package: "URLQueryEncoder"),
.productItem(name: "Crypto", package: "swift-crypto")
],
dependencies: targetDependencies,
path: "Sources",
exclude: ["OpenAPI/app_store_connect_api_2.3_openapi.json"]
),
Expand Down
5 changes: 4 additions & 1 deletion Sources/APIProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//

import Foundation
#if os(Linux)
import OpenCombine
#else
import Combine
import Crypto
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Expand Down
3 changes: 3 additions & 0 deletions Sources/Extensions/HTTPURLResponseExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//

import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

extension HTTPURLResponse {
var rateLimit: RateLimit? {
Expand Down

0 comments on commit f2c1d8f

Please sign in to comment.