From: Ruben Beltran del Rio Date: Mon, 16 Sep 2024 10:10:02 +0000 (+0200) Subject: 3.0.0 X-Git-Tag: 3.0.0 X-Git-Url: https://git.r.bdr.sh/rbdr/map/commitdiff_plain/4e7e11cfd56adfa14a557c76e192ff3148cd2842?ds=sidebyside 3.0.0 --- diff --git a/.gitignore b/.gitignore index 996111e..7c955e3 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ DerivedData/ ## Gcc Patch /*.gcno .DS_Store +builds/ diff --git a/Makefile b/Makefile index c02a227..8d1a3b1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,22 @@ -swift_version = 5.3 +project_name := Map +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) format: swift format -i -r . @@ -6,4 +24,4 @@ format: lint: swift format lint -r . -.PHONY: format lint docker-build docker-push +.PHONY: package prepare archive generate_appcast package distribute format lint diff --git a/Map.xcodeproj/project.pbxproj b/Map.xcodeproj/project.pbxproj index 15ddee9..f138746 100644 --- a/Map.xcodeproj/project.pbxproj +++ b/Map.xcodeproj/project.pbxproj @@ -38,6 +38,8 @@ B5012E8A2C98235500AC4D68 /* MapCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E892C98235300AC4D68 /* MapCommands.swift */; }; B5012E8C2C98244000AC4D68 /* ViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E8B2C98243E00AC4D68 /* ViewStyle.swift */; }; B5012E8E2C9828D000AC4D68 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E8D2C9828CE00AC4D68 /* Constants.swift */; }; + B51A45F52C982FAE00870ED5 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = B51A45F42C982FAE00870ED5 /* Sparkle */; }; + B51A45F72C982FEA00870ED5 /* UpdateCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51A45F62C982FE700870ED5 /* UpdateCommands.swift */; }; B54587102C961E9C0067B788 /* MapApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B545870F2C961E9C0067B788 /* MapApp.swift */; }; B54587122C961E9C0067B788 /* MapDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54587112C961E9C0067B788 /* MapDocument.swift */; }; B54587142C961E9C0067B788 /* MapEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54587132C961E9C0067B788 /* MapEditor.swift */; }; @@ -95,6 +97,7 @@ B5012E892C98235300AC4D68 /* MapCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapCommands.swift; sourceTree = ""; }; B5012E8B2C98243E00AC4D68 /* ViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewStyle.swift; sourceTree = ""; }; B5012E8D2C9828CE00AC4D68 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; + B51A45F62C982FE700870ED5 /* UpdateCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateCommands.swift; sourceTree = ""; }; B545870C2C961E9C0067B788 /* Map.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Map.app; sourceTree = BUILT_PRODUCTS_DIR; }; B545870F2C961E9C0067B788 /* MapApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapApp.swift; sourceTree = ""; }; B54587112C961E9C0067B788 /* MapDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapDocument.swift; sourceTree = ""; }; @@ -115,6 +118,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + B51A45F52C982FAE00870ED5 /* Sparkle in Frameworks */, B5012E742C9625E200AC4D68 /* Patterns in Frameworks */, B5012E7F2C97315800AC4D68 /* ConcaveHull in Frameworks */, ); @@ -248,6 +252,7 @@ B5012E882C98234F00AC4D68 /* Commands */ = { isa = PBXGroup; children = ( + B51A45F62C982FE700870ED5 /* UpdateCommands.swift */, B5012E892C98235300AC4D68 /* MapCommands.swift */, ); path = Commands; @@ -332,6 +337,7 @@ packageProductDependencies = ( B5012E732C9625E200AC4D68 /* Patterns */, B5012E7E2C97315800AC4D68 /* ConcaveHull */, + B51A45F42C982FAE00870ED5 /* Sparkle */, ); productName = Map2; productReference = B545870C2C961E9C0067B788 /* Map.app */; @@ -408,6 +414,7 @@ packageReferences = ( B5012E722C9625E200AC4D68 /* XCRemoteSwiftPackageReference "patterns" */, B5012E7D2C97315800AC4D68 /* XCRemoteSwiftPackageReference "ConcaveHull" */, + B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */, ); productRefGroup = B545870D2C961E9C0067B788 /* Products */; projectDirPath = ""; @@ -472,6 +479,7 @@ B54587142C961E9C0067B788 /* MapEditor.swift in Sources */, B5012E3F2C96232A00AC4D68 /* EvolutionPicker.swift in Sources */, B5012E572C96249400AC4D68 /* NoteParserStrategy.swift in Sources */, + B51A45F72C982FEA00870ED5 /* UpdateCommands.swift in Sources */, B5012E582C96249400AC4D68 /* BlockerParserStrategy.swift in Sources */, B5012E592C96249400AC4D68 /* VertexParserStrategy.swift in Sources */, B5012E5A2C96249400AC4D68 /* MapParser.swift in Sources */, @@ -823,6 +831,14 @@ kind = branch; }; }; + B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/sparkle-project/Sparkle"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.6.4; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -836,6 +852,11 @@ package = B5012E7D2C97315800AC4D68 /* XCRemoteSwiftPackageReference "ConcaveHull" */; productName = ConcaveHull; }; + B51A45F42C982FAE00870ED5 /* Sparkle */ = { + isa = XCSwiftPackageProductDependency; + package = B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */; + productName = Sparkle; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = B54587042C961E9C0067B788 /* Project object */; diff --git a/Map.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Map.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 887d9ee..8e294b8 100644 --- a/Map.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Map.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "02d7b701c0ab6f32b55ad490056b5cb87cdec5003f477a828ca9a07b09a2d7b3", + "originHash" : "761de39b705b9793661607e3e8ffa75397e9772bccc8dc4c303ed42c76e874de", "pins" : [ { "identity" : "concavehull", @@ -18,6 +18,15 @@ "revision" : "ba4ee0edf2aba19ad73fa53cb01dd0fb9b527526", "version" : "2.0.0" } + }, + { + "identity" : "sparkle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/sparkle-project/Sparkle", + "state" : { + "revision" : "0ef1ee0220239b3776f433314515fd849025673f", + "version" : "2.6.4" + } } ], "version" : 3 diff --git a/Map/Info.plist b/Map/Info.plist index 61150cf..e862423 100644 --- a/Map/Info.plist +++ b/Map/Info.plist @@ -2,6 +2,12 @@ + SUEnableInstallerLauncherService + + SUPublicEDKey + lacD9VFVjJO55y+hEy+ReU4S0xbrnbdhncui1qLsmfI= + SUFeedURL + https://map.tranquil.systems/appcast.xml CFBundleDocumentTypes @@ -25,7 +31,7 @@ public.plain-text UTTypeDescription - Wardley Map written in Map's wmap syntax + Wardley Map written in Map's wmap syntax UTTypeIcons UTTypeIdentifier diff --git a/Map/Map.entitlements b/Map/Map.entitlements index 6d968ed..d363e1c 100644 --- a/Map/Map.entitlements +++ b/Map/Map.entitlements @@ -2,9 +2,16 @@ - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-write - + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.temporary-exception.mach-lookup.global-name + + $(PRODUCT_BUNDLE_IDENTIFIER)-spks + $(PRODUCT_BUNDLE_IDENTIFIER)-spki + diff --git a/Map/MapApp.swift b/Map/MapApp.swift index 9aff010..ef1b119 100644 --- a/Map/MapApp.swift +++ b/Map/MapApp.swift @@ -1,12 +1,17 @@ import SwiftUI +import Sparkle @main struct MapApp: App { + + private let updaterController: SPUStandardUpdaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil) + var body: some Scene { DocumentGroup(newDocument: MapDocument()) { file in MapEditor(document: file.$document, url: file.fileURL) }.commands { MapCommands() + UpdateCommands(updaterController: updaterController) } } } diff --git a/Map/Presentation/Commands/UpdateCommands.swift b/Map/Presentation/Commands/UpdateCommands.swift new file mode 100644 index 0000000..44a4610 --- /dev/null +++ b/Map/Presentation/Commands/UpdateCommands.swift @@ -0,0 +1,39 @@ +import SwiftUI +import Sparkle + +struct UpdateCommands: Commands { + let updaterController: SPUStandardUpdaterController + + var body: some Commands { + CommandGroup(after: .appInfo) { + CheckForUpdatesView(updater: updaterController.updater) + } + } +} + + +struct CheckForUpdatesView: View { + @ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel + private let updater: SPUUpdater + + init(updater: SPUUpdater) { + self.updater = updater + + // Create our view model for our CheckForUpdatesView + self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater) + } + + var body: some View { + Button("Check for Updates…", action: updater.checkForUpdates) + .disabled(!checkForUpdatesViewModel.canCheckForUpdates) + } +} + +final class CheckForUpdatesViewModel: ObservableObject { + @Published var canCheckForUpdates = false + + init(updater: SPUUpdater) { + updater.publisher(for: \.canCheckForUpdates) + .assign(to: &$canCheckForUpdates) + } +} diff --git a/Map/Presentation/MapEditor.swift b/Map/Presentation/MapEditor.swift index bf33f75..f9415d3 100644 --- a/Map/Presentation/MapEditor.swift +++ b/Map/Presentation/MapEditor.swift @@ -97,7 +97,6 @@ struct MapEditor: View { } private func onDragVertex(vertex: Vertex, x: CGFloat, y: CGFloat) { - print("Dragging: \(vertex), \(x), \(y)") } private func saveImage() { diff --git a/README.md b/README.md index 888781a..d8713cb 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,10 @@ You can group nodes together by using `[Group] NodeA NodeB...`. eg. ### Notes -You can add notes by using `[Note] (x,y) Text`. eg. +You can add notes `[Note] (x, y) Text` where x and y are numbers, and Text is +any text with spaces or `\n`. -- `[Note] (10, 20.1) This is a note, it will wrap itself` -- `[Note] (10, 20.1) This is a note,\nwith a forced wrap` +- `[Note] (30, 45) Here we want to call out an explanation or context.` +- `[Note] (90, 25) We're close to the edge \n so we can multiline it.` [swift-format]: https://github.com/apple/swift-format.git 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}"