Skip to content

Commit c5c10de

Browse files
authored
Merge pull request #744 from apple/revert-721-api-digester-integration
Revert "Add an integration with swift-api-digester"
2 parents 4f4e853 + 8019202 commit c5c10de

15 files changed

+11
-724
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/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ add_library(SwiftDriver
5555
"IncrementalCompilation/SourceFileDependencyGraph.swift"
5656
"IncrementalCompilation/TwoDMap.swift"
5757

58-
Jobs/APIDigesterJobs.swift
5958
Jobs/AutolinkExtractJob.swift
6059
Jobs/BackendJob.swift
6160
Jobs/CommandLineArguments.swift

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public struct Driver {
3434
case missingProfilingData(String)
3535
case conditionalCompilationFlagHasRedundantPrefix(String)
3636
case conditionalCompilationFlagIsNotValidIdentifier(String)
37-
case baselineGenerationRequiresTopLevelModule(String)
38-
case optionRequiresAnother(String, String)
3937
// Explicit Module Build Failures
4038
case malformedModuleDependency(String, String)
4139
case missingPCMArguments(String)
@@ -102,10 +100,6 @@ public struct Driver {
102100
return "unable to load output file map '\(path)': no such file or directory"
103101
case .missingExternalDependency(let moduleName):
104102
return "Missing External dependency info for module: \(moduleName)"
105-
case .baselineGenerationRequiresTopLevelModule(let arg):
106-
return "generating a baseline with '\(arg)' is only supported with '-emit-module' or '-emit-module-path'"
107-
case .optionRequiresAnother(let first, let second):
108-
return "'\(first)' cannot be specified if '\(second)' is not present"
109103
}
110104
}
111105
}
@@ -294,12 +288,6 @@ public struct Driver {
294288
/// Path to the Swift module source information file.
295289
let moduleSourceInfoPath: VirtualPath.Handle?
296290

297-
/// Path to the module's digester baseline file.
298-
let digesterBaselinePath: VirtualPath.Handle?
299-
300-
/// The mode the API digester should run in.
301-
let digesterMode: DigesterMode
302-
303291
/// Force the driver to emit the module first and then run compile jobs. This could be used to unblock
304292
/// dependencies in parallel builds.
305293
var forceEmitModuleBeforeCompile: Bool = false
@@ -547,16 +535,6 @@ public struct Driver {
547535
self.numThreads = Self.determineNumThreads(&parsedOptions, compilerMode: compilerMode, diagnosticsEngine: diagnosticEngine)
548536
self.numParallelJobs = Self.determineNumParallelJobs(&parsedOptions, diagnosticsEngine: diagnosticEngine, env: env)
549537

550-
var mode = DigesterMode.api
551-
if let modeArg = parsedOptions.getLastArgument(.digesterMode)?.asSingle {
552-
if let digesterMode = DigesterMode(rawValue: modeArg) {
553-
mode = digesterMode
554-
} else {
555-
diagnosticsEngine.emit(Error.invalidArgumentValue(Option.digesterMode.spelling, modeArg))
556-
}
557-
}
558-
self.digesterMode = mode
559-
560538
Self.validateWarningControlArgs(&parsedOptions, diagnosticEngine: diagnosticEngine)
561539
Self.validateProfilingArgs(&parsedOptions,
562540
fileSystem: fileSystem,
@@ -609,7 +587,7 @@ public struct Driver {
609587
diagnosticEngine: diagnosticEngine,
610588
toolchain: toolchain,
611589
targetInfo: frontendTargetInfo)
612-
590+
613591
Self.validateSanitizerAddressUseOdrIndicatorFlag(&parsedOptions, diagnosticEngine: diagnosticsEngine, addressSanitizerEnabled: enabledSanitizers.contains(.address))
614592

615593
Self.validateSanitizerRecoverArgValues(&parsedOptions, diagnosticEngine: diagnosticsEngine, enabledSanitizers: enabledSanitizers)
@@ -685,15 +663,6 @@ public struct Driver {
685663
outputFileMap: self.outputFileMap,
686664
moduleName: moduleOutputInfo.name,
687665
projectDirectory: projectDirectory)
688-
self.digesterBaselinePath = try Self.computeDigesterBaselineOutputPath(
689-
&parsedOptions,
690-
moduleOutputPath: self.moduleOutputInfo.output?.outputPath,
691-
mode: self.digesterMode,
692-
compilerOutputType: compilerOutputType,
693-
compilerMode: compilerMode,
694-
outputFileMap: self.outputFileMap,
695-
moduleName: moduleOutputInfo.name,
696-
projectDirectory: projectDirectory)
697666
self.swiftInterfacePath = try Self.computeSupplementaryOutputPath(
698667
&parsedOptions, type: .swiftInterface, isOutputOptions: [.emitModuleInterface],
699668
outputPath: .emitModuleInterfacePath,
@@ -731,12 +700,6 @@ public struct Driver {
731700
outputFileMap: self.outputFileMap,
732701
moduleName: moduleOutputInfo.name)
733702

734-
Self.validateDigesterArgs(&parsedOptions,
735-
moduleOutputInfo: moduleOutputInfo,
736-
digesterMode: self.digesterMode,
737-
swiftInterfacePath: self.swiftInterfacePath,
738-
diagnosticEngine: diagnosticsEngine)
739-
740703
try verifyOutputOptions()
741704
}
742705

@@ -2233,36 +2196,6 @@ extension Driver {
22332196
}
22342197
}
22352198

2236-
static func validateDigesterArgs(_ parsedOptions: inout ParsedOptions,
2237-
moduleOutputInfo: ModuleOutputInfo,
2238-
digesterMode: DigesterMode,
2239-
swiftInterfacePath: VirtualPath.Handle?,
2240-
diagnosticEngine: DiagnosticsEngine) {
2241-
if moduleOutputInfo.output?.isTopLevel != true {
2242-
for arg in parsedOptions.arguments(for: .emitDigesterBaseline, .emitDigesterBaselinePath, .compareToBaselinePath) {
2243-
diagnosticEngine.emit(Error.baselineGenerationRequiresTopLevelModule(arg.option.spelling))
2244-
}
2245-
}
2246-
2247-
if parsedOptions.hasArgument(.serializeBreakingChangesPath) && !parsedOptions.hasArgument(.compareToBaselinePath) {
2248-
diagnosticEngine.emit(Error.optionRequiresAnother(Option.serializeBreakingChangesPath.spelling,
2249-
Option.compareToBaselinePath.spelling))
2250-
}
2251-
if parsedOptions.hasArgument(.digesterBreakageAllowlistPath) && !parsedOptions.hasArgument(.compareToBaselinePath) {
2252-
diagnosticEngine.emit(Error.optionRequiresAnother(Option.digesterBreakageAllowlistPath.spelling,
2253-
Option.compareToBaselinePath.spelling))
2254-
}
2255-
if digesterMode == .abi && !parsedOptions.hasArgument(.enableLibraryEvolution) {
2256-
diagnosticEngine.emit(Error.optionRequiresAnother("\(Option.digesterMode.spelling) abi",
2257-
Option.enableLibraryEvolution.spelling))
2258-
}
2259-
if digesterMode == .abi && swiftInterfacePath == nil {
2260-
diagnosticEngine.emit(Error.optionRequiresAnother("\(Option.digesterMode.spelling) abi",
2261-
Option.emitModuleInterface.spelling))
2262-
}
2263-
}
2264-
2265-
22662199
static func validateProfilingArgs(_ parsedOptions: inout ParsedOptions,
22672200
fileSystem: FileSystem,
22682201
workingDirectory: AbsolutePath?,
@@ -2717,31 +2650,6 @@ extension Driver {
27172650
projectDirectory: projectDirectory)
27182651
}
27192652

2720-
static func computeDigesterBaselineOutputPath(
2721-
_ parsedOptions: inout ParsedOptions,
2722-
moduleOutputPath: VirtualPath.Handle?,
2723-
mode: DigesterMode,
2724-
compilerOutputType: FileType?,
2725-
compilerMode: CompilerMode,
2726-
outputFileMap: OutputFileMap?,
2727-
moduleName: String,
2728-
projectDirectory: VirtualPath.Handle?
2729-
) throws -> VirtualPath.Handle? {
2730-
// Only emit a baseline if at least of the arguments was provided.
2731-
guard parsedOptions.hasArgument(.emitDigesterBaseline, .emitDigesterBaselinePath) else { return nil }
2732-
return try computeModuleAuxiliaryOutputPath(&parsedOptions,
2733-
moduleOutputPath: moduleOutputPath,
2734-
type: mode.baselineFileType,
2735-
isOutput: .emitDigesterBaseline,
2736-
outputPath: .emitDigesterBaselinePath,
2737-
compilerOutputType: compilerOutputType,
2738-
compilerMode: compilerMode,
2739-
outputFileMap: outputFileMap,
2740-
moduleName: moduleName,
2741-
projectDirectory: projectDirectory)
2742-
}
2743-
2744-
27452653

27462654
/// Determine the output path for a module auxiliary output.
27472655
static func computeModuleAuxiliaryOutputPath(

Sources/SwiftDriver/Driver/OutputFileMap.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ public struct OutputFileMap: Hashable, Codable {
5454
}
5555
return VirtualPath.lookup(path).replacingExtension(with: outputType).intern()
5656

57-
case .jsonAPIBaseline, .jsonABIBaseline:
58-
// Infer paths for these entities using .swiftsourceinfo path.
59-
guard let path = entries[inputFile]?[.swiftSourceInfoFile] else {
60-
return nil
61-
}
62-
return VirtualPath.lookup(path).replacingExtension(with: outputType).intern()
63-
6457
case .object:
6558
// We may generate .o files from bitcode .bc files, but the output file map
6659
// uses .swift file as the key for .o file paths. So we need to dig further.

Sources/SwiftDriver/Jobs/APIDigesterJobs.swift

Lines changed: 0 additions & 152 deletions
This file was deleted.

Sources/SwiftDriver/Jobs/CompileJob.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extension Driver {
9393
.privateSwiftInterface, .swiftSourceInfoFile, .diagnostics, .objcHeader, .swiftDeps,
9494
.remap, .tbd, .moduleTrace, .yamlOptimizationRecord, .bitstreamOptimizationRecord, .pcm,
9595
.pch, .clangModuleMap, .jsonCompilerFeatures, .jsonTargetInfo, .jsonSwiftArtifacts,
96-
.indexUnitOutputPath, .modDepCache, .jsonAPIBaseline, .jsonABIBaseline, nil:
96+
.indexUnitOutputPath, .modDepCache, nil:
9797
return false
9898
}
9999
}
@@ -444,7 +444,7 @@ extension FileType {
444444
.diagnostics, .objcHeader, .image, .swiftDeps, .moduleTrace, .tbd,
445445
.yamlOptimizationRecord, .bitstreamOptimizationRecord, .swiftInterface,
446446
.privateSwiftInterface, .swiftSourceInfoFile, .clangModuleMap, .jsonSwiftArtifacts,
447-
.indexUnitOutputPath, .modDepCache, .jsonAPIBaseline, .jsonABIBaseline:
447+
.indexUnitOutputPath, .modDepCache:
448448
fatalError("Output type can never be a primary output")
449449
}
450450
}

0 commit comments

Comments
 (0)