From 38ff6bc0f288f2a5ce5b5765828a09abac495ba8 Mon Sep 17 00:00:00 2001 From: Petr Chmelar Date: Thu, 13 Oct 2022 19:40:23 +0100 Subject: [PATCH 1/3] Fix schemaName in Apollo config --- .../Toolkits/RocketToolkit/apollo-codegen-config.json | 5 ++++- ios/scripts/apollo.sh | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json b/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json index 8ed8d867..7f5debeb 100644 --- a/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json +++ b/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json @@ -1,5 +1,5 @@ { - "schemaName": "rocket", + "schemaName": "Rocket", "schemaDownloadConfiguration": { "downloadMethod": { "introspection": { @@ -40,5 +40,8 @@ "path": "./Sources/RocketToolkitMocks" } } + }, + "options": { + "pruneGeneratedFiles": false } } diff --git a/ios/scripts/apollo.sh b/ios/scripts/apollo.sh index c099830d..f67937d9 100755 --- a/ios/scripts/apollo.sh +++ b/ios/scripts/apollo.sh @@ -6,5 +6,4 @@ cd "$(dirname "$0")" cd ../DataLayer/Toolkits/RocketToolkit swift package --disable-sandbox --allow-writing-to-package-directory apollo-fetch-schema swift package --disable-sandbox --allow-writing-to-package-directory apollo-generate -find ./Sources/RocketToolkitMocks -type f -exec sed -i '' -e "s/rocket/Rocket/g" {} + cd ../../.. From 031891c51f198bcc0ac51a71b3e3240c105e6276 Mon Sep 17 00:00:00 2001 From: Petr Chmelar Date: Sat, 15 Oct 2022 00:47:38 +0100 Subject: [PATCH 2/3] Proper paths in SPM Packages --- ios/DataLayer/Toolkits/AnalyticsToolkit/Package.swift | 6 +++--- ios/DataLayer/Toolkits/AuthToolkit/Package.swift | 10 +++++----- ios/DataLayer/Toolkits/LocationToolkit/Package.swift | 4 ++-- .../Toolkits/PushNotificationsToolkit/Package.swift | 6 +++--- .../Toolkits/RemoteConfigToolkit/Package.swift | 4 ++-- ios/DataLayer/Toolkits/UserToolkit/Package.swift | 8 ++++---- ios/PresentationLayer/Onboarding/Package.swift | 6 +++--- ios/PresentationLayer/Profile/Package.swift | 6 +++--- ios/PresentationLayer/Recipes/Package.swift | 6 +++--- ios/PresentationLayer/UIToolkit/Package.swift | 2 +- ios/PresentationLayer/Users/Package.swift | 6 +++--- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/ios/DataLayer/Toolkits/AnalyticsToolkit/Package.swift b/ios/DataLayer/Toolkits/AnalyticsToolkit/Package.swift index 1299c932..241668a3 100644 --- a/ios/DataLayer/Toolkits/AnalyticsToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/AnalyticsToolkit/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "Utilities", path: "../../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "AnalyticsProvider", path: "../Providers/AnalyticsProvider") + .package(name: "Utilities", path: "../../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "AnalyticsProvider", path: "../../Providers/AnalyticsProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/DataLayer/Toolkits/AuthToolkit/Package.swift b/ios/DataLayer/Toolkits/AuthToolkit/Package.swift index a0df212f..d95c8c6a 100644 --- a/ios/DataLayer/Toolkits/AuthToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/AuthToolkit/Package.swift @@ -16,11 +16,11 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "Utilities", path: "../../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "DatabaseProvider", path: "../Providers/DatabaseProvider"), - .package(name: "KeychainProvider", path: "../Providers/KeychainProvider"), - .package(name: "NetworkProvider", path: "../Providers/NetworkProvider") + .package(name: "Utilities", path: "../../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "DatabaseProvider", path: "../../Providers/DatabaseProvider"), + .package(name: "KeychainProvider", path: "../../Providers/KeychainProvider"), + .package(name: "NetworkProvider", path: "../../Providers/NetworkProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/DataLayer/Toolkits/LocationToolkit/Package.swift b/ios/DataLayer/Toolkits/LocationToolkit/Package.swift index 51090e10..98844d01 100644 --- a/ios/DataLayer/Toolkits/LocationToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/LocationToolkit/Package.swift @@ -16,8 +16,8 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "LocationProvider", path: "../Providers/LocationProvider") + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "LocationProvider", path: "../../Providers/LocationProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/DataLayer/Toolkits/PushNotificationsToolkit/Package.swift b/ios/DataLayer/Toolkits/PushNotificationsToolkit/Package.swift index a68fd135..544b0c76 100644 --- a/ios/DataLayer/Toolkits/PushNotificationsToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/PushNotificationsToolkit/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "Utilities", path: "../../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "PushNotificationsProvider", path: "../Providers/PushNotificationsProvider") + .package(name: "Utilities", path: "../../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "PushNotificationsProvider", path: "../../Providers/PushNotificationsProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/DataLayer/Toolkits/RemoteConfigToolkit/Package.swift b/ios/DataLayer/Toolkits/RemoteConfigToolkit/Package.swift index 88653b6b..fe721c30 100644 --- a/ios/DataLayer/Toolkits/RemoteConfigToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/RemoteConfigToolkit/Package.swift @@ -16,8 +16,8 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "RemoteConfigProvider", path: "../Providers/RemoteConfigProvider") + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "RemoteConfigProvider", path: "../../Providers/RemoteConfigProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/DataLayer/Toolkits/UserToolkit/Package.swift b/ios/DataLayer/Toolkits/UserToolkit/Package.swift index 7ddb7af5..b32e0524 100644 --- a/ios/DataLayer/Toolkits/UserToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/UserToolkit/Package.swift @@ -16,10 +16,10 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "Utilities", path: "../../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), - .package(name: "DatabaseProvider", path: "../Providers/DatabaseProvider"), - .package(name: "NetworkProvider", path: "../Providers/NetworkProvider") + .package(name: "Utilities", path: "../../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../../DomainLayer/SharedDomain"), + .package(name: "DatabaseProvider", path: "../../Providers/DatabaseProvider"), + .package(name: "NetworkProvider", path: "../../Providers/NetworkProvider") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/PresentationLayer/Onboarding/Package.swift b/ios/PresentationLayer/Onboarding/Package.swift index 75fd2c41..2a61701b 100644 --- a/ios/PresentationLayer/Onboarding/Package.swift +++ b/ios/PresentationLayer/Onboarding/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "UIToolkit", path: "./UIToolkit"), - .package(name: "Utilities", path: "../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../DomainLayer/SharedDomain"), + .package(name: "UIToolkit", path: "../UIToolkit"), + .package(name: "Utilities", path: "../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), .package(url: "https://github.com/hmlongco/Resolver.git", .upToNextMajor(from: "1.0.0")) ], targets: [ diff --git a/ios/PresentationLayer/Profile/Package.swift b/ios/PresentationLayer/Profile/Package.swift index 47cddcb4..91ff38d2 100644 --- a/ios/PresentationLayer/Profile/Package.swift +++ b/ios/PresentationLayer/Profile/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "UIToolkit", path: "./UIToolkit"), - .package(name: "Utilities", path: "../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../DomainLayer/SharedDomain"), + .package(name: "UIToolkit", path: "../UIToolkit"), + .package(name: "Utilities", path: "../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), .package(url: "https://github.com/hmlongco/Resolver.git", .upToNextMajor(from: "1.0.0")) ], targets: [ diff --git a/ios/PresentationLayer/Recipes/Package.swift b/ios/PresentationLayer/Recipes/Package.swift index e0784ce1..6e1e65c5 100644 --- a/ios/PresentationLayer/Recipes/Package.swift +++ b/ios/PresentationLayer/Recipes/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "UIToolkit", path: "./UIToolkit"), - .package(name: "Utilities", path: "../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../DomainLayer/SharedDomain"), + .package(name: "UIToolkit", path: "../UIToolkit"), + .package(name: "Utilities", path: "../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), .package(url: "https://github.com/hmlongco/Resolver.git", .upToNextMajor(from: "1.0.0")) ], targets: [ diff --git a/ios/PresentationLayer/UIToolkit/Package.swift b/ios/PresentationLayer/UIToolkit/Package.swift index a233e3bf..d25a3f90 100644 --- a/ios/PresentationLayer/UIToolkit/Package.swift +++ b/ios/PresentationLayer/UIToolkit/Package.swift @@ -17,7 +17,7 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "Utilities", path: "../DomainLayer/Utilities") + .package(name: "Utilities", path: "../../DomainLayer/Utilities") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/ios/PresentationLayer/Users/Package.swift b/ios/PresentationLayer/Users/Package.swift index 791747cc..9d071bf3 100644 --- a/ios/PresentationLayer/Users/Package.swift +++ b/ios/PresentationLayer/Users/Package.swift @@ -16,9 +16,9 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "UIToolkit", path: "./UIToolkit"), - .package(name: "Utilities", path: "../DomainLayer/Utilities"), - .package(name: "SharedDomain", path: "../DomainLayer/SharedDomain"), + .package(name: "UIToolkit", path: "../UIToolkit"), + .package(name: "Utilities", path: "../../DomainLayer/Utilities"), + .package(name: "SharedDomain", path: "../../DomainLayer/SharedDomain"), .package(url: "https://github.com/hmlongco/Resolver.git", .upToNextMajor(from: "1.0.0")) ], targets: [ From a9da305f6469cba7abe7322ef6eaf0451406191b Mon Sep 17 00:00:00 2001 From: Petr Chmelar Date: Sat, 15 Oct 2022 00:54:06 +0100 Subject: [PATCH 3/3] Switch Apollo from RocketToolkit back to GraphQLProvider --- ios/.swiftlint.yml | 2 +- .../GraphQLProvider/Package.resolved | 50 +++++++++++++++++++ .../Toolkits/RocketToolkit/Package.swift | 5 +- .../Sources/RocketToolkitMocks/.gitkeep | 0 .../RocketToolkit/apollo-codegen-config.json | 2 +- ios/DomainLayer/SharedDomain/Package.swift | 5 +- ios/scripts/apollo.sh | 9 ++-- 7 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 ios/DataLayer/Providers/GraphQLProvider/Package.resolved create mode 100644 ios/DataLayer/Toolkits/RocketToolkit/Sources/RocketToolkitMocks/.gitkeep diff --git a/ios/.swiftlint.yml b/ios/.swiftlint.yml index fa8f3fbc..27f1d071 100644 --- a/ios/.swiftlint.yml +++ b/ios/.swiftlint.yml @@ -2,7 +2,7 @@ excluded: - Carthage - Pods - vendor - - DataLayer/Toolkits/RocketToolkit/.build + - DataLayer/Providers/GraphQLProvider/.build - DataLayer/Toolkits/RocketToolkit/Sources/RocketToolkit/NetworkModels/Apollo - DataLayer/Toolkits/RocketToolkit/Sources/RocketToolkitMocks diff --git a/ios/DataLayer/Providers/GraphQLProvider/Package.resolved b/ios/DataLayer/Providers/GraphQLProvider/Package.resolved new file mode 100644 index 00000000..3c50a59a --- /dev/null +++ b/ios/DataLayer/Providers/GraphQLProvider/Package.resolved @@ -0,0 +1,50 @@ +{ + "pins" : [ + { + "identity" : "apollo-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apollographql/apollo-ios", + "state" : { + "revision" : "29d42fb5b17a2c1823ec0750af8e628067e43b4c", + "version" : "1.0.1" + } + }, + { + "identity" : "inflectorkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattt/InflectorKit", + "state" : { + "revision" : "d8cbcc04972690aaa5fc760a2b9ddb3e9f0decd7", + "version" : "1.0.0" + } + }, + { + "identity" : "sqlite.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stephencelis/SQLite.swift.git", + "state" : { + "revision" : "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54", + "version" : "0.13.3" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1", + "version" : "1.1.4" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections", + "state" : { + "revision" : "f504716c27d2e5d4144fa4794b12129301d17729", + "version" : "1.0.3" + } + } + ], + "version" : 2 +} diff --git a/ios/DataLayer/Toolkits/RocketToolkit/Package.swift b/ios/DataLayer/Toolkits/RocketToolkit/Package.swift index 607f4807..931a45fd 100644 --- a/ios/DataLayer/Toolkits/RocketToolkit/Package.swift +++ b/ios/DataLayer/Toolkits/RocketToolkit/Package.swift @@ -5,10 +5,7 @@ import PackageDescription let package = Package( name: "RocketToolkit", - platforms: [ - .iOS(.v14), - .macOS(.v10_14) - ], + platforms: [.iOS(.v14)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/ios/DataLayer/Toolkits/RocketToolkit/Sources/RocketToolkitMocks/.gitkeep b/ios/DataLayer/Toolkits/RocketToolkit/Sources/RocketToolkitMocks/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json b/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json index 7f5debeb..d92272ed 100644 --- a/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json +++ b/ios/DataLayer/Toolkits/RocketToolkit/apollo-codegen-config.json @@ -13,7 +13,7 @@ }, "downloadTimeout": 60, "headers": [], - "outputPath": "./schema.graphqls" + "outputPath": "../../Toolkits/RocketToolkit/schema.graphqls" }, "input": { "operationSearchPaths": [ diff --git a/ios/DomainLayer/SharedDomain/Package.swift b/ios/DomainLayer/SharedDomain/Package.swift index 1e826eab..0296e5df 100644 --- a/ios/DomainLayer/SharedDomain/Package.swift +++ b/ios/DomainLayer/SharedDomain/Package.swift @@ -5,10 +5,7 @@ import PackageDescription let package = Package( name: "SharedDomain", - platforms: [ - .iOS(.v14), - .macOS(.v10_14) - ], + platforms: [.iOS(.v14)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/ios/scripts/apollo.sh b/ios/scripts/apollo.sh index f67937d9..1cb18085 100755 --- a/ios/scripts/apollo.sh +++ b/ios/scripts/apollo.sh @@ -1,9 +1,8 @@ #!/bin/bash cd "$(dirname "$0")" +cd ../DataLayer/Providers/GraphQLProvider -# RocketToolkit -cd ../DataLayer/Toolkits/RocketToolkit -swift package --disable-sandbox --allow-writing-to-package-directory apollo-fetch-schema -swift package --disable-sandbox --allow-writing-to-package-directory apollo-generate -cd ../../.. +echo "⚙️ RocketToolkit - Downloading GraphQL schema and generating code from queries" +swift package --disable-sandbox --allow-writing-to-package-directory apollo-fetch-schema --path "../../Toolkits/RocketToolkit/apollo-codegen-config.json" +swift package --disable-sandbox --allow-writing-to-package-directory apollo-generate --path "../../Toolkits/RocketToolkit/apollo-codegen-config.json"