diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml deleted file mode 100644 index fbcdff1..0000000 --- a/.github/workflows/build-app.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build MiniSim - -on: - pull_request: - branches: - - main - push: - branches: - - main - -concurrency: - group: ${{ github.ref }}-build - cancel-in-progress: true - -jobs: - build: - runs-on: macos-13 - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Set up Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 15 - - - name: Install XCBeautify - run: brew install xcbeautify - - - name: Test - run: set -o pipefail && xcodebuild -scheme MiniSim -destination 'platform=macOS' -skipPackagePluginValidation -skipMacroValidation test COMPILER_INDEX_STORE_ENABLE=NO | xcbeautify - - - name: Build - run: set -o pipefail && xcodebuild -scheme MiniSim -destination 'platform=macOS' -skipPackagePluginValidation -skipMacroValidation build COMPILER_INDEX_STORE_ENABLE=NO | xcbeautify diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..29e7cfd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: MiniSim CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +concurrency: + group: ${{ github.ref }}-build + cancel-in-progress: true + +env: + DERIVED_DATA_PATH: ${{ github.workspace }}/DerivedData + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + + build: + runs-on: macos-14 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Set up Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 15 + - name: Cache DerivedData + uses: actions/cache@v2 + with: + path: ${{ env.DERIVED_DATA_PATH }} + key: ${{ runner.os }}-deriveddata-${{ hashFiles('**/*.xcodeproj/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-deriveddata- + - name: Build + run: | + set -o pipefail && xcodebuild -scheme MiniSim -destination 'platform=macOS' \ + -skipPackagePluginValidation -skipMacroValidation \ + -derivedDataPath ${{ env.DERIVED_DATA_PATH }} \ + build-for-testing \ + COMPILER_INDEX_STORE_ENABLE=NO | xcbeautify --renderer github-actions + + test: + needs: build + runs-on: macos-14 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Set up Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 15 + - name: Cache DerivedData + uses: actions/cache@v2 + with: + path: ${{ env.DERIVED_DATA_PATH }} + key: ${{ runner.os }}-deriveddata-${{ hashFiles('**/*.xcodeproj/project.pbxproj') }} + - name: Test + run: | + xcodebuild -scheme MiniSim -destination 'platform=macOS' \ + -skipPackagePluginValidation -skipMacroValidation \ + -derivedDataPath ${{ env.DERIVED_DATA_PATH }} \ + test-without-building \ + COMPILER_INDEX_STORE_ENABLE=NO | xcbeautify --renderer github-actions diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml deleted file mode 100644 index c275c71..0000000 --- a/.github/workflows/swiftlint.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: SwiftLint - -on: - pull_request: - paths: - - ".github/workflows/swiftlint.yml" - - ".swiftlint.yml" - - "**/*.swift" - -jobs: - SwiftLint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.2.1 diff --git a/MiniSim.xcodeproj/project.pbxproj b/MiniSim.xcodeproj/project.pbxproj index c01263a..cf3833c 100644 --- a/MiniSim.xcodeproj/project.pbxproj +++ b/MiniSim.xcodeproj/project.pbxproj @@ -75,6 +75,8 @@ 76AC9AF62A0EA82C00864A8B /* CustomCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76AC9AF52A0EA82C00864A8B /* CustomCommands.swift */; }; 76AC9AF92A0EB50800864A8B /* SymbolPicker in Frameworks */ = {isa = PBXBuildFile; productRef = 76AC9AF82A0EB50800864A8B /* SymbolPicker */; }; 76B70F7E2B0D361A009D87A4 /* UserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76B70F7D2B0D361A009D87A4 /* UserDefaultsTests.swift */; }; + 76BF0AD92C8CB3E6003BE568 /* AcknowList in Frameworks */ = {isa = PBXBuildFile; productRef = 76BF0AD82C8CB3E6003BE568 /* AcknowList */; }; + 76BF0ADB2C8CB4CD003BE568 /* Package.resolved in Resources */ = {isa = PBXBuildFile; fileRef = 76BF0ADA2C8CB4CD003BE568 /* Package.resolved */; }; 76C1396A2C849A3F006CD80C /* MenuIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76C139692C849A3F006CD80C /* MenuIcons.swift */; }; 76E4451229D4391000039025 /* Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4451129D4391000039025 /* Onboarding.swift */; }; 76E4451429D4403F00039025 /* NSNotificationName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4451329D4403F00039025 /* NSNotificationName.swift */; }; @@ -167,6 +169,7 @@ 76AC9AF52A0EA82C00864A8B /* CustomCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCommands.swift; sourceTree = ""; }; 76B70F742B0D359D009D87A4 /* MiniSimTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MiniSimTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 76B70F7D2B0D361A009D87A4 /* UserDefaultsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsTests.swift; sourceTree = ""; }; + 76BF0ADA2C8CB4CD003BE568 /* Package.resolved */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Package.resolved; path = MiniSim.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved; sourceTree = SOURCE_ROOT; }; 76C139692C849A3F006CD80C /* MenuIcons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuIcons.swift; sourceTree = ""; }; 76E4451129D4391000039025 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = ""; }; 76E4451329D4403F00039025 /* NSNotificationName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSNotificationName.swift; sourceTree = ""; }; @@ -187,6 +190,7 @@ buildActionMask = 2147483647; files = ( 765077C62C46F04A00C7B5F3 /* Settings in Frameworks */, + 76BF0AD92C8CB3E6003BE568 /* AcknowList in Frameworks */, 768F8EC829954C8A00DFBCDB /* Sparkle in Frameworks */, 76F04A14298A62CF00BF9CA3 /* ShellOut in Frameworks */, 76AC9AF92A0EB50800864A8B /* SymbolPicker in Frameworks */, @@ -356,6 +360,7 @@ 7645D5002982E6FA00019227 /* main.swift */, 766BD2372981628C0042261B /* Assets.xcassets */, 766BD23C2981628C0042261B /* MiniSim.entitlements */, + 76BF0ADA2C8CB4CD003BE568 /* Package.resolved */, 766BD2392981628C0042261B /* Preview Content */, ); path = MiniSim; @@ -452,6 +457,7 @@ 76AC9AF82A0EB50800864A8B /* SymbolPicker */, 763EEB122A26896B008428F1 /* CodeEditor */, 765077C52C46F04A00C7B5F3 /* Settings */, + 76BF0AD82C8CB3E6003BE568 /* AcknowList */, ); productName = MiniSim; productReference = 766BD2302981628A0042261B /* MiniSim.app */; @@ -513,6 +519,7 @@ 763EEB112A26896B008428F1 /* XCRemoteSwiftPackageReference "CodeEditor" */, 4A7892862AF1A767004D3FC8 /* XCRemoteSwiftPackageReference "SwiftLint" */, 76A5C3B72C46E4C40064118A /* XCRemoteSwiftPackageReference "Settings" */, + 76BF0AD72C8CB3E6003BE568 /* XCRemoteSwiftPackageReference "AcknowList" */, ); productRefGroup = 766BD2312981628A0042261B /* Products */; projectDirPath = ""; @@ -530,6 +537,7 @@ buildActionMask = 2147483647; files = ( 766BD23B2981628C0042261B /* Preview Assets.xcassets in Resources */, + 76BF0ADB2C8CB4CD003BE568 /* Package.resolved in Resources */, 766BD2382981628C0042261B /* Assets.xcassets in Resources */, 7610992D2A3F95850067885A /* MiniSim.sdef in Resources */, 765C44C82A2A6C9600FCC159 /* MainMenu.xib in Resources */, @@ -999,6 +1007,14 @@ minimumVersion = 1.0.0; }; }; + 76BF0AD72C8CB3E6003BE568 /* XCRemoteSwiftPackageReference "AcknowList" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/vtourraine/AcknowList"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 3.2.0; + }; + }; 76F04A12298A62CF00BF9CA3 /* XCRemoteSwiftPackageReference "ShellOut" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/JohnSundell/ShellOut.git"; @@ -1050,6 +1066,11 @@ package = 4A7892862AF1A767004D3FC8 /* XCRemoteSwiftPackageReference "SwiftLint" */; productName = "plugin:SwiftLintPlugin"; }; + 76BF0AD82C8CB3E6003BE568 /* AcknowList */ = { + isa = XCSwiftPackageProductDependency; + package = 76BF0AD72C8CB3E6003BE568 /* XCRemoteSwiftPackageReference "AcknowList" */; + productName = AcknowList; + }; 76F04A13298A62CF00BF9CA3 /* ShellOut */ = { isa = XCSwiftPackageProductDependency; package = 76F04A12298A62CF00BF9CA3 /* XCRemoteSwiftPackageReference "ShellOut" */; diff --git a/MiniSim.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MiniSim.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 22f72c7..bc4efc3 100644 --- a/MiniSim.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/MiniSim.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,12 +1,22 @@ { + "originHash" : "cd658c4c33f28ee5c23e75fe75f65774af59946eb7d0c9743291b5f38cf4419f", "pins" : [ + { + "identity" : "acknowlist", + "kind" : "remoteSourceControl", + "location" : "https://github.com/vtourraine/AcknowList", + "state" : { + "revision" : "125ff1915a639bf7d97471a4d5ae16765d0c50f2", + "version" : "3.2.0" + } + }, { "identity" : "codeeditor", "kind" : "remoteSourceControl", "location" : "https://github.com/ZeeZide/CodeEditor.git", "state" : { - "revision" : "180bde07b44dea839b32873bd8586ba146fa9106", - "version" : "1.2.2" + "revision" : "f5c076b94f4ceb05abff88ba91d75a8d57143f0c", + "version" : "1.2.6" } }, { @@ -23,17 +33,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", "state" : { - "revision" : "db51c407d3be4a051484a141bf0bff36c43d3b1e", - "version" : "1.8.0" + "revision" : "678d442c6f7828def400a70ae15968aef67ef52d", + "version" : "1.8.3" } }, { "identity" : "highlightr", "kind" : "remoteSourceControl", - "location" : "https://github.com/raspu/Highlightr", + "location" : "https://github.com/helje5/Highlightr", "state" : { - "revision" : "93199b9e434f04bda956a613af8f571933f9f037", - "version" : "2.1.2" + "revision" : "bd0358056ff1f12ea83833a9fc1b3b5a396a9da0", + "version" : "3.0.2" } }, { @@ -42,7 +52,7 @@ "location" : "https://github.com/sindresorhus/KeyboardShortcuts", "state" : { "branch" : "main", - "revision" : "d7b349f6822e24228141e560aa48a32dca23b22c" + "revision" : "e6b60117ec266e1e5d059f7f34815144f9762b36" } }, { @@ -51,7 +61,7 @@ "location" : "https://github.com/sindresorhus/LaunchAtLogin", "state" : { "branch" : "main", - "revision" : "7ad6331f9c38953eb1ce8737758e18f7607e984a" + "revision" : "9a894d799269cb591037f9f9cb0961510d4dca81" } }, { @@ -77,8 +87,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/SourceKitten.git", "state" : { - "revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56", - "version" : "0.34.1" + "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", + "version" : "0.35.0" } }, { @@ -86,8 +96,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/sparkle-project/Sparkle", "state" : { - "revision" : "9d85a02fe7916caa7531847452c4933d331503a5", - "version" : "2.3.1" + "revision" : "0ef1ee0220239b3776f433314515fd849025673f", + "version" : "2.6.4" } }, { @@ -95,17 +105,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", - "version" : "1.2.3" + "revision" : "41982a3656a71c768319979febd796c6fd111d5c", + "version" : "1.5.0" } }, { "identity" : "swift-syntax", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", + "location" : "https://github.com/swiftlang/swift-syntax.git", "state" : { - "revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036", - "version" : "509.0.2" + "revision" : "515f79b522918f83483068d99c68daeb5116342d", + "version" : "600.0.0-prerelease-2024-08-14" } }, { @@ -113,8 +123,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/SwiftLint.git", "state" : { - "revision" : "f17a4f9dfb6a6afb0408426354e4180daaf49cee", - "version" : "0.54.0" + "revision" : "a24488f26e60247d8fff7bbb03d51910af3dc91c", + "version" : "0.56.2" } }, { @@ -140,8 +150,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xnth97/SymbolPicker.git", "state" : { - "revision" : "1e81757fc81fdee86f48d101eab0d0f8e9e0ec3d", - "version" : "1.4.2" + "revision" : "f82b64bcc3d761c9e63aaa10b1912bba72cbf6d8", + "version" : "1.5.3" } }, { @@ -149,10 +159,10 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/Yams.git", "state" : { - "revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", - "version" : "5.0.6" + "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", + "version" : "5.1.3" } } ], - "version" : 2 + "version" : 3 } diff --git a/MiniSim/MiniSim.swift b/MiniSim/MiniSim.swift index 9e8fbe2..9c34b03 100644 --- a/MiniSim/MiniSim.swift +++ b/MiniSim/MiniSim.swift @@ -23,8 +23,6 @@ class MiniSim: NSObject { override init() { super.init() - settingsController.window?.delegate = self - setDefaultValues() initObservers() @@ -159,6 +157,7 @@ class MiniSim: NSObject { if let tag = MainMenuActions(rawValue: sender.tag) { switch tag { case .preferences: + settingsController.window?.delegate = self settingsController.show() settingsController.window?.orderFrontRegardless() case .quit: diff --git a/MiniSim/Views/About.swift b/MiniSim/Views/About.swift index 307e320..a869a16 100644 --- a/MiniSim/Views/About.swift +++ b/MiniSim/Views/About.swift @@ -7,51 +7,70 @@ import Sparkle import SwiftUI +import AcknowList struct About: View { - private let updaterController: SPUStandardUpdaterController - @Environment (\.openURL) private var openURL - - init() { - updaterController = SPUStandardUpdaterController( - startingUpdater: true, - updaterDelegate: nil, - userDriverDelegate: nil - ) - } - - let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - private let bottomPadding: Double = 10 - private let minFrameWidth: Double = 650 - private let minFrameHeight: Double = 450 - - var body: some View { - VStack { - Image(nsImage: NSImage(named: "AppIcon") ?? NSImage()) - Text("MiniSim") - .font(.title) - if let appVersion { - Text("Version: \(appVersion)") - .padding(.bottom, bottomPadding) - } - Button { - updaterController.updater.checkForUpdates() - } label: { - Label("Check for updates", systemImage: "gear") - } - .padding(.bottom, bottomPadding) - - HStack { - Button("GitHub") { - openURL(URL(string: "https://github.com/okwasniewski/MiniSim")!) - } - Button("Buy me a coffee") { - openURL(URL(string: "https://github.com/sponsors/okwasniewski")!) - } - }.padding(.bottom) - Link("Created by Oskar Kwaśniewski", destination: URL(string: "https://github.com/okwasniewski")!) - .font(.caption) + private let updaterController: SPUStandardUpdaterController + @Environment (\.openURL) private var openURL + @State private var isAcknowledgementsListPresented = false + + init() { + updaterController = SPUStandardUpdaterController( + startingUpdater: true, + updaterDelegate: nil, + userDriverDelegate: nil + ) + } + + let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String + private let bottomPadding: Double = 10 + private let minFrameWidth: Double = 650 + private let minFrameHeight: Double = 450 + + var body: some View { + VStack { + Image(nsImage: NSImage(named: "AppIcon") ?? NSImage()) + Text("MiniSim") + .font(.title) + if let appVersion { + Text("Version: \(appVersion)") + .padding(.bottom, bottomPadding) + } + Button { + updaterController.updater.checkForUpdates() + } label: { + Label("Check for updates", systemImage: "gear") + } + .padding(.bottom, bottomPadding) + + Button("Acknowledgements") { + isAcknowledgementsListPresented.toggle() + } + + HStack { + Button("GitHub") { + openURL(URL(string: "https://github.com/okwasniewski/MiniSim")!) } - .frame(minWidth: minFrameWidth, minHeight: minFrameHeight) + Button("Buy me a coffee") { + openURL(URL(string: "https://github.com/sponsors/okwasniewski")!) + } + }.padding(.bottom) + Link("Created by Oskar Kwaśniewski", destination: URL(string: "https://github.com/okwasniewski")!) + .font(.caption) } + .sheet(isPresented: $isAcknowledgementsListPresented, content: { + NavigationView { + AcknowListSwiftUIView(acknowList: AcknowParser.defaultPackages()!) + .toolbar { + ToolbarItem(placement: .automatic) { + Button("Close") { + isAcknowledgementsListPresented = false + } + } + } + } + .frame(minHeight: 450) + }) + .frame(minWidth: minFrameWidth, minHeight: minFrameHeight) + } }