Skip to content

Revert "[Explicit Module Builds] Enable incremental dependency scanning" #471

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
May 1, 2025
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
2 changes: 0 additions & 2 deletions Sources/SWBCore/Settings/BuiltinMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,6 @@ public final class BuiltinMacros {
public static let SWIFT_EMIT_MODULE_INTERFACE = BuiltinMacros.declareBooleanMacro("SWIFT_EMIT_MODULE_INTERFACE")
public static let SWIFT_ENABLE_BATCH_MODE = BuiltinMacros.declareBooleanMacro("SWIFT_ENABLE_BATCH_MODE")
public static let SWIFT_ENABLE_INCREMENTAL_COMPILATION = BuiltinMacros.declareBooleanMacro("SWIFT_ENABLE_INCREMENTAL_COMPILATION")
public static let SWIFT_DISABLE_INCREMENTAL_SCAN = BuiltinMacros.declareBooleanMacro("SWIFT_DISABLE_INCREMENTAL_SCAN")
public static let SWIFT_ENABLE_LAYOUT_STRING_VALUE_WITNESSES = BuiltinMacros.declareBooleanMacro("SWIFT_ENABLE_LAYOUT_STRING_VALUE_WITNESSES")
public static let SWIFT_ENABLE_LIBRARY_EVOLUTION = BuiltinMacros.declareBooleanMacro("SWIFT_ENABLE_LIBRARY_EVOLUTION")
public static let SWIFT_ENABLE_BARE_SLASH_REGEX = BuiltinMacros.declareBooleanMacro("SWIFT_ENABLE_BARE_SLASH_REGEX")
Expand Down Expand Up @@ -2165,7 +2164,6 @@ public final class BuiltinMacros {
SWIFT_EMIT_MODULE_INTERFACE,
SWIFT_ENABLE_BATCH_MODE,
SWIFT_ENABLE_INCREMENTAL_COMPILATION,
SWIFT_DISABLE_INCREMENTAL_SCAN,
SWIFT_ENABLE_LAYOUT_STRING_VALUE_WITNESSES,
SWIFT_ENABLE_LIBRARY_EVOLUTION,
SWIFT_USE_INTEGRATED_DRIVER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public struct SwiftSourceFileIndexingInfo: SourceFileIndexingInfo {
"-emit-dependencies",
"-serialize-diagnostics",
"-incremental",
"-incremental-dependency-scan",
"-parseable-output",
"-use-frontend-parseable-output",
"-whole-module-optimization",
Expand Down Expand Up @@ -154,7 +153,6 @@ public struct SwiftSourceFileIndexingInfo: SourceFileIndexingInfo {
// can be removed after we use the new driver instead (rdar://75851402).
private static let newDriverFlags: Set<ByteString> = [
"-driver-print-graphviz",
"-incremental-dependency-scan",
"-explicit-module-build",
"-experimental-explicit-module-build",
"-nonlib-dependency-scanner",
Expand Down Expand Up @@ -1745,10 +1743,6 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi

if cbc.scope.evaluate(BuiltinMacros.SWIFT_ENABLE_INCREMENTAL_COMPILATION) {
args.append("-incremental")
if LibSwiftDriver.supportsDriverFlag(spelled: "-incremental-dependency-scan"),
!cbc.scope.evaluate(BuiltinMacros.SWIFT_DISABLE_INCREMENTAL_SCAN) {
args.append("-incremental-dependency-scan")
}
}
}

Expand Down Expand Up @@ -3291,8 +3285,6 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
for arg in [
// Should strip this because it saves some work and avoids writing a useless incremental build record
"-incremental",
// Same as above
"-incremental-dependency-scan",

// Stripped because we want to end up in single file mode
"-enable-batch-mode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ fileprivate struct PreviewsBuildOperationTests: CoreBasedTests {
"ENABLE_PREVIEWS": "YES",
"CLANG_ENABLE_MODULES": "YES",
"SDK_STAT_CACHE_ENABLE": "NO",
"SWIFT_DISABLE_INCREMENTAL_SCAN": "YES",

"SWIFT_ENABLE_EXPLICIT_MODULES": explicitModules ? "YES" : "NO",

Expand Down
1 change: 0 additions & 1 deletion Tests/SWBBuildSystemTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3616,7 +3616,6 @@ fileprivate struct SwiftDriverTests: CoreBasedTests {
"ENABLE_PREVIEWS": "YES",
"SWIFT_USE_INTEGRATED_DRIVER": useIntegratedDriver ? "YES" : "NO",
"SWIFT_ENABLE_EXPLICIT_MODULES": useIntegratedDriver ? "YES" : "NO",
"SWIFT_DISABLE_INCREMENTAL_SCAN": "YES",
"_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES": useIntegratedDriver ? "YES" : "NO",
// Eager linking is not supported when using the driver binary.
"EAGER_LINKING": "NO",
Expand Down
60 changes: 0 additions & 60 deletions Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
"SWIFT_PACKAGE_NAME": "FooPkg",
"SWIFT_EMIT_MODULE_INTERFACE": "YES",
"SWIFT_ENABLE_EXPLICIT_MODULES": "YES",
"SWIFT_DISABLE_INCREMENTAL_SCAN": "YES",
]),
],
buildPhases: [
Expand Down Expand Up @@ -832,7 +831,6 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
"DEFINES_MODULE": "YES",
"SWIFT_VERSION": swiftVersion,
"SWIFT_EMIT_MODULE_INTERFACE": "YES",
"SWIFT_DISABLE_INCREMENTAL_SCAN": "YES",
]),
],
buildPhases: [
Expand Down Expand Up @@ -1537,64 +1535,6 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
}
}

@Test(.requireSDKs(.macOS), .enabled(if: LibSwiftDriver.supportsDriverFlag(spelled: "-incremental-dependency-scan")))
func optOutIncrementalScanning() async throws {
let testProject = try await TestProject(
"aProject",
groupTree: TestGroup(
"SomeFiles", path: "Sources",
children: [
TestFile("main.swift"),
]),
buildConfigurations: [
TestBuildConfiguration(
"Debug",
buildSettings: [
"PRODUCT_NAME": "$(TARGET_NAME)",
"SWIFT_ENABLE_EXPLICIT_MODULES": "YES",
]),
],
targets: [
TestStandardTarget(
"Exec", type: .commandLineTool,
buildConfigurations: [
TestBuildConfiguration("Debug",
buildSettings: [
"SWIFT_EXEC": swiftCompilerPath.str,
"SWIFT_VERSION": swiftVersion,
]),
],
buildPhases: [
TestSourcesBuildPhase([
"main.swift",
]),
])
])
let tester = try await TaskConstructionTester(getCore(), testProject)

await tester.checkBuild(runDestination: .macOS) { results in
results.checkTarget("Exec") { target in
results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in
task.checkCommandLineContains(["-explicit-module-build"])
task.checkCommandLineContains(["-incremental"])
task.checkCommandLineContains(["-incremental-dependency-scan"])
}
}
results.checkNoDiagnostics()
}

await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: ["SWIFT_DISABLE_INCREMENTAL_SCAN": "YES"]), runDestination: .macOS) { results in
results.checkTarget("Exec") { target in
results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in
task.checkCommandLineContains(["-explicit-module-build"])
task.checkCommandLineContains(["-incremental"])
task.checkCommandLineDoesNotContain("-incremental-dependency-scan")
}
}
results.checkNoDiagnostics()
}
}

@Test(.requireSDKs(.macOS))
func swift4DisablesExplicitModules() async throws {
let testProject = try await TestProject(
Expand Down