@@ -31,6 +31,7 @@ public struct Driver {
3131 case cannotAssignToConditionalCompilationFlag( String )
3232 case conditionalCompilationFlagHasRedundantPrefix( String )
3333 case conditionalCompilationFlagIsNotValidIdentifier( String )
34+ case frameworkSearchPathIncludesExtension( String )
3435 // Explicit Module Build Failures
3536 case malformedModuleDependency( String , String )
3637 case missingPCMArguments( String )
@@ -61,6 +62,14 @@ public struct Driver {
6162 return " failed to retrieve frontend target info "
6263 case . missingProfilingData( let arg) :
6364 return " no profdata file exists at ' \( arg) ' "
65+ case . cannotAssignToConditionalCompilationFlag( let name) :
66+ return " conditional compilation flags do not have values in Swift; they are either present or absent (rather than ' \( name) ') "
67+ case . conditionalCompilationFlagHasRedundantPrefix( let name) :
68+ return " invalid argument '-D \( name) '; did you provide a redundant '-D' in your build settings? "
69+ case . conditionalCompilationFlagIsNotValidIdentifier( let name) :
70+ return " conditional compilation flags must be valid Swift identifiers (rather than ' \( name) ') "
71+ case . frameworkSearchPathIncludesExtension( let arg) :
72+ return " framework search path ends in \" .framework \" ; add directory containing framework instead: \( arg) "
6473 // Explicit Module Build Failures
6574 case . malformedModuleDependency( let moduleName, let errorDescription) :
6675 return " Malformed Module Dependency: \( moduleName) , \( errorDescription) "
@@ -74,12 +83,6 @@ public struct Driver {
7483 return " unable to load output file map ' \( path) ': no such file or directory "
7584 case . missingExternalDependency( let moduleName) :
7685 return " Missing External dependency info for module: \( moduleName) "
77- case . cannotAssignToConditionalCompilationFlag( let name) :
78- return " conditional compilation flags do not have values in Swift; they are either present or absent (rather than ' \( name) ') "
79- case . conditionalCompilationFlagHasRedundantPrefix( let name) :
80- return " invalid argument '-D \( name) '; did you provide a redundant '-D' in your build settings? "
81- case . conditionalCompilationFlagIsNotValidIdentifier( let name) :
82- return " conditional compilation flags must be valid Swift identifiers (rather than ' \( name) ') "
8386 }
8487 }
8588 }
@@ -344,6 +347,7 @@ public struct Driver {
344347 fileSystem: fileSystem,
345348 workingDirectory: workingDirectory)
346349 try Self . validateCompilationConditionArgs ( & parsedOptions)
350+ try Self . validateFrameworkSearchPathArgs ( & parsedOptions)
347351 Self . validateCoverageArgs ( & parsedOptions, diagnosticsEngine: diagnosticEngine)
348352 try toolchain. validateArgs ( & parsedOptions,
349353 targetTriple: self . frontendTargetInfo. target. triple,
@@ -1614,6 +1618,14 @@ extension Driver {
16141618 }
16151619 }
16161620
1621+ static func validateFrameworkSearchPathArgs( _ parsedOptions: inout ParsedOptions ) throws {
1622+ for arg in parsedOptions. arguments ( for: . F, . Fsystem) . map ( \. argument. asSingle) {
1623+ if arg. hasSuffix ( " .framework " ) || arg. hasSuffix ( " .framework/ " ) {
1624+ throw Error . frameworkSearchPathIncludesExtension ( arg)
1625+ }
1626+ }
1627+ }
1628+
16171629 private static func validateCoverageArgs( _ parsedOptions: inout ParsedOptions , diagnosticsEngine: DiagnosticsEngine ) {
16181630 for coveragePrefixMap in parsedOptions. arguments ( for: . coveragePrefixMap) {
16191631 let value = coveragePrefixMap. argument. asSingle
0 commit comments