Skip to content

Commit 2f3a47a

Browse files
Merge pull request #708 from swiftlang/automerge/merge-main-2025-08-05_21-49
Merge `release/6.2` into `main`
2 parents 7bdc275 + 4276b23 commit 2f3a47a

File tree

9 files changed

+43
-13
lines changed

9 files changed

+43
-13
lines changed

Sources/SWBCore/Settings/BuiltinMacros.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ public final class BuiltinMacros {
506506
public static let CLANG_ENABLE_EXPLICIT_MODULES_WITH_COMPILER_LAUNCHER = BuiltinMacros.declareBooleanMacro("CLANG_ENABLE_EXPLICIT_MODULES_WITH_COMPILER_LAUNCHER")
507507
public static let CLANG_EXPLICIT_MODULES_LIBCLANG_PATH = BuiltinMacros.declareStringMacro("CLANG_EXPLICIT_MODULES_LIBCLANG_PATH")
508508
public static let CLANG_EXPLICIT_MODULES_IGNORE_LIBCLANG_VERSION_MISMATCH = BuiltinMacros.declareBooleanMacro("CLANG_EXPLICIT_MODULES_IGNORE_LIBCLANG_VERSION_MISMATCH")
509-
public static let CLANG_EXPLICIT_MODULES_OUTPUT_PATH = BuiltinMacros.declareStringMacro("CLANG_EXPLICIT_MODULES_OUTPUT_PATH")
510-
public static let SWIFT_EXPLICIT_MODULES_OUTPUT_PATH = BuiltinMacros.declareStringMacro("SWIFT_EXPLICIT_MODULES_OUTPUT_PATH")
509+
public static let CLANG_EXPLICIT_MODULES_OUTPUT_PATH = BuiltinMacros.declarePathMacro("CLANG_EXPLICIT_MODULES_OUTPUT_PATH")
510+
public static let SWIFT_EXPLICIT_MODULES_OUTPUT_PATH = BuiltinMacros.declarePathMacro("SWIFT_EXPLICIT_MODULES_OUTPUT_PATH")
511511
public static let CLANG_ENABLE_COMPILE_CACHE = BuiltinMacros.declareBooleanMacro("CLANG_ENABLE_COMPILE_CACHE")
512512
public static let CLANG_CACHE_FINE_GRAINED_OUTPUTS = BuiltinMacros.declareEnumMacro("CLANG_CACHE_FINE_GRAINED_OUTPUTS") as EnumMacroDeclaration<FineGrainedCachingSetting>
513513
public static let CLANG_CACHE_FINE_GRAINED_OUTPUTS_VERIFICATION = BuiltinMacros.declareEnumMacro("CLANG_CACHE_FINE_GRAINED_OUTPUTS_VERIFICATION") as EnumMacroDeclaration<FineGrainedCachingVerificationSetting>

Sources/SWBCore/SpecImplementations/Tools/CCompiler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
988988
usesCompilerLauncher: usesCompilerLauncher,
989989
// This path is scoped to the project, so ideally different targets that use the same modules would
990990
// share precompiled modules.
991-
outputPath: Path(cbc.scope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH)),
991+
outputPath: cbc.scope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH),
992992
scanningOutputPath: scanningOutputPath,
993993
casOptions: casOptions,
994994
cacheFallbackIfNotAvailable: cbc.scope.evaluate(BuiltinMacros.CLANG_CACHE_FALLBACK_IF_UNAVAILABLE),

Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
18221822
// Instructs the driver to perform build planning with explicit module builds
18231823
if explicitModuleBuildEnabled {
18241824
args.append("-explicit-module-build")
1825-
let explicitDependencyOutputPath = Path(cbc.scope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH))
1825+
let explicitDependencyOutputPath = cbc.scope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH)
18261826
args.append(contentsOf: ["-module-cache-path", explicitDependencyOutputPath.str])
18271827
let moduleCacheDir = cbc.scope.evaluate(BuiltinMacros.MODULE_CACHE_DIR)
18281828
if LibSwiftDriver.supportsDriverFlag(spelled: "-clang-scanner-module-cache-path"),
@@ -2334,7 +2334,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
23342334
previewPayload: previewPayload,
23352335
localizationPayload: localizationPayload,
23362336
numExpectedCompileSubtasks: isUsingWholeModuleOptimization ? 1 : cbc.inputs.count,
2337-
driverPayload: await driverPayload(uniqueID: String(args.hashValue), scope: cbc.scope, delegate: delegate, compilationMode: compilationMode, isUsingWholeModuleOptimization: isUsingWholeModuleOptimization, args: args, tempDirPath: objectFileDir, explicitModulesTempDirPath: Path(cbc.scope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH)), variant: variant, arch: arch + compilationMode.moduleBaseNameSuffix, commandLine: ["builtin-SwiftDriver", "--"] + args, ruleInfo: ruleInfo(compilationMode.ruleNameIntegratedDriver, targetName), casOptions: casOptions, linkerResponseFilePath: moduleLinkerArgsPath),
2337+
driverPayload: await driverPayload(uniqueID: String(args.hashValue), scope: cbc.scope, delegate: delegate, compilationMode: compilationMode, isUsingWholeModuleOptimization: isUsingWholeModuleOptimization, args: args, tempDirPath: objectFileDir, explicitModulesTempDirPath: cbc.scope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH), variant: variant, arch: arch + compilationMode.moduleBaseNameSuffix, commandLine: ["builtin-SwiftDriver", "--"] + args, ruleInfo: ruleInfo(compilationMode.ruleNameIntegratedDriver, targetName), casOptions: casOptions, linkerResponseFilePath: moduleLinkerArgsPath),
23382338
previewStyle: cbc.scope.previewStyle,
23392339
dependencyValidationPayload: dependencyValidationPayload
23402340
)

Sources/SWBCore/WorkspaceContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public final class WorkspaceContext: Sendable {
352352
private let headerIndexCache = AsyncSingleValueCache<WorkspaceHeaderIndex, Never>()
353353

354354
public var buildDirectoryMacros: [PathMacroDeclaration] {
355-
return [BuiltinMacros.DSTROOT, BuiltinMacros.OBJROOT, BuiltinMacros.SYMROOT, BuiltinMacros.BUILT_PRODUCTS_DIR, BuiltinMacros.EAGER_LINKING_INTERMEDIATE_TBD_DIR]
355+
return [BuiltinMacros.DSTROOT, BuiltinMacros.OBJROOT, BuiltinMacros.SYMROOT, BuiltinMacros.BUILT_PRODUCTS_DIR, BuiltinMacros.EAGER_LINKING_INTERMEDIATE_TBD_DIR, BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH, BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH]
356356
}
357357

358358
/// The path to the module session file for the workspace given a set of build parameters.

Sources/SWBTaskExecution/BuildDescriptionManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ package final class BuildDescriptionManager: Sendable {
198198

199199
moduleCachePathsPerTarget[target] = [
200200
settings.globalScope.evaluate(BuiltinMacros.MODULE_CACHE_DIR),
201-
Path(settings.globalScope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH)),
202-
Path(settings.globalScope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH)),
201+
settings.globalScope.evaluate(BuiltinMacros.SWIFT_EXPLICIT_MODULES_OUTPUT_PATH),
202+
settings.globalScope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH),
203203
]
204204

205205
if shouldValidateCAS, settings.globalScope.evaluate(BuiltinMacros.CLANG_ENABLE_COMPILE_CACHE) || settings.globalScope.evaluate(BuiltinMacros.SWIFT_ENABLE_COMPILE_CACHE) {

Tests/SWBBuildSystemTests/CleanOperationTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fileprivate struct CleanOperationTests: CoreBasedTests {
106106
@Test(.requireSDKs(.macOS))
107107
func cleanFramework() async throws {
108108
try await withTestHarness { tester, tmpDirPath, _ in
109-
let buildFolderPaths = [ tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug")]
109+
let buildFolderPaths = [ tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug"), tmpDirPath.join("Test/aProject/build/ExplicitPrecompiledModules"), tmpDirPath.join("Test/aProject/build/SwiftExplicitPrecompiledModules")]
110110

111111
try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in
112112
// Check if build folder tasks have run as expected.
@@ -136,7 +136,7 @@ fileprivate struct CleanOperationTests: CoreBasedTests {
136136
@Test(.requireSDKs(.macOS))
137137
func cleanFrameworkInstall() async throws {
138138
try await withTestHarness(install: true) { tester, tmpDirPath, dstRoot in
139-
let buildFolderPaths = [ dstRoot, tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug")]
139+
let buildFolderPaths = [ dstRoot, tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug"), tmpDirPath.join("Test/aProject/build/ExplicitPrecompiledModules"), tmpDirPath.join("Test/aProject/build/SwiftExplicitPrecompiledModules")]
140140

141141
try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in
142142
// Check if build folder tasks have run as expected.
@@ -212,7 +212,7 @@ fileprivate struct CleanOperationTests: CoreBasedTests {
212212
let buildRequest = BuildRequest(parameters: parameters, buildTargets: buildTargets, continueBuildingAfterErrors: true, useParallelTargets: true, useImplicitDependencies: false, useDryRun: false)
213213
try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, persistent: true) { results in
214214
results.checkTasks(.matchRuleType("CreateBuildDirectory")) { tasks in
215-
#expect(tasks.count == 6)
215+
#expect(tasks.count == 10)
216216
}
217217

218218
results.checkNoTask(.matchRuleType("CreateBuildDirectory"))
@@ -234,7 +234,7 @@ fileprivate struct CleanOperationTests: CoreBasedTests {
234234
@Test(.requireSDKs(.macOS))
235235
func cleanDoesNotDeleteManuallyCreatedFolders() async throws {
236236
try await withTestHarness { tester, tmpDirPath, _ in
237-
let buildFolderPaths = [ tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug")]
237+
let buildFolderPaths = [ tmpDirPath.join("Test/aProject/build"), tmpDirPath.join("Test/aProject/build/Debug"), tmpDirPath.join("Test/aProject/build/EagerLinkingTBDs/Debug"), tmpDirPath.join("Test/aProject/build/ExplicitPrecompiledModules"), tmpDirPath.join("Test/aProject/build/SwiftExplicitPrecompiledModules")]
238238

239239
for folder in buildFolderPaths {
240240
try tester.fs.createDirectory(folder, recursive: true)

Tests/SWBBuildSystemTests/PackageBuildOperationTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,15 @@ fileprivate struct PackageBuildOperationTests: CoreBasedTests {
592592
packageBuildDirectory.join(configurationToBuild).str,
593593
packageBuildDirectory.join(configurationToBuild).join("PackageFrameworks").str,
594594
packageBuildDirectory.join("EagerLinkingTBDs").join(configurationToBuild).str,
595+
packageBuildDirectory.join("ExplicitPrecompiledModules").str,
596+
packageBuildDirectory.join("SwiftExplicitPrecompiledModules").str,
595597

596598
projectBuildDirectory.str,
597599
projectBuildDirectory.join(configurationToBuild).str,
598600
projectBuildDirectory.join(configurationToBuild).join("PackageFrameworks").str,
599601
projectBuildDirectory.join("EagerLinkingTBDs").join(configurationToBuild).str,
602+
projectBuildDirectory.join("ExplicitPrecompiledModules").str,
603+
projectBuildDirectory.join("SwiftExplicitPrecompiledModules").str,
600604
].sorted()
601605

602606
let tester = try await testerForBasicPackageProject(tmpDirPath: tmpDirPath, configurationToBuild: configurationToBuild)

Tests/SWBCoreTests/SettingsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ import SWBMacro
397397
if let project = settings.project {
398398
#expect(settings.globalScope.evaluate(BuiltinMacros.OBJROOT) == Path("\(project.sourceRoot.str)/build"))
399399
#expect(settings.globalScope.evaluate(BuiltinMacros.CONFIGURATION_BUILD_DIR) == Path("\(project.sourceRoot.str)/build/Config1"))
400-
#expect(settings.globalScope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH) == "\(project.sourceRoot.str)/build/ExplicitPrecompiledModules")
400+
#expect(settings.globalScope.evaluate(BuiltinMacros.CLANG_EXPLICIT_MODULES_OUTPUT_PATH).str == "\(project.sourceRoot.str)/build/ExplicitPrecompiledModules")
401401
}
402402

403403
// check that we get the right value for VERSION_INFO_STRING, which validates we parsed it correctly.

Tests/SWBTaskConstructionTests/TaskConstructionTests.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,8 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
21362136
.namePattern(.prefix("CreateBuildDirectory-/tmp/Test/aProject/build")),
21372137
.namePattern(.prefix("CreateBuildDirectory-/tmp/Test/aProject/build/Release\(runDestination.builtProductsDirSuffix)/BuiltProducts")),
21382138
.namePattern(.prefix("CreateBuildDirectory-/tmp/Test/aProject/build/EagerLinkingTBDs")),
2139+
.namePattern(.prefix("CreateBuildDirectory-/tmp/Test/aProject/build/SwiftExplicitPrecompiledModules")),
2140+
.namePattern(.prefix("CreateBuildDirectory-/tmp/Test/aProject/build/ExplicitPrecompiledModules")),
21392141
.namePattern(.and(.prefix("target"), .suffix("-begin-compiling"))),
21402142
])
21412143
} else {
@@ -8260,6 +8262,30 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
82608262
task.checkInputs([.path("\(tmpDir.str)/build/a/b/c/d")])
82618263
}
82628264

8265+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/b/c/d/ExplicitPrecompiledModules")) { task in
8266+
task.checkInputs([.path("\(tmpDir.str)/build/a/b/c/d")])
8267+
}
8268+
8269+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/b/c/d/SwiftExplicitPrecompiledModules")) { task in
8270+
task.checkInputs([.path("\(tmpDir.str)/build/a/b/c/d")])
8271+
}
8272+
8273+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/b/ExplicitPrecompiledModules")) { task in
8274+
task.checkInputs([.path("\(tmpDir.str)/build/a/b")])
8275+
}
8276+
8277+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/b/SwiftExplicitPrecompiledModules")) { task in
8278+
task.checkInputs([.path("\(tmpDir.str)/build/a/b")])
8279+
}
8280+
8281+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/ExplicitPrecompiledModules")) { task in
8282+
task.checkInputs([.path("\(tmpDir.str)/build/a")])
8283+
}
8284+
8285+
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/SwiftExplicitPrecompiledModules")) { task in
8286+
task.checkInputs([.path("\(tmpDir.str)/build/a")])
8287+
}
8288+
82638289
results.checkTask(.matchRuleType("CreateBuildDirectory"), .matchRuleItem("\(tmpDir.str)/build/a/b/c/d")) { task in
82648290
task.checkInputs([.path("\(tmpDir.str)/build/a/b")])
82658291
}

0 commit comments

Comments
 (0)