Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing BuildSettingsProvider for visionOS #898

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion Sources/XcodeProj/Utils/BuildSettingsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ public class BuildSettingsProvider {
"SKIP_INSTALL": "YES",
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks"],
]
case (.visionOS, .application):
[
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks"],
]
case (.iOS, .framework):
[
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks"],
Expand All @@ -266,6 +270,10 @@ public class BuildSettingsProvider {
"APPLICATION_EXTENSION_API_ONLY": "YES",
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks"],
]
case (.visionOS, .framework):
[
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks"],
]
case ([.iOS, .tvOS, .watchOS], .staticLibrary):
fortmarek marked this conversation as resolved.
Show resolved Hide resolved
[
"OTHER_LDFLAGS": "-ObjC",
Expand Down Expand Up @@ -317,7 +325,7 @@ public class BuildSettingsProvider {
"@executable_path/../../../../Frameworks",
],
]
case ([.iOS, .tvOS], [.unitTests, .uiTests]):
case ([.iOS, .tvOS, .visionOS], [.unitTests, .uiTests]):
[
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks"],
]
Expand Down
98 changes: 98 additions & 0 deletions Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,60 @@ class BuildSettingProviderTests: XCTestCase {
])
}

func test_targetSettings_visionOSAplication() {
// Given / When
let results = BuildSettingsProvider.targetDefault(variant: .release,
platform: .visionOS,
product: .application,
swift: true)

// Then
assertEqualSettings(results, [
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
"ENABLE_PREVIEWS": "YES",
"LD_RUNPATH_SEARCH_PATHS": [
"$(inherited)",
"@executable_path/Frameworks",
],
"SDKROOT": "xros",
"SWIFT_COMPILATION_MODE": "wholemodule",
"SWIFT_OPTIMIZATION_LEVEL": "-Owholemodule",
"TARGETED_DEVICE_FAMILY": "1,2,7",
])
}

func test_targetSettings_visionOSFramework() {
// Given / When
let results = BuildSettingsProvider.targetDefault(variant: .release,
platform: .visionOS,
product: .framework,
swift: true)

// Then
assertEqualSettings(results, [
"CODE_SIGN_IDENTITY": "",
"CURRENT_PROJECT_VERSION": "1",
"DEFINES_MODULE": "YES",
"DYLIB_COMPATIBILITY_VERSION": "1",
"DYLIB_CURRENT_VERSION": "1",
"DYLIB_INSTALL_NAME_BASE": "@rpath",
"INSTALL_PATH": "$(LOCAL_LIBRARY_DIR)/Frameworks",
"LD_RUNPATH_SEARCH_PATHS": [
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
],
"PRODUCT_NAME": "$(TARGET_NAME:c99extidentifier)",
"SDKROOT": "xros",
"SKIP_INSTALL": "YES",
"SWIFT_COMPILATION_MODE": "wholemodule",
"SWIFT_OPTIMIZATION_LEVEL": "-Owholemodule",
"TARGETED_DEVICE_FAMILY": "1,2,7",
"VERSIONING_SYSTEM": "apple-generic",
"VERSION_INFO_PREFIX": "",
])
}

func test_targetSettings_iOSUnitTests() {
// Given / When
let results = BuildSettingsProvider.targetDefault(variant: .debug,
Expand Down Expand Up @@ -236,6 +290,50 @@ class BuildSettingProviderTests: XCTestCase {
])
}

func test_targetSettings_visionOSUnitTests() {
// Given / When
let results = BuildSettingsProvider.targetDefault(variant: .debug,
platform: .visionOS,
product: .unitTests,
swift: true)

// Then
assertEqualSettings(results, [
"SDKROOT": "xros",
"LD_RUNPATH_SEARCH_PATHS": [
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
],
"SWIFT_ACTIVE_COMPILATION_CONDITIONS": ["$(inherited)", "DEBUG"],
"SWIFT_COMPILATION_MODE": "singlefile",
"SWIFT_OPTIMIZATION_LEVEL": "-Onone",
"TARGETED_DEVICE_FAMILY": "1,2,7",
])
}

func test_targetSettings_visionOSUITests() {
// Given / When
let results = BuildSettingsProvider.targetDefault(variant: .debug,
platform: .visionOS,
product: .uiTests,
swift: true)

// Then
assertEqualSettings(results, [
"SDKROOT": "xros",
"LD_RUNPATH_SEARCH_PATHS": [
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
],
"SWIFT_ACTIVE_COMPILATION_CONDITIONS": ["$(inherited)", "DEBUG"],
"SWIFT_COMPILATION_MODE": "singlefile",
"SWIFT_OPTIMIZATION_LEVEL": "-Onone",
"TARGETED_DEVICE_FAMILY": "1,2,7",
])
}

// MARK: - Helpers

func assertEqualSettings(_ lhs: BuildSettings, _ rhs: BuildSettings, file: StaticString = #file, line: UInt = #line) {
Expand Down
Loading