@@ -922,6 +922,58 @@ fileprivate enum TargetPlatformSpecializationMode {
922922 }
923923 }
924924
925+ @Test
926+ func toolchainOverlaysViaOverridesDoNotConflictWithSpecialization( ) async throws {
927+ let core = try await getCore ( )
928+ let workspace = try TestWorkspace ( " Workspace " ,
929+ projects: [ TestPackageProject ( " aProject " ,
930+ groupTree: TestGroup ( " SomeFiles " ) ,
931+ targets: [
932+ TestAggregateTarget ( " ALL " , dependencies: [ " iOSFwk " , " PackageLibProduct " ] ) ,
933+ TestStandardTarget (
934+ " iOSFwk " ,
935+ type: . framework,
936+ buildConfigurations: [
937+ TestBuildConfiguration ( " Debug " , buildSettings: [ " SDKROOT " : " macosx " ] ) ,
938+ ] ,
939+ dependencies: [ " PackageLibProduct " ]
940+ ) ,
941+ TestPackageProductTarget (
942+ " PackageLibProduct " ,
943+ frameworksBuildPhase: TestFrameworksBuildPhase ( [
944+ TestBuildFile ( . target( " PackageLib " ) ) ] ) ,
945+ buildConfigurations: [
946+ // Targets need to opt-in to specialization.
947+ TestBuildConfiguration ( " Debug " , buildSettings: [
948+ " SDKROOT " : " auto " ,
949+ " SDK_VARIANT " : " auto " ,
950+ " SUPPORTED_PLATFORMS " : " macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator " ,
951+ ] ) ,
952+ ] ,
953+ dependencies: [ " PackageLib " ]
954+ ) ,
955+ TestStandardTarget ( " PackageLib " , type: . staticLibrary) ,
956+ ]
957+ ) ]
958+ ) . load ( core)
959+ let workspaceContext = WorkspaceContext ( core: core, workspace: workspace, processExecutionCache: . sharedForTesting)
960+ let project = workspace. projects [ 0 ]
961+
962+ // Configure the targets and create a BuildRequest.
963+ let buildParameters = BuildParameters ( configuration: " Debug " , activeRunDestination: RunDestinationInfo . macOS, overrides: [ " TOOLCHAINS " : " com.fake-toolchain-identifier " ] )
964+ let allTarget = BuildRequest . BuildTargetInfo ( parameters: buildParameters, target: project. targets [ 0 ] )
965+ let packageTarget = BuildRequest . BuildTargetInfo ( parameters: buildParameters, target: project. targets [ 2 ] )
966+ let buildRequest = BuildRequest ( parameters: buildParameters, buildTargets: [ allTarget, packageTarget] , continueBuildingAfterErrors: true , useParallelTargets: false , useImplicitDependencies: false , useDryRun: false )
967+ let buildRequestContext = BuildRequestContext ( workspaceContext: workspaceContext)
968+
969+ for type in TargetGraphFactory . GraphType. allCases {
970+ // Get the dependency closure for the build request and examine it.
971+ let delegate = EmptyTargetDependencyResolverDelegate ( workspace: workspaceContext. workspace)
972+ _ = await TargetGraphFactory ( workspaceContext: workspaceContext, buildRequest: buildRequest, buildRequestContext: buildRequestContext, delegate: delegate) . graph ( type: type)
973+ delegate. checkNoDiagnostics ( )
974+ }
975+ }
976+
925977 @Test ( . requireSDKs( . macOS) )
926978 func macCatalystSpecialization( ) async throws {
927979 let core = try await getCore ( )
0 commit comments