Skip to content

Commit 50ce433

Browse files
committed
Update version number and packages
IB-8447, IB-8527, IB-8434 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent d449483 commit 50ce433

4 files changed

Lines changed: 143 additions & 135 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Build on macOS
99
runs-on: macos-latest
1010
env:
11-
MACOSX_DEPLOYMENT_TARGET: 12.0
11+
MACOSX_DEPLOYMENT_TARGET: 13.0
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v4
@@ -23,15 +23,10 @@ jobs:
2323
path: build/*.pkg
2424
windows:
2525
name: Build on Windows
26-
runs-on: ${{ matrix.image }}
26+
runs-on: windows-2022
2727
strategy:
2828
matrix:
29-
vcver: [142, 143]
30-
include:
31-
- vcver: 142
32-
image: windows-2019
33-
- vcver: 143
34-
image: windows-2022
29+
vcver: [143]
3530
env:
3631
VER_SUFFIX: .VS${{ matrix.vcver }}
3732
steps:
@@ -41,24 +36,23 @@ jobs:
4136
submodules: recursive
4237
- name: Prepare vcpkg
4338
uses: lukka/run-vcpkg@v7
44-
id: runvcpkg
4539
with:
4640
vcpkgArguments: openssl
47-
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
41+
vcpkgGitCommitId: 031ad89ce6c575df35a8e58707ad2c898446c63e
4842
vcpkgTriplet: x64-windows
4943
- name: Install Qt
50-
uses: jurplel/install-qt-action@v3
44+
uses: jurplel/install-qt-action@v4
5145
with:
52-
version: 6.8.2
46+
version: 6.9.1
5347
arch: win64_msvc2022_64
5448
- name: Setup dev env
5549
uses: ilammy/msvc-dev-cmd@v1
5650
with:
5751
arch: x64
5852
- name: Install WiX
5953
run: |
60-
dotnet tool install -g wix --version 5.0.2
61-
wix extension -g add WixToolset.UI.wixext/5.0.2
54+
dotnet tool install -g wix --version 6.0.1
55+
wix extension -g add WixToolset.UI.wixext/6.0.1
6256
- name: Build
6357
run: |
6458
cmake -S . -B build `

CMakeLists.txt

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.22)
2-
project(ID-updater VERSION 3.17.0)
2+
project(ID-updater VERSION 3.18.0)
33

44
macro( SET_ENV NAME DEF )
55
if( DEFINED ENV{${NAME}} )
@@ -23,8 +23,33 @@ if( APPLE )
2323
COMMENT "Generating config.h"
2424
)
2525
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
26-
add_executable( id-updater-helper prefPane/id-updater-helper.m prefPane/update.m config.h )
27-
target_compile_options(id-updater-helper PRIVATE -Wno-unused-parameter -fobjc-arc -fmodules)
26+
add_library(id-updater-lib STATIC prefPane/update.m config.h)
27+
target_compile_options(id-updater-lib PRIVATE -Wno-unused-parameter -fobjc-arc -fmodules)
28+
set(SWIFT_FLAGS "")
29+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
30+
set(SWIFT_FLAGS "-g")
31+
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
32+
set(SWIFT_FLAGS "-O")
33+
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
34+
set(SWIFT_FLAGS "-O -g")
35+
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
36+
set(SWIFT_FLAGS "-Osize")
37+
endif()
38+
add_custom_command(OUTPUT id-updater-helper
39+
BYPRODUCTS id-updater-helper_arm64 id-updater-helper_x86_64
40+
COMMENT "Build id-updater-helper"
41+
COMMAND xcrun --sdk macosx swiftc -target arm64-apple-macosx${CMAKE_OSX_DEPLOYMENT_TARGET} -parse-as-library ${SWIFT_FLAGS}
42+
-import-objc-header ${CMAKE_CURRENT_SOURCE_DIR}/prefPane/update.h
43+
${CMAKE_CURRENT_SOURCE_DIR}/prefPane/id-updater-helper.swift
44+
$<TARGET_FILE:id-updater-lib>
45+
-o id-updater-helper_arm64
46+
COMMAND xcrun --sdk macosx swiftc -target x86_64-apple-macosx${CMAKE_OSX_DEPLOYMENT_TARGET} -parse-as-library ${SWIFT_FLAGS}
47+
-import-objc-header ${CMAKE_CURRENT_SOURCE_DIR}/prefPane/update.h
48+
${CMAKE_CURRENT_SOURCE_DIR}/prefPane/id-updater-helper.swift
49+
$<TARGET_FILE:id-updater-lib>
50+
-o id-updater-helper_x86_64
51+
COMMAND lipo -create id-updater-helper_arm64 id-updater-helper_x86_64 -output id-updater-helper
52+
)
2853

2954
add_custom_command( OUTPUT ID_updater.nib
3055
COMMAND ibtool --errors --warnings --notices --output-format human-readable-text
@@ -37,13 +62,11 @@ if( APPLE )
3762
find_library( XAR xar )
3863
add_library(${PROJECT_NAME} MODULE
3964
ID_updater.nib
40-
config.h
4165
${EN_RESOURCES}
4266
${ET_RESOURCES}
4367
${RU_RESOURCES}
4468
prefPane/Icon.icns
4569
prefPane/id-updater.m
46-
prefPane/update.m
4770
)
4871
set_source_files_properties(prefPane/Icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
4972
set_source_files_properties(ID_updater.nib PROPERTIES MACOSX_PACKAGE_LOCATION Resources/Base.lproj)
@@ -65,10 +88,9 @@ if( APPLE )
6588
MACOSX_BUNDLE_BUNDLE_VERSION ${BUILD_NUMBER}
6689
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "ee.ria.${PROJECT_NAME}"
6790
)
68-
target_link_libraries(${PROJECT_NAME} ${XAR})
69-
add_dependencies(${PROJECT_NAME} id-updater-helper)
70-
set_target_properties(id-updater-helper PROPERTIES
71-
RUNTIME_OUTPUT_DIRECTORY $<TARGET_BUNDLE_CONTENT_DIR:${PROJECT_NAME}>/Resources
91+
target_link_libraries(${PROJECT_NAME} ${XAR} id-updater-lib)
92+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
93+
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/id-updater-helper $<TARGET_BUNDLE_CONTENT_DIR:${PROJECT_NAME}>/Resources
7294
)
7395
install( TARGETS ${PROJECT_NAME} DESTINATION /Library/PreferencePanes )
7496

@@ -86,7 +108,7 @@ if( APPLE )
86108
COMMAND_EXPAND_LISTS
87109
)
88110
add_custom_target(zipdebug DEPENDS ${PROJECT_NAME}
89-
COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $<TARGET_FILE:${PROJECT_NAME}> $<TARGET_FILE:id-updater-helper>
111+
COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $<TARGET_FILE:${PROJECT_NAME}> id-updater-helper
90112
COMMAND zip -r updater-dbg_${VERSION}$ENV{VER_SUFFIX}.zip ${PROJECT_NAME}.dSYM
91113
)
92114
else()

prefPane/id-updater-helper.m

Lines changed: 0 additions & 111 deletions
This file was deleted.

prefPane/id-updater-helper.swift

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
* id-updater
3+
*
4+
* This library is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU Lesser General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 2.1 of the License, or (at your option) any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public
15+
* License along with this library; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
*
18+
*/
19+
20+
import Foundation
21+
22+
@main
23+
class Updater: Update, UpdateDelegate, @unchecked Sendable {
24+
private let path: String
25+
26+
init(path: String) {
27+
self.path = path
28+
super.init()
29+
delegate = self
30+
print("Installed \(path): \(self.baseversion ?? "")")
31+
request()
32+
}
33+
34+
static func launch(_ path: String, arguments: [String]) -> Int32 {
35+
let task = Process()
36+
task.launchPath = path
37+
task.arguments = arguments
38+
task.launch()
39+
task.waitUntilExit()
40+
return task.terminationStatus
41+
}
42+
43+
// MARK: - Update Delegate
44+
45+
func didFinish(_ error: Error?) {
46+
if let error = error {
47+
print("Error: \(error.localizedDescription)")
48+
}
49+
exit(0)
50+
}
51+
52+
func message(_ message: String) {
53+
print(message)
54+
_ = Updater.launch("/usr/bin/open", arguments: [path])
55+
}
56+
57+
func updateAvailable(_ available: String, filename: String) {
58+
print("Update available \(available) \(filename)")
59+
_ = Updater.launch("/usr/bin/open", arguments: [path])
60+
}
61+
62+
static func main() {
63+
let arguments = CommandLine.arguments
64+
guard arguments.count == 2 else {
65+
print("Usage: \(arguments[0]) [-task | -remove | -daily | -weekly | -monthly]")
66+
exit(1)
67+
}
68+
69+
let directoryPath = ("~/Library/LaunchAgents" as NSString).expandingTildeInPath
70+
let PATH = directoryPath + "/ee.ria.id-updater.plist"
71+
let components = Calendar.current.dateComponents([.hour, .minute, .weekday, .day], from: Date())
72+
let schedule: [String: Any]
73+
74+
switch arguments[1] {
75+
case "-task":
76+
_ = Updater(path: NSString(string: "\(Bundle.main.executablePath ?? arguments[0])/../../..").standardizingPath)
77+
return RunLoop.main.run()
78+
case "-remove":
79+
let result = Updater.launch("/bin/launchctl", arguments: ["unload", "-w", PATH])
80+
try? FileManager.default.removeItem(atPath: PATH)
81+
exit(result)
82+
case "-daily":
83+
schedule = ["Hour": components.hour!, "Minute": components.minute!]
84+
case "-weekly":
85+
schedule = ["Hour": components.hour!, "Minute": components.minute!, "Weekday": components.weekday!]
86+
case "-monthly":
87+
schedule = ["Hour": components.hour!, "Minute": components.minute!, "Day": components.day!]
88+
default:
89+
print("Invalid argument: \(arguments[1])")
90+
exit(1)
91+
}
92+
93+
let settings: [String: Any] = [
94+
"Label": "ee.ria.id-updater",
95+
"ProgramArguments": [arguments[0], "-task"],
96+
"StartCalendarInterval": schedule
97+
]
98+
let plistData = try? PropertyListSerialization.data(fromPropertyList: settings, format: .xml, options: 0)
99+
try? FileManager.default.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil)
100+
FileManager.default.createFile(atPath: PATH, contents: plistData, attributes: nil)
101+
exit(Updater.launch("/bin/launchctl", arguments: ["load", "-w", PATH]))
102+
}
103+
}

0 commit comments

Comments
 (0)