Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ let renderBoxCondition = envBoolValue("RENDERBOX", default: buildForDarwinPlatfo
let anyAttributeFix = envBoolValue("ANY_ATTRIBUTE_FIX", default: !buildForDarwinPlatform)

let linkCoreUI = envBoolValue("LINK_COREUI", default: buildForDarwinPlatform && !isSPIBuild)
let linkSFSymbols = envBoolValue("LINK_SFSYMBOLS", default: buildForDarwinPlatform && !isSPIBuild)
let linkBacklightServices = envBoolValue("LINK_BACKLIGHTSERVICES", default: buildForDarwinPlatform && !isSPIBuild)
// This should be disabled for UI test target due to link issue of Testing.
// Only enable for non-UI test targets.
Expand Down Expand Up @@ -247,6 +248,10 @@ if linkCoreUI {
sharedSwiftSettings.append(.define("OPENSWIFTUI_LINK_COREUI"))
}

if linkSFSymbols {
sharedSwiftSettings.append(.define("OPENSWIFTUI_LINK_SFSYMBOLS"))
}

sharedCSettings.append(
.define(
"OPENSWIFTUI_LINK_BACKLIGHTSERVICES",
Expand Down Expand Up @@ -393,6 +398,10 @@ extension Target {
dependencies.append(.product(name: "CoreUI", package: "DarwinPrivateFrameworks"))
}

func addSFSymbolsSettings() {
dependencies.append(.product(name: "SFSymbols", package: "DarwinPrivateFrameworks"))
}

func addBacklightServicesSettings() {
// FIXME: Weird SwiftPM behavior for test Target. Otherwize we'll get the following error message
// "could not determine executable path for bundle 'BacklightServices.framework'"
Expand Down Expand Up @@ -832,6 +841,10 @@ if linkCoreUI {
openSwiftUISPITarget.addCoreUISettings()
}

if linkSFSymbols {
openSwiftUICoreTarget.addSFSymbolsSettings()
}

if linkBacklightServices {
openSwiftUITarget.addBacklightServicesSettings()
openSwiftUISPITarget.addBacklightServicesSettings()
Expand All @@ -844,7 +857,7 @@ if useLocalDeps {
.package(path: "../OpenRenderBox"),
.package(path: "../OpenObservation"),
]
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkBacklightServices {
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkSFSymbols || linkBacklightServices {
dependencies.append(.package(path: "../DarwinPrivateFrameworks"))
}
package.dependencies += dependencies
Expand All @@ -856,7 +869,7 @@ if useLocalDeps {
.package(url: "https://github.com/OpenSwiftUIProject/OpenRenderBox", branch: "main"),
.package(url: "https://github.com/OpenSwiftUIProject/OpenObservation", branch: "main"),
]
if attributeGraphCondition || renderBoxCondition || linkCoreUI {
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkSFSymbols {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the remote-deps branch, adding DarwinPrivateFrameworks is gated by attributeGraphCondition || renderBoxCondition || linkCoreUI || linkSFSymbols, but not linkBacklightServices (unlike the local-deps branch). This can break builds when LINK_COREUI=0 but LINK_BACKLIGHTSERVICES=1 by omitting the required package dependency.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

dependencies.append(.package(url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", branch: "main"))
}
package.dependencies += dependencies
Expand Down
25 changes: 8 additions & 17 deletions Sources/OpenSwiftUICore/Util/SFSymbolsShims.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,20 @@
// SFSymbolsShims.swift
// OpenSwiftUICore
//
// Status: WIP

// MARK: - SFSymbols Framework Access
//
// Currently uses dlopen/dlsym for dynamic symbol resolution at
// runtime. This avoids a hard link dependency on the private SFSymbols
// framework.
//
// TODO: Migrate to add SFSymbols in DarwinPrivateFrameworks package and link it with a new
// OPENSWIFTUI_LINK_SFSYMBOLS build flag (following the CoreUI pattern).
// When that migration happens:
// 1. Add `import SFSymbols` under `#if OPENSWIFTUI_LINK_SFSYMBOLS`.
// 2. Replace the dlopen-based implementations with direct calls.
// 3. Call sites using `SFSymbols.symbol_order` etc. remain unchanged
// because Swift resolves `SFSymbols.x` identically whether `SFSymbols`
// is a local enum or a qualified module name.
// Status: Complete

#if canImport(Darwin)

#if OPENSWIFTUI_LINK_SFSYMBOLS
import SFSymbols
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When OPENSWIFTUI_LINK_SFSYMBOLS is enabled this file no longer defines the SFSymbols shim type, but other files/tests reference SFSymbols.* without importing the SFSymbols module (e.g. Sources/OpenSwiftUICore/View/Image/NamedImage.swift, Tests/OpenSwiftUICoreTests/Util/SFSymbolsShimsTests.swift). That will likely become an unresolved identifier compile error in linking builds.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

#else
import Foundation

/// Shim for the private SFSymbols framework.
///
/// Property names intentionally use snake_case to match the framework's
/// original API surface, ensuring a seamless migration to direct linking
/// (Option C) with no source-breaking changes at call sites.
/// with no source-breaking changes at call sites.
package enum SFSymbols {
// MARK: - Module-level Properties

Expand Down Expand Up @@ -75,3 +64,5 @@ package enum SFSymbols {
}
}
#endif

#endif
Loading