Fix build

This commit is contained in:
Isaac 2024-09-19 00:37:24 +08:00
parent 3cc76b3e40
commit 21d5fe177b
5 changed files with 16 additions and 3 deletions

View File

@ -100,13 +100,14 @@ class BazelCommandLine:
# https://github.com/bazelbuild/rules_swift
# Use -Osize instead of -O when building swift modules.
#'--features=swift.opt_uses_osize',
'--features=swift.opt_uses_osize',
# --num-threads 0 forces swiftc to generate one object file per module; it:
# 1. resolves issues with the linker caused by the swift-objc mixing.
# 2. makes the resulting binaries significantly smaller (up to 9% for this project).
'--swiftcopt=-num-threads', '--swiftcopt=1',
#'--swiftcopt=-num-threads', '--swiftcopt=1',
'--swiftcopt=-j1',
'--features=swift._num_threads_0_in_swiftcopts',
# Strip unsused code.
'--features=dead_strip',

@ -1 +1 @@
Subproject commit 25bc63e827951bd67376cd0f811a29d0c3924009
Subproject commit 86dc0f046269b3001f6f20cec38342c03120a209

View File

@ -123,7 +123,9 @@ private final class VideoRecorderImpl {
private var previousAppendTime: Double?
public func appendVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
#if canImport(SwiftData) // Xcode 16
nonisolated(unsafe) let sampleBuffer = sampleBuffer
#endif
self.queue.async {
guard self.hasError() == nil && !self.stopped else {
@ -248,7 +250,9 @@ private final class VideoRecorderImpl {
}
public func appendAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
#if canImport(SwiftData) // Xcode 16
nonisolated(unsafe) let sampleBuffer = sampleBuffer
#endif
self.queue.async {
guard self.hasError() == nil && !self.stopped else {

View File

@ -2500,7 +2500,11 @@ public func channelStatsController(context: AccountContext, updatedPresentationD
}))
}
var tooltipScreen: UndoOverlayController?
#if canImport(SwiftData) // Xcode 16
nonisolated(unsafe) var timer: Foundation.Timer?
#else
var timer: Foundation.Timer?
#endif
showTimeoutTooltipImpl = { cooldownUntilTimestamp in
let remainingCooldownSeconds = cooldownUntilTimestamp - Int32(Date().timeIntervalSince1970)

View File

@ -2481,7 +2481,11 @@ private func renderVideo(context: AccountContext, backgroundImage: UIImage, user
completion(nil)
return
}
#if canImport(SwiftData) // Xcode 16
nonisolated(unsafe) let export = exportValue
#else
let export = exportValue
#endif
let videoName = UUID().uuidString
let exportURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoName).appendingPathExtension("mp4")