Add Sparkle updates to Oficina Calendar on macOS
6 files changed,
+39
−11
native/apple/Package.resolved+16 −7native/apple/Package.swift+7 −2native/apple/Sources/CalendarApp/CalendarApp.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 bed4afb..d2e6c1e 100644 |
| --- a/native/apple/Package.swift |
| +++ b/native/apple/Package.swift |
| @@ -1,10 +1,15 @@ |
| // 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: "CalendarNative", platforms: [.macOS(.v14), .iOS(.v17)], |
| products: [.library(name: "CalendarKit", targets: ["CalendarKit"]), .executable(name: "CalendarMac", targets: ["CalendarMac"])], |
| - dependencies: [.package(url: "https://amadan.net/rastrillo/native", revision: "33ffe994173438bbb45e88d16061eba2ac4f6d4c")], |
| + dependencies: [sharedNative], |
| targets: [ |
| .testTarget(name: "CalendarKitTests", dependencies: ["CalendarKit"]), |
| .executableTarget(name: "CalendarReview", dependencies: ["CalendarKit", .product(name: "RastrilloApple", package: "native")]), |
| .target(name: "CalendarKit", dependencies: [.product(name: "RastrilloApple", package: "native")]), |
| - .executableTarget(name: "CalendarMac", dependencies: ["CalendarKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/CalendarApp")]) |
| + .executableTarget(name: "CalendarMac", dependencies: [.product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), "CalendarKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/CalendarApp")]) |
diff --git a/native/apple/Sources/CalendarApp/CalendarApp.swift b/native/apple/Sources/CalendarApp/CalendarApp.swift| index 505d6bc..4cdfb36 100644 |
| --- a/native/apple/Sources/CalendarApp/CalendarApp.swift |
| +++ b/native/apple/Sources/CalendarApp/CalendarApp.swift |
| @@ -1,3 +1,6 @@ |
| +#if os(macOS) |
| +import RastrilloMacUpdates |
| +#endif |
| import CalendarKit |
| import RastrilloApple |
| import SwiftUI |
| @@ -6,6 +9,9 @@ import AppKit |
| #endif |
| @main struct CalendarApp: App { |
| + #if os(macOS) |
| + @State private var updater = NativeUpdater() |
| + #endif |
| @StateObject private var connection = NativeConnection(defaultServer: "https://calendar.oficina.works") |
| @AppStorage("calendar.showMenuBar") private var showMenuBar = true |
| @State private var model = CalendarModel() |
| @@ -24,6 +30,7 @@ import AppKit |
| } |
| #if os(macOS) |
| .defaultSize(width: 1080, height: 800) |
| + .commands { NativeUpdateCommands(updater: updater) } |
| #endif |
| #if os(macOS) |
| Settings { CalendarSettingsView() } |
diff --git a/native/ios/project.yml b/native/ios/project.yml| index f052032..f6c1c3f 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..24abb3c |
| --- /dev/null |
| +++ b/native/mac-updates.json |
| @@ -0,0 +1,6 @@ |
| +{ |
| + "bundle_id": "net.amadan.oficina.calendar", |
| + "feed_url": "https://raw.amadan.net/oficina/native-releases/main/calendar/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 39675d6..2a82fc9 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 . Calendar |
| +shared_native="${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}" |
| +python3 "$shared_native/tools/bundle-mac.py" . Calendar "$@" |