Add Sparkle updates to Oficina Memoria on macOS
6 files changed,
+39
−11
native/apple/Package.resolved+16 −7native/apple/Package.swift+7 −2native/apple/Sources/MemoriaApp/MemoriaApp.swift+7 −0native/ios/project.yml+1 −1native/mac-updates.json+6 −0native/scripts/build-mac.sh+2 −1
diff --git a/native/apple/Package.resolved b/native/apple/Package.resolved| index 3e5101a..710f96c 100644 |
| --- a/native/apple/Package.resolved |
| +++ b/native/apple/Package.resolved |
| @@ -1,13 +1,22 @@ |
| { |
| - "pins" : [ |
| + "pins": [ |
| { |
| - "identity" : "native", |
| - "kind" : "remoteSourceControl", |
| - "location" : "https://amadan.net/rastrillo/native", |
| - "state" : { |
| - "revision" : "33ffe994173438bbb45e88d16061eba2ac4f6d4c" |
| + "identity": "native", |
| + "kind": "remoteSourceControl", |
| + "location": "https://amadan.net/rastrillo/native", |
| + "state": { |
| + "revision": "4c61d6283a188c95647e1d0e609e69d29c2e7fa1" |
| + } |
| + }, |
| + { |
| + "identity": "sparkle", |
| + "kind": "remoteSourceControl", |
| + "location": "https://github.com/sparkle-project/Sparkle", |
| + "state": { |
| + "revision": "ac2def288cbff5cfc7df3ffef6abdf45b72bcb0a", |
| + "version": "2.9.6" |
| } |
| } |
| ], |
| - "version" : 2 |
| + "version": 2 |
| } |
diff --git a/native/apple/Package.swift b/native/apple/Package.swift| index f8788a6..e243e19 100644 |
| --- a/native/apple/Package.swift |
| +++ b/native/apple/Package.swift |
| @@ -1,9 +1,14 @@ |
| // swift-tools-version: 5.9 |
| import PackageDescription |
| +import Foundation |
| + |
| +let sharedNative: Package.Dependency = ProcessInfo.processInfo.environment["OFICINA_NATIVE_PACKAGE_PATH"].map { .package(path: $0) } |
| + ?? .package(url: "https://amadan.net/rastrillo/native", revision: "4c61d6283a188c95647e1d0e609e69d29c2e7fa1") |
| + |
| let package = Package(name: "MemoriaNative", platforms: [.macOS(.v14), .iOS(.v17)], |
| products: [.library(name: "MemoriaKit", targets: ["MemoriaKit"]), .executable(name: "MemoriaMac", targets: ["MemoriaMac"])], |
| - dependencies: [.package(url: "https://amadan.net/rastrillo/native", revision: "33ffe994173438bbb45e88d16061eba2ac4f6d4c")], |
| + dependencies: [sharedNative], |
| targets: [ |
| .executableTarget(name: "MemoriaReview", dependencies: ["MemoriaKit", .product(name: "RastrilloApple", package: "native")]), |
| .target(name: "MemoriaKit", dependencies: [.product(name: "RastrilloApple", package: "native")]), |
| - .executableTarget(name: "MemoriaMac", dependencies: ["MemoriaKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/MemoriaApp")]) |
| + .executableTarget(name: "MemoriaMac", dependencies: [.product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), "MemoriaKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/MemoriaApp")]) |
diff --git a/native/apple/Sources/MemoriaApp/MemoriaApp.swift b/native/apple/Sources/MemoriaApp/MemoriaApp.swift| index 0994fb3..52bf5bd 100644 |
| --- a/native/apple/Sources/MemoriaApp/MemoriaApp.swift |
| +++ b/native/apple/Sources/MemoriaApp/MemoriaApp.swift |
| @@ -1,8 +1,14 @@ |
| +#if os(macOS) |
| +import RastrilloMacUpdates |
| +#endif |
| import MemoriaKit |
| import RastrilloApple |
| import SwiftUI |
| @main struct MemoriaApp: App { |
| + #if os(macOS) |
| + @State private var updater = NativeUpdater() |
| + #endif |
| @StateObject private var connection = NativeConnection(defaultServer: "https://memoria.oficina.works") |
| var body: some Scene { |
| WindowGroup { |
| @@ -16,6 +22,7 @@ import SwiftUI |
| } |
| #if os(macOS) |
| .defaultSize(width: 1120, height: 780) |
| + .commands { NativeUpdateCommands(updater: updater) } |
| #endif |
| } |
| } |
diff --git a/native/ios/project.yml b/native/ios/project.yml| index 8f1b26b..53f67c7 100644 |
| --- a/native/ios/project.yml |
| +++ b/native/ios/project.yml |
| @@ -8,7 +8,7 @@ packages: |
| path: ../apple |
| RastrilloNative: |
| url: https://amadan.net/rastrillo/native |
| - revision: 33ffe994173438bbb45e88d16061eba2ac4f6d4c |
| + revision: 4c61d6283a188c95647e1d0e609e69d29c2e7fa1 |
| settings: |
| base: |
| SWIFT_VERSION: '5.0' |
diff --git a/native/mac-updates.json b/native/mac-updates.json| new file mode 100644 |
| index 0000000..05d48c8 |
| --- /dev/null |
| +++ b/native/mac-updates.json |
| @@ -0,0 +1,6 @@ |
| +{ |
| + "bundle_id": "net.amadan.oficina.memoria", |
| + "feed_url": "https://raw.amadan.net/oficina/native-releases/main/memoria/appcast.xml", |
| + "public_ed_key": "/FxO7cZnM7P5c9ZrUPUJvpCnR65sNmrzte+I5vHarE8=", |
| + "keychain_account": "oficina" |
| +} |
diff --git a/native/scripts/build-mac.sh b/native/scripts/build-mac.sh| index 0234df3..8cc6b26 100755 |
| --- a/native/scripts/build-mac.sh |
| +++ b/native/scripts/build-mac.sh |
| @@ -2,4 +2,5 @@ |
| set -eu |
| cd "$(dirname "$0")/.." |
| swift package --package-path apple resolve |
| -python3 apple/.build/checkouts/native/tools/bundle-mac.py . Memoria |
| +shared_native="${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}" |
| +python3 "$shared_native/tools/bundle-mac.py" . Memoria "$@" |