Skip to content

Commit e2dadc8

Browse files
authored
Merge pull request #137 from owenv/more-module-paths
More module output path fixes
2 parents ea38f11 + dbeff3f commit e2dadc8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,10 @@ extension Driver {
13741374
} else if moduleOutputKind == .topLevel {
13751375
// FIXME: Logic to infer from primary outputs, etc.
13761376
let moduleFilename = moduleName.appendingFileTypeExtension(.swiftModule)
1377-
if let outputArg = parsedOptions.getLastArgument(.o)?.asSingle, let lastSeparatorIndex = outputArg.lastIndex(of: "/") {
1377+
if let outputArg = parsedOptions.getLastArgument(.o)?.asSingle, compilerOutputType == .swiftModule {
1378+
// If the module is the primary output, match -o exactly if present.
1379+
moduleOutputPath = try .init(path: outputArg)
1380+
} else if let outputArg = parsedOptions.getLastArgument(.o)?.asSingle, let lastSeparatorIndex = outputArg.lastIndex(of: "/") {
13781381
// Put the module next to the top-level output.
13791382
moduleOutputPath = try .init(path: outputArg[outputArg.startIndex...lastSeparatorIndex] + moduleFilename)
13801383
} else {

0 commit comments

Comments
 (0)