From 9ff1a0dc5179d517f4535f807e609654f776ba06 Mon Sep 17 00:00:00 2001 From: Michal Fousek Date: Fri, 22 Sep 2023 15:01:52 +0200 Subject: [PATCH] Swift from swiftgen SPM plugin to build phases scripts Unfortunatelly swiftgen SPM plugin has multiple issues with Xcode 15. For now swiftgen execution must be switched to the build phase scripts. Issues: - https://github.com/SwiftGen/SwiftGenPlugin/issues/14 - https://github.com/SwiftGen/SwiftGenPlugin/issues/15 --- modules/Package.swift | 6 +-- secant.xcodeproj/project.pbxproj | 40 +++++++++++++++++++ .../xcshareddata/swiftpm/Package.resolved | 9 ----- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/modules/Package.swift b/modules/Package.swift index 254b6d6b7..db9ef7a31 100644 --- a/modules/Package.swift +++ b/modules/Package.swift @@ -60,7 +60,6 @@ let package = Package( .package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "0.59.0"), .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "0.14.1"), .package(url: "https://github.com/pointfreeco/swift-url-routing", from: "0.5.0"), - .package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.0"), .package(url: "https://github.com/zcash-hackworks/MnemonicSwift", from: "2.2.4"), .package(url: "https://github.com/zcash/ZcashLightClientKit", from: "2.0.0-rc.1"), .package(url: "https://github.com/firebase/firebase-ios-sdk", from: "10.11.0") @@ -193,10 +192,7 @@ let package = Package( ), .target( name: "Generated", - resources: [.process("Resources")], - plugins: [ - .plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin") - ] + resources: [.process("Resources")] ), .target( name: "Home", diff --git a/secant.xcodeproj/project.pbxproj b/secant.xcodeproj/project.pbxproj index 32272b490..e275646e6 100644 --- a/secant.xcodeproj/project.pbxproj +++ b/secant.xcodeproj/project.pbxproj @@ -612,6 +612,7 @@ buildConfigurationList = 0D26AF91299E8196005260EE /* Build configuration list for PBXNativeTarget "secant-mainnet" */; buildPhases = ( 0D26AE97299E8196005260EE /* Generate GoogleService-Info.plist */, + 34968BEE2ABDC6FA0027F495 /* Swiftgen */, 0D26AE99299E8196005260EE /* SwiftLint */, 0D26AE9A299E8196005260EE /* Sources */, 0D26AF70299E8196005260EE /* Frameworks */, @@ -639,6 +640,7 @@ buildConfigurationList = 0D4E7A2A26B364180058B01E /* Build configuration list for PBXNativeTarget "secant-testnet" */; buildPhases = ( 0D3B01ED298DB0FE007EBCDA /* Generate GoogleService-Info.plist */, + 34968BED2ABDC6310027F495 /* Swiftgen */, 6696BA8726F0B1D200D5C875 /* SwiftLint */, 0D4E7A0126B364170058B01E /* Sources */, 0D4E7A0226B364170058B01E /* Frameworks */, @@ -849,6 +851,44 @@ shellPath = /bin/zsh; shellScript = "# this creates an empty file for the firebase SDK\n\necho \"Creating an empty file for the firebase SDK\"\n\nCRASH_REPORTER_FILE=\"./secant/Resources/GoogleService-Info.plist\"\nif [[ -f $CRASH_REPORTER_FILE ]]; then\n echo \"$CRASH_REPORTER_FILE Exists. Not doing anything.\"\nelse \n echo \"$CRASH_REPORTER_FILE does not exist. Will insert a DUMMY FILE\"\n\n echo \"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VOIiAiaHR0cDovL3d3dy5hcHBsZS5jb20vRFREcy9Qcm9wZXJ0eUxpc3QtMS4wLmR0ZCI+CjxwbGlzdCB2ZXJzaW9uPSIxLjAiPgo8ZGljdD4KICAgIDxrZXk+SVNfRFVNTVlfRklMRTwva2V5PgogICAgPHRydWU+PC90cnVlPgo8L2RpY3Q+CjwvcGxpc3Q+Cg==\" | base64 --decode > $CRASH_REPORTER_FILE\nfi\n"; }; + 34968BED2ABDC6310027F495 /* Swiftgen */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = Swiftgen; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/zsh; + shellScript = "swiftgen_version=\"SwiftGen v6.6.2 (Stencil v0.15.1, StencilSwiftKit v2.10.1, SwiftGenKit v6.6.2)\"\n\nif which swiftgen >/dev/null; then\n if [[ $(swiftgen --version) != $swiftgen_version ]]; then\n echo \"warning: Compatible SwiftGen version not installed, download version $swiftgen_version. Currently installed version is $(swiftgen --version)\"\n fi\n \n echo \"Running swiftgen\" \n swiftgen config run --config modules/swiftgen.yml\nelse\n echo \"warning: swiftgen not installed\"\nfi\n"; + }; + 34968BEE2ABDC6FA0027F495 /* Swiftgen */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = Swiftgen; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/zsh; + shellScript = "swiftgen_version=\"SwiftGen v6.6.2 (Stencil v0.15.1, StencilSwiftKit v2.10.1, SwiftGenKit v6.6.2)\"\n\nif which swiftgen >/dev/null; then\n if [[ $(swiftgen --version) != $swiftgen_version ]]; then\n echo \"warning: Compatible SwiftGen version not installed, download version $swiftgen_version. Currently installed version is $(swiftgen --version)\"\n fi\n \n echo \"Running swiftgen\" \n swiftgen config run --config modules/swiftgen.yml\nelse\n echo \"warning: swiftgen not installed\"\nfi\n"; + }; 6696BA8726F0B1D200D5C875 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4b6057ad6..b3066e68b 100644 --- a/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -297,15 +297,6 @@ "version" : "0.5.0" } }, - { - "identity" : "swiftgenplugin", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SwiftGen/SwiftGenPlugin", - "state" : { - "revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068", - "version" : "6.6.2" - } - }, { "identity" : "swiftui-navigation", "kind" : "remoteSourceControl",