Skip to content

[Explicit Modules] Pass '-explicit-interface-module-build' to interface build jobs. #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 17, 2022
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
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
/// We avoid re-running the hash computation with the use of this cache
private var hashedModuleNameCache: [String: String] = [:]

/// Does this compile support `.explicitInterfaceModuleBuild`
private var supportsExplicitInterfaceBuild: Bool

public init(dependencyGraph: InterModuleDependencyGraph,
toolchain: Toolchain,
integratedDriver: Bool = true) throws {
integratedDriver: Bool = true,
supportsExplicitInterfaceBuild: Bool = false) throws {
self.dependencyGraph = dependencyGraph
self.toolchain = toolchain
self.integratedDriver = integratedDriver
self.mainModuleName = dependencyGraph.mainModuleName
self.reachabilityMap = try dependencyGraph.computeTransitiveClosure()
self.supportsExplicitInterfaceBuild = supportsExplicitInterfaceBuild
}

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

if supportsExplicitInterfaceBuild {
// Ensure the compiler flags specified in the interface are ignored
// because they are already captured in the dependency scanner output
commandLine.appendFlag(.explicitInterfaceModuleBuild)
}

// Set the output path
commandLine.appendFlag(.o)
commandLine.appendPath(VirtualPath.lookup(moduleInfo.modulePath.path))
Expand Down
4 changes: 3 additions & 1 deletion Sources/SwiftDriver/Jobs/Planning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,9 @@ extension Driver {
explicitDependencyBuildPlanner =
try ExplicitDependencyBuildPlanner(dependencyGraph: dependencyGraph,
toolchain: toolchain,
integratedDriver: integratedDriver)
integratedDriver: integratedDriver,
supportsExplicitInterfaceBuild:
isFrontendArgSupported(.explicitInterfaceModuleBuild))

return try explicitDependencyBuildPlanner!.generateExplicitModuleDependenciesBuildJobs()
}
Expand Down
Loading