@@ -4273,17 +4273,20 @@ private class SettingsBuilder {
42734273 }
42744274
42754275 let toolchainPath = Path ( scope. evaluateAsString ( BuiltinMacros . TOOLCHAIN_DIR) )
4276- guard let toolchain = core. toolchainRegistry. toolchains. first ( where: { $0. path == toolchainPath } ) else {
4276+ guard let toolchain = core. toolchainRegistry. toolchains. first ( where: { $0. path == toolchainPath } ) ,
4277+ let defaultToolchain = core. toolchainRegistry. defaultToolchain
4278+ else {
42774279 return [ ]
42784280 }
42794281
42804282 enum ToolchainStyle {
4281- case xcodeDefault
4283+ case xcode ( isDefault : Bool )
42824284 case other
42834285
42844286 init ( _ toolchain: Toolchain ) {
4285- if toolchain. identifier == ToolchainRegistry . defaultToolchainIdentifier {
4286- self = . xcodeDefault
4287+ if toolchain. identifier. hasPrefix ( ToolchainRegistry . appleToolchainIdentifierPrefix) {
4288+ let isDefault = toolchain. identifier == ToolchainRegistry . defaultToolchainIdentifier
4289+ self = . xcode( isDefault: isDefault)
42874290 } else {
42884291 self = . other
42894292 }
@@ -4292,11 +4295,12 @@ private class SettingsBuilder {
42924295
42934296 let testingPluginsPath = " /usr/lib/swift/host/plugins/testing "
42944297 switch ( ToolchainStyle ( toolchain) ) {
4295- case . xcodeDefault:
4296- // This target is building using the same toolchain as the one used
4297- // to build the testing libraries which it is using, so it can use
4298- // non-external plugin flags.
4299- return [ " -plugin-path " , " $(TOOLCHAIN_DIR) \( testingPluginsPath) " ]
4298+ case let . xcode( isDefault) :
4299+ // This target is using a built-in Xcode toolchain, and that should
4300+ // match the toolchain which was used to build the testing libraries
4301+ // this target is using, so it can use non-external plugin flags.
4302+ let toolchainPathPrefix = isDefault ? " $(TOOLCHAIN_DIR) " : defaultToolchain. path. str
4303+ return [ " -plugin-path " , " \( toolchainPathPrefix) \( testingPluginsPath) " ]
43004304 case . other:
43014305 // This target is using the testing libraries from Xcode,
43024306 // which were built using the XcodeDefault toolchain, but it's using
0 commit comments