Skip to content

Commit

Permalink
Add supported platforms build setting when specifying multiple destin…
Browse files Browse the repository at this point in the history
…ations

- When specifying multiple destination, the `SUPPORTED_PLATFORMS` build setting needs to be set to include the various sdks for both simulator and device

Notes:

- This was cherry-picked from a draft PR for multi-platform support #5381

Test Plan:

- Multiple destinations is not yet exposed via public as such can only be validated with unit tests at this time
  • Loading branch information
kwridan committed Sep 22, 2023
1 parent 1858146 commit 163b2bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/TuistGenerator/Generator/ConfigGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ final class ConfigGenerator: ConfigGenerating {
settings["SDKROOT"] = "auto"
}

if target.supportedPlatforms.count > 1 {
let simulatorSDKs = target.supportedPlatforms.compactMap(\.xcodeSimulatorSDK)
let platformSDKs = target.supportedPlatforms.map(\.xcodeDeviceSDK)
settings["SUPPORTED_PLATFORMS"] = .string(
[simulatorSDKs, platformSDKs].flatMap { $0 }.sorted()
.joined(separator: " ")
)
}

if target.product == .staticFramework {
settings["MACH_O_TYPE"] = "staticlib"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ final class ConfigGeneratorTests: TuistUnitTestCase {
let expectedSettings: SettingsDictionary = [
"SDKROOT": "auto",
"TARGETED_DEVICE_FAMILY": "1,2",
"SUPPORTED_PLATFORMS": "iphoneos iphonesimulator macosx",
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]": ["$(inherited)", "@executable_path/../Frameworks"],
"LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks"],
]
Expand Down

0 comments on commit 163b2bc

Please sign in to comment.