Skip to content

Remove deprecated 'externalTargetModulePathMap' #1206

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 1 commit into from
Oct 19, 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
19 changes: 1 addition & 18 deletions Sources/SwiftDriver/Driver/Driver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public struct Driver {
case invalidArgumentValue(String, String)
case relativeFrontendPath(String)
case subcommandPassedToDriver
case externalTargetDetailsAPIError
case integratedReplRemoved
case cannotSpecify_OForMultipleOutputs
case conflictingOptions(Option, Option)
Expand Down Expand Up @@ -78,8 +77,6 @@ public struct Driver {
return "relative frontend path: \(path)"
case .subcommandPassedToDriver:
return "subcommand passed to driver"
case .externalTargetDetailsAPIError:
return "Cannot specify both: externalTargetModulePathMap and externalTargetModuleDetailsMap"
case .integratedReplRemoved:
return "Compiler-internal integrated REPL has been removed; use the LLDB-enhanced REPL instead."
case .cannotSpecify_OForMultipleOutputs:
Expand Down Expand Up @@ -467,8 +464,6 @@ public struct Driver {
/// an executable or as a library.
/// - Parameter compilerExecutableDir: Directory that contains the compiler executable to be used.
/// Used when in `integratedDriver` mode as a substitute for the driver knowing its executable path.
/// - Parameter externalTargetModulePathMap: DEPRECATED: A dictionary of external targets
/// that are a part of the same build, mapping to filesystem paths of their module files.
/// - Parameter externalTargetModuleDetailsMap: A dictionary of external targets that are a part of
/// the same build, mapping to a details value which includes a filesystem path of their
/// `.swiftmodule` and a flag indicating whether the external target is a framework.
Expand All @@ -482,8 +477,6 @@ public struct Driver {
executor: DriverExecutor,
integratedDriver: Bool = true,
compilerExecutableDir: AbsolutePath? = nil,
// Deprecated in favour of the below `externalTargetModuleDetailsMap`
externalTargetModulePathMap: ExternalTargetModulePathMap? = nil,
externalTargetModuleDetailsMap: ExternalTargetModuleDetailsMap? = nil,
interModuleDependencyOracle: InterModuleDependencyOracle? = nil
) throws {
Expand All @@ -493,17 +486,7 @@ public struct Driver {

self.diagnosticEngine = diagnosticsEngine
self.executor = executor

if externalTargetModulePathMap != nil && externalTargetModuleDetailsMap != nil {
throw Error.externalTargetDetailsAPIError
}
if let externalTargetPaths = externalTargetModulePathMap {
self.externalTargetModuleDetailsMap = externalTargetPaths.mapValues {
ExternalTargetModuleDetails(path: $0, isFramework: false)
}
} else if let externalTargetDetails = externalTargetModuleDetailsMap {
self.externalTargetModuleDetailsMap = externalTargetDetails
}
self.externalTargetModuleDetailsMap = externalTargetModuleDetailsMap

if case .subcommand = try Self.invocationRunMode(forArgs: args).mode {
throw Error.subcommandPassedToDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import struct TSCBasic.AbsolutePath
import struct Foundation.Data
import class Foundation.JSONEncoder

/// A map from a module identifier to a path to its .swiftmodule file.
/// Deprecated in favour of the below `ExternalTargetModuleDetails`
public typealias ExternalTargetModulePathMap = [ModuleDependencyId: AbsolutePath]

/// Details about an external target, including the path to its .swiftmodule file
/// and whether it is a framework.
public struct ExternalTargetModuleDetails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public extension Driver {
// FIXME: MSVC runtime flags

// Pass in external target dependencies to be treated as placeholder dependencies by the scanner
if let externalTargetPaths = externalTargetModuleDetailsMap?.mapValues({ $0.path }) {
if let externalTargetDetailsMap = externalTargetModuleDetailsMap {
let dependencyPlaceholderMapFile =
try serializeExternalDependencyArtifacts(externalTargetPaths: externalTargetPaths)
try serializeExternalDependencyArtifacts(externalTargetDependencyDetails: externalTargetDetailsMap)
commandLine.appendFlag("-placeholder-dependency-module-map-file")
commandLine.appendPath(dependencyPlaceholderMapFile)
}
Expand All @@ -87,12 +87,12 @@ public extension Driver {
}

/// Serialize a map of placeholder (external) dependencies for the dependency scanner.
private func serializeExternalDependencyArtifacts(externalTargetPaths: ExternalTargetModulePathMap)
private func serializeExternalDependencyArtifacts(externalTargetDependencyDetails: ExternalTargetModuleDetailsMap)
throws -> VirtualPath {
var placeholderArtifacts: [SwiftModuleArtifactInfo] = []
// Explicit external targets
for (moduleId, binaryModulePath) in externalTargetPaths {
let modPath = TextualVirtualPath(path: VirtualPath.absolute(binaryModulePath).intern())
for (moduleId, dependencyDetails) in externalTargetDependencyDetails {
let modPath = TextualVirtualPath(path: VirtualPath.absolute(dependencyDetails.path).intern())
placeholderArtifacts.append(
SwiftModuleArtifactInfo(name: moduleId.moduleName,
modulePath: modPath))
Expand All @@ -102,7 +102,7 @@ public extension Driver {
let contents = try encoder.encode(placeholderArtifacts)
return VirtualPath.createUniqueTemporaryFileWithKnownContents(.init("\(moduleOutputInfo.name)-external-modules.json"),
contents)
}
}

/// Returns false if the lib is available and ready to use
private func initSwiftScanLib() throws -> Bool {
Expand Down