Skip to content

Commit 1f2f5e9

Browse files
authored
Merge pull request #1154 from artemcm/ExplicitInterfaceBuild
[Explicit Modules] Pass '-explicit-interface-module-build' to interface build jobs.
2 parents 1401f93 + 84bc1d7 commit 1f2f5e9

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
5050
/// We avoid re-running the hash computation with the use of this cache
5151
private var hashedModuleNameCache: [String: String] = [:]
5252

53+
/// Does this compile support `.explicitInterfaceModuleBuild`
54+
private var supportsExplicitInterfaceBuild: Bool
55+
5356
public init(dependencyGraph: InterModuleDependencyGraph,
5457
toolchain: Toolchain,
55-
integratedDriver: Bool = true) throws {
58+
integratedDriver: Bool = true,
59+
supportsExplicitInterfaceBuild: Bool = false) throws {
5660
self.dependencyGraph = dependencyGraph
5761
self.toolchain = toolchain
5862
self.integratedDriver = integratedDriver
5963
self.mainModuleName = dependencyGraph.mainModuleName
6064
self.reachabilityMap = try dependencyGraph.computeTransitiveClosure()
65+
self.supportsExplicitInterfaceBuild = supportsExplicitInterfaceBuild
6166
}
6267

6368
/// Generate build jobs for all dependencies of the main module.
@@ -165,6 +170,12 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
165170
}
166171
}
167172

173+
if supportsExplicitInterfaceBuild {
174+
// Ensure the compiler flags specified in the interface are ignored
175+
// because they are already captured in the dependency scanner output
176+
commandLine.appendFlag(.explicitInterfaceModuleBuild)
177+
}
178+
168179
// Set the output path
169180
commandLine.appendFlag(.o)
170181
commandLine.appendPath(VirtualPath.lookup(moduleInfo.modulePath.path))

Sources/SwiftDriver/Jobs/Planning.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,9 @@ extension Driver {
626626
explicitDependencyBuildPlanner =
627627
try ExplicitDependencyBuildPlanner(dependencyGraph: dependencyGraph,
628628
toolchain: toolchain,
629-
integratedDriver: integratedDriver)
629+
integratedDriver: integratedDriver,
630+
supportsExplicitInterfaceBuild:
631+
isFrontendArgSupported(.explicitInterfaceModuleBuild))
630632

631633
return try explicitDependencyBuildPlanner!.generateExplicitModuleDependenciesBuildJobs()
632634
}

0 commit comments

Comments
 (0)