Add Sparkle updates to Oficina Docs on macOS
6 files changed,
+40
−12
native/apple/Package.resolved+17 −8native/apple/Package.swift+7 −2native/apple/Sources/DocsApp/DocsApp.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 c55671a..97226fe 100644 |
| --- a/native/apple/Package.resolved |
| +++ b/native/apple/Package.resolved |
| @@ -1,14 +1,23 @@ |
| { |
| - "originHash" : "282a01a805ab90a6af712b45ea6b83e818878fd0896bf6a3ca7b45243a1afd4f", |
| - "pins" : [ |
| + "originHash": "af87b24f930f4de462069543c80976a38f576581b91d71d7d80bb1ed34ea6d76", |
| + "pins": [ |
| { |
| - "identity" : "native", |
| - "kind" : "remoteSourceControl", |
| - "location" : "https://amadan.net/rastrillo/native", |
| - "state" : { |
| - "revision" : "a49307c29cf36dff2cf423c3f98b38269ce9a553" |
| + "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" : 3 |
| + "version": 3 |
| } |
diff --git a/native/apple/Package.swift b/native/apple/Package.swift| index 679dca9..43df1e0 100644 |
| --- a/native/apple/Package.swift |
| +++ b/native/apple/Package.swift |
| @@ -1,11 +1,16 @@ |
| // swift-tools-version: 6.2 |
| 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: "DocsNative", defaultLocalization: "en", platforms: [.macOS(.v26), .iOS(.v26)], |
| products: [.library(name: "DocsKit", targets: ["DocsKit"]), .executable(name: "DocsMac", targets: ["DocsMac"])], |
| - dependencies: [.package(url: "https://amadan.net/rastrillo/native", revision: "a49307c29cf36dff2cf423c3f98b38269ce9a553")], |
| + dependencies: [sharedNative], |
| targets: [ |
| .binaryTarget(name: "DocsCRDT", path: "Artifacts/DocsCRDT.xcframework"), |
| .target(name: "DocsKit", dependencies: ["DocsCRDT", .product(name: "RastrilloApple", package: "native")], resources: [.process("Resources")]), |
| - .executableTarget(name: "DocsMac", dependencies: ["DocsKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/DocsApp"), |
| + .executableTarget(name: "DocsMac", dependencies: [.product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), "DocsKit", .product(name: "RastrilloApple", package: "native")], path: "Sources/DocsApp"), |
| .testTarget(name: "DocsKitTests", dependencies: ["DocsKit"]), |
| ]) |
diff --git a/native/apple/Sources/DocsApp/DocsApp.swift b/native/apple/Sources/DocsApp/DocsApp.swift| index e4da282..498b22d 100644 |
| --- a/native/apple/Sources/DocsApp/DocsApp.swift |
| +++ b/native/apple/Sources/DocsApp/DocsApp.swift |
| @@ -1,7 +1,13 @@ |
| +#if os(macOS) |
| +import RastrilloMacUpdates |
| +#endif |
| import DocsKit |
| import RastrilloApple |
| import SwiftUI |
| @main struct DocsApp: App { |
| + #if os(macOS) |
| + @State private var updater = NativeUpdater() |
| + #endif |
| #if os(macOS) |
| @NSApplicationDelegateAdaptor(DocsApplicationDelegate.self) private var appDelegate |
| #endif |
| @@ -16,6 +22,7 @@ import SwiftUI |
| } |
| #if os(macOS) |
| .defaultSize(width: 1120, height: 820) |
| + .commands { NativeUpdateCommands(updater: updater) } |
| #endif |
| } |
| } |
diff --git a/native/ios/project.yml b/native/ios/project.yml| index d46d360..1092cfb 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: a49307c29cf36dff2cf423c3f98b38269ce9a553 |
| + revision: 4c61d6283a188c95647e1d0e609e69d29c2e7fa1 |
| settings: |
| base: |
| SWIFT_VERSION: '6.0' |
diff --git a/native/mac-updates.json b/native/mac-updates.json| new file mode 100644 |
| index 0000000..ea18077 |
| --- /dev/null |
| +++ b/native/mac-updates.json |
| @@ -0,0 +1,6 @@ |
| +{ |
| + "bundle_id": "net.amadan.oficina.docs", |
| + "feed_url": "https://raw.amadan.net/oficina/native-releases/main/docs/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 0deb596..5ab8cd4 100755 |
| --- a/native/scripts/build-mac.sh |
| +++ b/native/scripts/build-mac.sh |
| @@ -3,4 +3,5 @@ set -eu |
| cd "$(dirname "$0")/.." |
| if [ "${OFICINA_SKIP_PREPARE:-0}" != 1 ]; then scripts/build-crdt.sh; fi |
| swift package --package-path apple resolve |
| -python3 apple/.build/checkouts/native/tools/bundle-mac.py . Docs |
| +shared_native="${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}" |
| +python3 "$shared_native/tools/bundle-mac.py" . Docs "$@" |