Skip to content

Commit

Permalink
Fix all build error on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Oct 19, 2023
1 parent 3ad7217 commit f8841d5
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// Status: WIP
// ID: A363922CEBDF47986D9772B903C8737A

#if canImport(Darwin)
@available(watchOS 7.0, *)
final class AppGraph: GraphHost {
init(app _: some App) {}
Expand All @@ -18,3 +19,4 @@ final class AppGraph: GraphHost {

func startProfilingIfNecessary() {}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Lastest Version: iOS 15.5
// Status: WIP

#if canImport(Darwin)
import Foundation
#if OPENSWIFTUI_USE_COMBINE
import Combine
Expand Down Expand Up @@ -48,3 +49,4 @@ class FallbackDelegateBox<Delegate: NSObject>: AnyFallbackDelegateBox {
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,42 @@ private final class OpenSwiftUIApplication: NSApplication {
fatalError("init(coder:) has not been implemented")
}
}
#else
import Foundation
#endif

@available(watchOS 7.0, *)
func runApp(_ app: some App) -> Never {
#if canImport(Darwin)
let graph = AppGraph(app: app)
graph.startProfilingIfNecessary()
// graph.instantiate()
AppGraph.shared = graph
#endif
KitRendererCommon()
}

@available(watchOS 7.0, *)
private func KitRendererCommon() -> Never {
let argc = CommandLine.argc
let argv = CommandLine.unsafeArgv

#if canImport(Darwin)
#if os(iOS) || os(tvOS) || os(macOS)
let principalClassName = NSStringFromClass(OpenSwiftUIApplication.self)
#endif

let delegateClassName = NSStringFromClass(AppDelegate.self)
#endif

#if os(iOS) || os(tvOS)
let code = UIApplicationMain(argc, argv, principalClassName, delegateClassName)
#elseif os(watchOS)
let code = WKApplicationMain(argc, argv, delegateClassName)
#elseif os(macOS)
// FIXME
let code = NSApplicationMain(argc, argv)
#elseif os(Linux)
let code: Int32 = 1
#endif
exit(code)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Lastest Version: iOS 15.5
// Status: WIP

#if canImport(Darwin)
@frozen
public struct LocalizedStringKey {}

Expand Down Expand Up @@ -57,3 +58,4 @@ public struct WindowGroup<Content>: Scene where Content: View {

var id: String?
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ extension Double: VectorArithmetic {
}
}

#if canImport(CoreFoundation)
import CoreFoundation
#if canImport(CoreGraphics)
import CoreGraphics
extension CGFloat: VectorArithmetic {
@_transparent
public mutating func scale(by rhs: Double) { self *= CGFloat(rhs) }
Expand Down
4 changes: 3 additions & 1 deletion Sources/OpenSwiftUI/UIElements/Edge/EdgeInsets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation
#if canImport(CoreGraphics)
import CoreGraphics

@frozen public struct EdgeInsets: Equatable {
public var top: CGFloat
Expand Down Expand Up @@ -151,3 +152,4 @@ extension EdgeInsets: CodableByProxy {
// MARK: - Sendable

extension EdgeInsets: Sendable {}
#endif
3 changes: 3 additions & 0 deletions Sources/OpenSwiftUI/UIElements/Graph/TODO/_GraphInputs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public struct _GraphInputs {
// var transaction: Attribute<Transaction>
var changedDebugProperties: _ViewDebug.Properties
var options: Options
// FIXME: Compile crash on Linux
#if !os(Linux)
var mergedInputs: Set<OGAttribute>
#endif
}

extension _GraphInputs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import Foundation

@_hasMissingDesignatedInitializers
@usableFromInline
class AnyTextStorage {
@objc
/*@objc*/
deinit {}
}
2 changes: 2 additions & 0 deletions Sources/OpenSwiftUI/UIElements/Text/TODO/Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Lastest Version: iOS 15.5
// Status: Empty

#if canImport(CoreGraphics)
import CoreGraphics

@frozen
Expand Down Expand Up @@ -66,3 +67,4 @@ public struct Text: Equatable {
}

extension Text: PrimitiveView, UnaryView {}
#endif
3 changes: 1 addition & 2 deletions Sources/OpenSwiftUI/UIElements/View/TODO/AnyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public struct AnyView : PrimitiveView {
}
}

@_hasMissingDesignatedInitializers
@usableFromInline
class AnyViewStorageBase {
@objc
/*@objc*/
@usableFromInline
deinit {

Expand Down

0 comments on commit f8841d5

Please sign in to comment.