Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Sources/SwiftDriver/Jobs/Planning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ extension Driver {
IncrementalCompilationState.InitialStateForPlanning?)
throws -> InterModuleDependencyGraph? {
let interModuleDependencyGraph: InterModuleDependencyGraph?
if parsedOptions.contains(.driverExplicitModuleBuild) ||
parsedOptions.contains(.explainModuleDependency) {
if (parsedOptions.contains(.driverExplicitModuleBuild) ||
parsedOptions.contains(.explainModuleDependency)) &&
inputFiles.contains(where: { $0.type.isPartOfSwiftCompilation }) {
// If the incremental build record's module dependency graph is up-to-date, we
// can skip dependency scanning entirely.
interModuleDependencyGraph =
Expand Down
9 changes: 9 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2906,6 +2906,15 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertEqual(firstKey, "foo.swift")
}

func testExplicitBuildWithJustObjectInputs() throws {
var driver = try Driver(args: [
"swiftc", "-explicit-module-build", "foo.o", "bar.o"
])
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(plannedJobs.count, 1)
XCTAssertEqual(plannedJobs.first?.kind, .link)
}

func testWMOWithNonSourceInputFirstAndModuleOutput() throws {
var driver1 = try Driver(args: [
"swiftc", "-wmo", "danger.o", "foo.swift", "bar.swift", "wibble.swift", "-module-name", "Test",
Expand Down