@@ -1407,25 +1407,21 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
14071407 let buildSettingEnabled = scope. evaluate ( BuiltinMacros . SWIFT_ENABLE_EXPLICIT_MODULES) == . enabled ||
14081408 scope. evaluate ( BuiltinMacros . _EXPERIMENTAL_SWIFT_EXPLICIT_MODULES) == . enabled
14091409
1410+ // If this project is on the blocklist, override the blocklist default enable for it
1411+ if let explicitModuleBlocklist = await getExplicitModuleBlocklist ( producer, scope, delegate) , explicitModuleBlocklist. isProjectListed ( scope) {
1412+ return false
1413+ }
1414+
14101415 // rdar://122829880 (Turn off Swift explicit modules when c++ interop is enabled)
14111416 guard scope. evaluate ( BuiltinMacros . SWIFT_OBJC_INTEROP_MODE) != " objcxx " && !scope. evaluate ( BuiltinMacros . OTHER_SWIFT_FLAGS) . contains ( " -cxx-interoperability-mode=default " ) else {
1412- return scope. evaluate ( BuiltinMacros . _SWIFT_EXPLICIT_MODULES_ALLOW_CXX_INTEROP)
1417+ return scope. evaluate ( BuiltinMacros . _SWIFT_EXPLICIT_MODULES_ALLOW_CXX_INTEROP) && buildSettingEnabled
14131418 }
14141419
14151420 // Disable explicit modules in the pre-Swift-5 language modes to avoid versioned API notes confusion.
14161421 guard let swiftVersion = try ? Version ( scope. evaluate ( BuiltinMacros . SWIFT_VERSION) ) , swiftVersion >= Version ( 5 ) else {
1417- return scope. evaluate ( BuiltinMacros . _SWIFT_EXPLICIT_MODULES_ALLOW_BEFORE_SWIFT_5)
1422+ return scope. evaluate ( BuiltinMacros . _SWIFT_EXPLICIT_MODULES_ALLOW_BEFORE_SWIFT_5) && buildSettingEnabled
14181423 }
14191424
1420- // If a blocklist is provided in the toolchain, use it to determine the default for the current project
1421- guard let explicitModuleBlocklist = await getExplicitModuleBlocklist ( producer, scope, delegate) else {
1422- return buildSettingEnabled
1423- }
1424-
1425- // If this project is on the blocklist, override the blocklist default enable for it
1426- if explicitModuleBlocklist. isProjectListed ( scope) {
1427- return false
1428- }
14291425 return buildSettingEnabled
14301426 }
14311427
0 commit comments