From: Ruben Beltran del Rio Date: Sat, 14 Sep 2024 16:07:50 +0000 (+0200) Subject: Add sparkle X-Git-Tag: 1.1.0~1 X-Git-Url: https://git.r.bdr.sh/rbdr/captura/commitdiff_plain/578c47516baabf4cdcb3edb54f6e397a47032dd5 Add sparkle --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5905e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +builds diff --git a/Captura.xcodeproj/project.pbxproj b/Captura.xcodeproj/project.pbxproj index 163061e..f87b633 100644 --- a/Captura.xcodeproj/project.pbxproj +++ b/Captura.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ B55403EA2A79A434004BCBAB /* ScriptedPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55403E92A79A434004BCBAB /* ScriptedPreferences.swift */; }; B55403EB2A7A2AD2004BCBAB /* Captura.sdef in Resources */ = {isa = PBXBuildFile; fileRef = B5278B482A781B78009F6462 /* Captura.sdef */; }; B55403ED2A7A388B004BCBAB /* RecordCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55403EC2A7A388B004BCBAB /* RecordCommand.swift */; }; + B55541E52C95801B0015F522 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = B55541E42C95801B0015F522 /* Sparkle */; }; B55DDFCC2A6F0253001A5E76 /* Notification+AppEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55DDFCB2A6F0253001A5E76 /* Notification+AppEvents.swift */; }; B55DDFCE2A6F069D001A5E76 /* RecordingWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55DDFCD2A6F069D001A5E76 /* RecordingWindow.swift */; }; B56C70CD2A6EFDF4009B97EB /* CaptureState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56C70CC2A6EFDF4009B97EB /* CaptureState.swift */; }; @@ -107,6 +108,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + B55541E52C95801B0015F522 /* Sparkle in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -229,6 +231,13 @@ path = Scripting; sourceTree = ""; }; + B55541E32C95801B0015F522 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; B5F915452A6EF80D007ECE8E = { isa = PBXGroup; children = ( @@ -236,6 +245,7 @@ B5F915642A6EF80E007ECE8E /* CapturaTests */, B5F9156E2A6EF80E007ECE8E /* CapturaUITests */, B5F9154F2A6EF80D007ECE8E /* Products */, + B55541E32C95801B0015F522 /* Frameworks */, ); sourceTree = ""; }; @@ -309,6 +319,7 @@ ); name = Captura; packageProductDependencies = ( + B55541E42C95801B0015F522 /* Sparkle */, ); productName = Captura; productReference = B5F9154E2A6EF80D007ECE8E /* Captura.app */; @@ -383,6 +394,7 @@ ); mainGroup = B5F915452A6EF80D007ECE8E; packageReferences = ( + B55541E22C94F86A0015F522 /* XCRemoteSwiftPackageReference "Sparkle" */, ); productRefGroup = B5F9154F2A6EF80D007ECE8E /* Products */; projectDirPath = ""; @@ -617,7 +629,7 @@ CODE_SIGN_ENTITLEMENTS = Captura/Captura.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"Captura/Preview Content\""; DEVELOPMENT_TEAM = S68NHQVJXW; ENABLE_HARDENED_RUNTIME = YES; @@ -632,7 +644,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.0.1; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = pizza.unlimited.Captura; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -648,7 +660,7 @@ CODE_SIGN_ENTITLEMENTS = Captura/Captura.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"Captura/Preview Content\""; DEVELOPMENT_TEAM = S68NHQVJXW; ENABLE_HARDENED_RUNTIME = YES; @@ -663,7 +675,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.0.1; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = pizza.unlimited.Captura; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -784,6 +796,25 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + B55541E22C94F86A0015F522 /* XCRemoteSwiftPackageReference "Sparkle" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/sparkle-project/Sparkle"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.6.4; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + B55541E42C95801B0015F522 /* Sparkle */ = { + isa = XCSwiftPackageProductDependency; + package = B55541E22C94F86A0015F522 /* XCRemoteSwiftPackageReference "Sparkle" */; + productName = Sparkle; + }; +/* End XCSwiftPackageProductDependency section */ + /* Begin XCVersionGroup section */ B5278B3C2A74420F009F6462 /* Captura.xcdatamodeld */ = { isa = XCVersionGroup; diff --git a/Captura.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Captura.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..5ace476 --- /dev/null +++ b/Captura.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "e721da7f9826abdffcb6185e886155efa2514bd6234475f1afa893e29eb258d6", + "pins" : [ + { + "identity" : "sparkle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/sparkle-project/Sparkle", + "state" : { + "revision" : "0ef1ee0220239b3776f433314515fd849025673f", + "version" : "2.6.4" + } + } + ], + "version" : 3 +} diff --git a/Captura.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Captura.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 272be1a..b8404ac 100644 --- a/Captura.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Captura.xcodeproj/xcuserdata/rbdr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -14,8 +14,8 @@ filePath = "Captura/CapturaApp.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "346" - endingLineNumber = "346" + startingLineNumber = "356" + endingLineNumber = "356" landmarkName = "failed(_:)" landmarkType = "7"> @@ -30,40 +30,8 @@ filePath = "Captura/CapturaApp.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "291" - endingLineNumber = "291" - landmarkName = "startRecording()" - landmarkType = "7"> - - - - - - - - diff --git a/Captura/CapturaApp.swift b/Captura/CapturaApp.swift index 14e266c..e49ef6d 100644 --- a/Captura/CapturaApp.swift +++ b/Captura/CapturaApp.swift @@ -2,6 +2,7 @@ import SwiftUI import Cocoa import Combine import AVFoundation +import Sparkle @main struct CapturaApp: App { @@ -38,6 +39,10 @@ struct CapturaApp: App { var remoteFiles: [CapturaRemoteFile] = [] var captureSessionConfiguration: CaptureSessionConfiguration = CaptureSessionConfiguration() + // Sparkle Configuration + @IBOutlet var checkForUpdatesMenuItem: NSMenuItem! + let updaterController: SPUStandardUpdaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil) + @objc dynamic var scriptedPreferences: ScriptedPreferences = ScriptedPreferences() func applicationDidFinishLaunching(_ notification: Notification) { @@ -89,6 +94,11 @@ struct CapturaApp: App { statusItem.menu?.addItem(NSMenuItem.separator()) statusItem.menu?.addItem(NSMenuItem(title: "Open Local Folder", action: #selector(CapturaAppDelegate.onOpenFolder), keyEquivalent: "")) statusItem.menu?.addItem(NSMenuItem.separator()) + + checkForUpdatesMenuItem = NSMenuItem(title: "Check for Updates", action: #selector(SPUStandardUpdaterController.checkForUpdates(_:)), keyEquivalent: "") + checkForUpdatesMenuItem.target = updaterController + statusItem.menu?.addItem(checkForUpdatesMenuItem) + statusItem.menu?.addItem(NSMenuItem(title: "Preferences", action: #selector(CapturaAppDelegate.onOpenPreferences), keyEquivalent: "")) statusItem.menu?.addItem(NSMenuItem(title: "Quit", action: #selector(CapturaAppDelegate.onQuit), keyEquivalent: "")) } diff --git a/Captura/Info.plist b/Captura/Info.plist index 1789155..e997f3d 100644 --- a/Captura/Info.plist +++ b/Captura/Info.plist @@ -2,6 +2,10 @@ + SUFeedURL + https://captura.tranquil.systems/appcast.xml + SUPublicEDKey + lacD9VFVjJO55y+hEy+ReU4S0xbrnbdhncui1qLsmfI= CFBundleURLTypes diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dd8bf56 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +project_name := Captura +derived_data_path := ~/Library/Developer/Xcode/DerivedData +sparkle_path := $(shell find $(derived_data_path) -type d -path '*artifacts/sparkle/Sparkle' -print -quit) +build_directory := builds +sparkle_account := tranquil.systems + + +distribute: archive package generate_appcast + +package: + @scripts/package.sh "$(project_name)" "$(build_directory)" + +generate_appcast: + @$(sparkle_path)/bin/generate_appcast --account $(sparkle_account) $(build_directory) + +archive: prepare + xcodebuild -project $(project_name).xcodeproj -scheme $(project_name) -configuration Release -archivePath $(build_directory)/$(project_name).xcarchive archive && xcodebuild -exportArchive -archivePath $(build_directory)/$(project_name).xcarchive -exportPath $(build_directory) -exportOptionsPlist export_options.plist + +prepare: + mkdir -p $(build_directory) + +.PHONY: package prepare archive generate_appcast package distribute diff --git a/README.md b/README.md index 9230a9d..f2e8cfc 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,14 @@ where the file is available. The status code *MUST* be 201 Created. Any response code other than 201 Created will be treated as an error. Captura will not re-attempt an upload. + +## Building + +For development, build the app using xcode. For release, a makefile is provided +with commands to archive and package. If you just want the built and signed app +you can use `make archive`. To generate the whole package use `make distribute` + +### Signing + +There's no automated handling of signing. For the app to be signed correctly, +update the signing configuration in the xcode project. diff --git a/export_options.plist b/export_options.plist new file mode 100644 index 0000000..bb805c5 --- /dev/null +++ b/export_options.plist @@ -0,0 +1,10 @@ + + + + + method + developer-id + signingStyle + automatic + + diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 0000000..477693a --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e + + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +project_name="$1" +build_directory="$2" + +app_path="${build_directory}/${project_name}.app" +app_version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ${app_path}/Contents/Info.plist) +tmp_dir=$(mktemp -d) +dmg_path="${build_directory}/${project_name}-${app_version}.dmg" +cp -R "${app_path}" "${tmp_dir}" +ln -s /Applications "${tmp_dir}/Applications" +hdiutil create -volname "${project_name}" -srcfolder "${tmp_dir}" -ov -format UDZO "${dmg_path}" +rm -rf "${tmp_dir}"