Skip to content

Merge main into release/6.2 #503

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 20 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2327cdc
Implement Statistic with atomics so it's thread safe
jakepetroules May 2, 2025
7cd307d
Remove `compiler` build setting conditional (#481)
neonichu May 5, 2025
ef21a84
build: attempt to bundle files for the modules
compnerd Mar 3, 2025
de9a45a
Introduce a ByteCount abstraction for representing bytes
jakepetroules May 2, 2025
e39832f
Turn on the inclusive language soundness check
owenv May 5, 2025
f267224
Merge pull request #489 from swiftlang/owenv/language-check
owenv May 5, 2025
5f4041c
[Explicit Module Builds] Add support for Swift incremental dependency…
artemcm May 6, 2025
fce47fd
Continue bundling xcspec resources used by Swift Build
owenv May 5, 2025
bb91a15
Remove blocking_sync usages from TaskProducerContext
jakepetroules May 5, 2025
524037f
Remove more blocking_sync calls
jakepetroules May 5, 2025
6eed033
Improve validation of task action implementation tool identifier types
jakepetroules May 6, 2025
bed73bb
Merge pull request #492 from artemcm/IncrementalScanOptional
artemcm May 7, 2025
382fba5
[Swift] Add migrate mode to a few upcoming flags that currently suppo…
xedin May 7, 2025
4ade115
[Swift] NFC: Change display name for `NonisolatedNonsendingByDefault`…
xedin May 7, 2025
a4dc5bb
Merge pull request #496 from xedin/add-migrate-option-to-features-tha…
xedin May 8, 2025
579aa20
Add plugin to autogenerate windows installer content
owenv May 8, 2025
36e8b25
Merge pull request #497 from swiftlang/owenv/gen-windows-installer
owenv May 8, 2025
fe6f10f
Merge pull request #488 from swiftlang/owenv/bundling-continued
owenv May 8, 2025
edda59f
Fix xcbuildrules typo
owenv May 9, 2025
ed66ddc
Merge pull request #500 from swiftlang/owenv/resource-fixes
owenv May 9, 2025
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
1 change: 0 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ jobs:
with:
license_header_check_project_name: "Swift"
api_breakage_check_enabled: false
unacceptable_language_check_enabled: false
format_check_enabled: false
7 changes: 7 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ let package = Package(
verb: "cmake-smoke-test",
description: "Build Swift Build using CMake for validation purposes"
))
),
.plugin(
name: "generate-windows-installer-component-groups",
capability: .command(intent: .custom(
verb: "generate-windows-installer-component-groups",
description: "Generate XML fragments for cli.wxs in swift-installer-scripts"
))
)
],
swiftLanguageModes: [.v5, .v6],
Expand Down
2 changes: 1 addition & 1 deletion Plugins/cmake-smoke-test/cmake-smoke-test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ extension Process {
Diagnostics.progress("Using process spawning workaround")
// Linux workaround for https://github.com/swiftlang/swift-corelibs-foundation/issues/4772
// Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, creating processes that even have SIGTERM blocked
// This manifests as CMake hanging when invoking 'uname' with incorrectly configured signal handlers.
// This manifests as CMake getting stuck when invoking 'uname' with incorrectly configured signal handlers.
var fileActions = posix_spawn_file_actions_t()
defer { posix_spawn_file_actions_destroy(&fileActions) }
var attrs: posix_spawnattr_t = posix_spawnattr_t()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import PackagePlugin
import Foundation

@main
struct GenerateWindowsInstallerComponentGroups: CommandPlugin {
func performCommand(context: PluginContext, arguments: [String]) async throws {
var librariesComponent = #" <ComponentGroup Id="SwiftBuild" Directory="_usr_bin">\#n"#
var resourcesComponents = ""
var groupRefs = #" <ComponentGroupRef Id="SwiftBuild" />\#n"#
var directories = #" <Directory Id="_usr_share_pm" Name="pm">\#n"#
for target in context.package.targets.sorted(by: { $0.name < $1.name }).filter({ !["SWBTestSupport", "SwiftBuildTestSupport"].contains($0.name) }) {
guard let sourceModule = target.sourceModule, sourceModule.kind == .generic else {
continue
}
librariesComponent += #"""
<Component>
<File Source="$(ToolchainRoot)\usr\bin\\#(sourceModule.name).dll" />
</Component>

"""#

let resources = sourceModule.sourceFiles.filter { resource in resource.type == .resource && ["xcspec", "xcbuildrules"].contains(resource.url.pathExtension) }
if !resources.isEmpty {
groupRefs += #" <ComponentGroupRef Id="\#(sourceModule.name)Resources" />\#n"#
directories += #" <Directory Id="_usr_share_pm_\#(sourceModule.name)" Name="SwiftBuild_\#(sourceModule.name).resources" />\#n"#
resourcesComponents += #" <ComponentGroup Id="\#(sourceModule.name)Resources" Directory="_usr_share_pm_\#(sourceModule.name)">\#n"#
for resource in resources {
resourcesComponents += #"""
<Component>
<File Source="$(ToolchainRoot)\usr\share\pm\SwiftBuild_\#(sourceModule.name).resources\\#(resource.url.lastPathComponent)" />
</Component>

"""#
}
resourcesComponents += " </ComponentGroup>\n"
}
}
librariesComponent += " </ComponentGroup>\n"
directories += " </Directory>\n"

print("Component Groups")
print(String(repeating: "-", count: 80))
print(librariesComponent)
print(resourcesComponents)
print("Group Refs")
print(String(repeating: "-", count: 80))
print(groupRefs)
print("Directories")
print(String(repeating: "-", count: 80))
print(directories)
}
}
42 changes: 42 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,48 @@ See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
]]

include(CMakeParseArguments)
function(SwiftBuild_Bundle)
set(Options)
set(OneValueArguments MODULE)
set(MultiValueArguments FILES)
cmake_parse_arguments(PARSE_ARGV 0 BundleXCSpecs
"${Options}" "${OneValueArguments}" "${MultiValueArguments}")

list(TRANSFORM BundleXCSpecs_FILES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
add_custom_command(TARGET ${BundleXCSpecs_MODULE} POST_BUILD
COMMAND
${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources"
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${BundleXCSpecs_FILES} "${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources/")

file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources" _SWIFT_BUILD_RESOURCE_BUNDLE_BUILD_PATH)
file(CONFIGURE
OUTPUT "${CMAKE_BINARY_DIR}/resource_accessors/SwiftBuild_${BundleXCSpecs_MODULE}_resource_bundle_accessor.swift"
CONTENT [[
import Foundation
extension Foundation.Bundle {
static let module: Bundle = {
let mainPath = Bundle.main.bundleURL.appendingPathComponent("SwiftBuild_@[email protected]").path
let buildPath = #"@_SWIFT_BUILD_RESOURCE_BUNDLE_BUILD_PATH@"#
let preferredBundle = Bundle(path: mainPath)
guard let bundle = preferredBundle ?? Bundle(path: buildPath) else {
Swift.fatalError("could not load resource bundle: from \(mainPath) or \(buildPath)")
}
return bundle
}()
}
]]
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)

target_sources("${BundleXCSpecs_MODULE}" PRIVATE
"${CMAKE_BINARY_DIR}/resource_accessors/SwiftBuild_${BundleXCSpecs_MODULE}_resource_bundle_accessor.swift")

install(DIRECTORY
"${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources/"
DESTINATION share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources/)
endfunction()

add_subdirectory(SWBCSupport)
add_subdirectory(SWBCLibc)
add_subdirectory(SWBLibc)
Expand Down
24 changes: 2 additions & 22 deletions Sources/SWBAndroidPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,15 @@ See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
]]

file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}"
_SWBAndroidPlatform_NATIVE_CMAKE_CURRENT_BINARY_DIR)
file(CONFIGURE
OUTPUT resource_bundle_accessor.swift
CONTENT [[
import Foundation
extension Foundation.Bundle {
static let module: Bundle = {
let mainPath = Bundle.main.bundleURL.appendingPathComponent("SwiftBuild_SWBAndroidPlatform.resources").path
let buildPath = #"@_SWBAndroidPlatform_NATIVE_CMAKE_CURRENT_BINARY_DIR@\SwiftBuild_SWBAndroidPlatform.resources"#
let preferredBundle = Bundle(path: mainPath)
guard let bundle = preferredBundle ?? Bundle(path: buildPath) else {
Swift.fatalError("could not load resource bundle: from \(mainPath) or \(buildPath)")
}
return bundle
}()
}
]]
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)

add_library(SWBAndroidPlatform
AndroidSDK.swift
Plugin.swift)
SwiftBuild_Bundle(MODULE SWBAndroidPlatform FILES
Specs/Android.xcspec)
target_link_libraries(SWBAndroidPlatform PUBLIC
SWBCore
SWBMacro
SWBUtil)
target_sources(SWBAndroidPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")

set_target_properties(SWBAndroidPlatform PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
Expand Down
93 changes: 71 additions & 22 deletions Sources/SWBApplePlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
]]

file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}"
_SWBApplePlatform_NATIVE_CMAKE_CURRENT_BINARY_DIR)
file(CONFIGURE
OUTPUT resource_bundle_accessor.swift
CONTENT [[
import Foundation
extension Foundation.Bundle {
static let module: Bundle = {
let mainPath = Bundle.main.bundleURL.appendingPathComponent("SwiftBuild_SWBApplePlatform.resources").path
let buildPath = #"@_SWBApplePlatform_NATIVE_CMAKE_CURRENT_BINARY_DIR@\SwiftBuild_SWBApplePlatform.resources"#
let preferredBundle = Bundle(path: mainPath)
guard let bundle = preferredBundle ?? Bundle(path: buildPath) else {
Swift.fatalError("could not load resource bundle: from \(mainPath) or \(buildPath)")
}
return bundle
}()
}
]]
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)

add_library(SWBApplePlatform
AppIntentsMetadataCompiler.swift
AppIntentsMetadataTaskProducer.swift
Expand Down Expand Up @@ -65,6 +45,77 @@ add_library(SWBApplePlatform
StringCatalogCompilerOutputParser.swift
StubBinaryTaskProducer.swift
XCStringsInputFileGroupingStrategy.swift)
SwiftBuild_Bundle(MODULE SWBApplePlatform FILES
Specs/AppIntentsMetadata.xcspec
Specs/AppIntentsNLTraining.xcspec
Specs/AppShortcutStringsMetadata.xcspec
Specs/AssetCatalogCompiler.xcspec
Specs/CompileSkybox.xcspec
Specs/CopyPNGFile.xcspec
Specs/CopyTiffFile.xcspec
"Specs/Core Data.xcspec"
Specs/CoreML.xcspec
"Specs/Darwin Package Types.xcspec"
"Specs/Darwin Product Types.xcspec"
Specs/DriverKit.xcspec
Specs/DTrace.xcspec
Specs/Embedded-Device.xcspec
Specs/Embedded-Shared.xcspec
Specs/Embedded-Simulator.xcspec
Specs/EmbeddedBinaryValidationUtility.xcspec
Specs/GenerateAppPlaygroundAssetCatalog.xcspec
Specs/GenerateTextureAtlas.xcspec
Specs/IBCompiler.xcspec
Specs/IBPostprocessor.xcspec
Specs/IBStoryboardCompiler.xcspec
Specs/IBStoryboardLinker.xcspec
Specs/IBStoryboardPostprocessor.xcspec
Specs/Iconutil.xcspec
Specs/Iig.xcspec
Specs/InfoPlistUtility.xcspec
Specs/InstrumentsPackage.xcspec
Specs/Intents.xcspec
"Specs/Interface Builder File Types.xcspec"
"Specs/iOS Device.xcspec"
"Specs/iOS Shared.xcspec"
"Specs/iOS Simulator.xcspec"
Specs/KernelExtension.xcspec
Specs/Lipo.xcspec
Specs/LSRegisterURL.xcspec
"Specs/MacOSX Architectures.xcspec"
"Specs/MacOSX Core Build System.xcspec"
"Specs/MacOSX Native Build System.xcspec"
"Specs/MacOSX Package Types.xcspec"
"Specs/MacOSX Product Types.xcspec"
Specs/MetalCompiler.xcspec
Specs/MetalFileTypes.xcspec
Specs/MetalLinker.xcspec
Specs/MetalPackageTypes.xcspec
Specs/MetalProductTypes.xcspec
Specs/MiG.xcspec
Specs/OpenCL.xcspec
Specs/OSACompile.xcspec
Specs/RCFileTypes.xcspec
Specs/RealityAssets.xcspec
Specs/ReferenceObject.xcspec
Specs/ResMerger.xcspec
Specs/Rez.xcspec
"Specs/SceneKit FileTypes.xcspec"
"Specs/SceneKit Tools.xcspec"
Specs/SpriteKitFileTypes.xcspec
Specs/TiffUtil.xcspec
"Specs/tvOS Device.xcspec"
"Specs/tvOS Shared.xcspec"
"Specs/tvOS Simulator.xcspec"
Specs/WatchKit1ProductTypes.xcspec
"Specs/watchOS Device.xcspec"
"Specs/watchOS Shared.xcspec"
"Specs/watchOS Simulator.xcspec"
Specs/XCAppExtensionPoints.xcspec
Specs/XCStrings.xcspec
"Specs/xrOS Device.xcspec"
"Specs/xrOS Shared.xcspec"
"Specs/xrOS Simulator.xcspec")
set_target_properties(SWBApplePlatform PROPERTIES
Swift_LANGUAGE_VERSION 6)
target_link_libraries(SWBApplePlatform PUBLIC
Expand All @@ -73,8 +124,6 @@ target_link_libraries(SWBApplePlatform PUBLIC
SWBUtil
SWBProtocol
SWBTaskConstruction)
target_sources(SWBApplePlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")

set_target_properties(SWBApplePlatform PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
Expand Down
6 changes: 3 additions & 3 deletions Sources/SWBBuildSystem/BuildOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ private class InProcessCommand: SWBLLBuild.ExternalCommand, SWBLLBuild.ExternalD
// Get the current output delegate from the adaptor.
//
// FIXME: This should never fail (since we are executing), but we have seen a crash here with that assumption. For now we are defensive until the source can be tracked down: <rdar://problem/31670274> Diagnose unexpected missing output delegate from: <rdar://problem/31669245> Crash in InProcessCommand.execute()
guard let outputDelegate = adaptor.getActiveOutputDelegate(command) else {
guard let outputDelegate = await adaptor.getActiveOutputDelegate(command) else {
return .failed
}

Expand Down Expand Up @@ -1604,9 +1604,9 @@ internal final class OperationSystemAdaptor: SWBLLBuild.BuildSystemDelegate, Act
/// Get the active output delegate for an executing command.
///
/// - returns: The active delegate, or nil if not found.
func getActiveOutputDelegate(_ command: Command) -> (any TaskOutputDelegate)? {
func getActiveOutputDelegate(_ command: Command) async -> (any TaskOutputDelegate)? {
// FIXME: This is a very bad idea, doing a sync against the response queue is introducing artificial latency when an in-process command needs to wait for the response queue to flush. However, we also can't simply move to a decoupled lock, because we don't want the command to start reporting output before it has been fully reported as having started. We need to move in-process task to another model.
return queue.blocking_sync {
return await queue.sync {
self.commandOutputDelegates[command]
}
}
Expand Down
26 changes: 4 additions & 22 deletions Sources/SWBCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
]]

file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}"
_SWBCore_NATIVE_CMAKE_CURRENT_BINARY_DIR)
file(CONFIGURE
OUTPUT resource_bundle_accessor.swift
CONTENT [[
import Foundation
extension Foundation.Bundle {
static let module: Bundle = {
let mainPath = Bundle.main.bundleURL.appendingPathComponent("SwiftBuild_SWBCore.resources").path
let buildPath = #"@_SWBCore_NATIVE_CMAKE_CURRENT_BINARY_DIR@\SwiftBuild_SWBCore.resources"#
let preferredBundle = Bundle(path: mainPath)
guard let bundle = preferredBundle ?? Bundle(path: buildPath) else {
Swift.fatalError("could not load resource bundle: from \(mainPath) or \(buildPath)")
}
return bundle
}()
}
]]
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)

add_library(SWBCore
ActivityReporting.swift
Apple/DeviceFamily.swift
Expand Down Expand Up @@ -195,6 +175,10 @@ add_library(SWBCore
WorkspaceContext.swift
WorkspaceSettingsCache.swift
XCFramework.swift)
SwiftBuild_Bundle(MODULE SWBCore FILES
Specs/CoreBuildSystem.xcspec
Specs/ExternalBuildSystem.xcspec
Specs/NativeBuildSystem.xcspec)
set_target_properties(SWBCore PROPERTIES
Swift_LANGUAGE_VERSION 5)
target_link_libraries(SWBCore PUBLIC
Expand All @@ -205,8 +189,6 @@ target_link_libraries(SWBCore PUBLIC
SWBCAS
SWBLLBuild
SwiftDriver)
target_sources(SWBCore PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")

set_target_properties(SWBCore PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
Expand Down
6 changes: 3 additions & 3 deletions Sources/SWBCore/LibSwiftDriver/LibSwiftDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ public final class SwiftModuleDependencyGraph: SwiftGlobalExplicitDependencyGrap
return fileDependencies
}

public func queryTransitiveDependencyModuleNames(for key: String) throws -> [String] {
let graph = try registryQueue.blocking_sync {
guard let driver = registry[key] else {
public func queryTransitiveDependencyModuleNames(for key: String) async throws -> [String] {
let graph = try await registryQueue.sync {
guard let driver = self.registry[key] else {
throw StubError.error("Unable to find jobs for key \(key). Be sure to plan the build ahead of fetching results.")
}
return driver.intermoduleDependencyGraph
Expand Down
Loading