Skip to content

6.2 merge main #8608

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

Open
wants to merge 100 commits into
base: release/6.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
a0fbf35
Minor Codable conformance improvements in SwiftBuildSupport (#8449)
pmattos Apr 4, 2025
c8d439a
Switch to ProjectModel API in the new SwiftBuildSupport PIF builder (…
pmattos Apr 5, 2025
60976ee
Tests: Enabled SourceControlTests on Windows (#8453)
bkhouri Apr 8, 2025
d4368fe
Clarify documented behavior of versioned manifest files in usage docs…
stmontgomery Apr 8, 2025
4511962
Tests: Enable some WorkspaceTests on Windows (#8463)
bkhouri Apr 9, 2025
cc0b1a5
Tests: Enable tests on Windows (#8466)
bkhouri Apr 9, 2025
21e3336
SwiftSDK: Remove hardcoded WASI sysroot path derivation (#8468)
kateinoigakukun Apr 9, 2025
e303b89
Copy helpers internally (#8467)
bkhouri Apr 9, 2025
cd5d9dd
Revert "Copy helpers internally" (#8474)
nate-chandler Apr 9, 2025
a0d1600
Fix duplicate modulemap errors with macro and plugin deps (#8472)
dschaefer2 Apr 10, 2025
1d48e0a
Copy helpers internally (#8476)
bkhouri Apr 11, 2025
6dfb613
Fix `SwiftBuildSupport/README.md` (#8483)
MaxDesiatov Apr 12, 2025
57a67b4
Fix bootstrapping on OpenBSD (#8451)
3405691582 Apr 14, 2025
3d063d0
Link test command test failures on Linux to issue (#8459)
cmcgee1024 Apr 14, 2025
49e69c7
Revert "Copy helpers internally" again (#8494)
pmattos Apr 14, 2025
453e6d3
Tests: Split SerializedJSONTests (#8496)
bkhouri Apr 15, 2025
b69b792
Mark skipped test with a GitHub issue (#8502)
bkhouri Apr 15, 2025
dec1ded
Improve Swift Build error formatting (#8493)
pmattos Apr 15, 2025
1befa52
Docs: Refer to swiftly in CONTRIBUTING.md (#8504)
bkhouri Apr 16, 2025
8432220
Test: Enable ConcurrencyHelpersTests on Windows (#8506)
bkhouri Apr 16, 2025
6245fa9
Really fix duplicate module maps this time. (#8498)
dschaefer2 Apr 16, 2025
e842b0e
Implement --enable-parseable-module-interfaces for swift-build builds…
daveinglis Apr 16, 2025
861a871
Add `swift test --attachments-path`. (#8492)
grynspan Apr 16, 2025
0b23073
Tests: Ensure we get clean test fixtures (#8507)
pmattos Apr 17, 2025
f673bf6
Revert "Really fix duplicate module maps this time." (#8517)
dschaefer2 Apr 17, 2025
393a8f3
Adopt new PIF builder in SwiftBuildSupport (#8454)
pmattos Apr 17, 2025
2c4c785
Tests: Fix 22 warning in BuildCommandTests (#8509)
pmattos Apr 17, 2025
9fb4efb
Add an .editorconfig file
jakepetroules Apr 17, 2025
95ce2a3
Make sure the workspace state is saved after adding/removing artifact…
shawnhyam Apr 18, 2025
b938328
build-using-self use a self build of swift-test instead (#8548)
dschaefer2 Apr 23, 2025
2bc3390
Disable failing SwiftBuild test on AmazonLinux 2 (#8546)
bkhouri Apr 23, 2025
ffdc0c0
Tests: Run packageInitExecutable test on all platforms for native bui…
pmattos Apr 23, 2025
6b256f3
Adopt MemberImportVisibility (#8525)
plemarquand Apr 23, 2025
7cf86c6
Add support for testable executables on Windows
jakepetroules Apr 17, 2025
6973cf5
Add FreeBSD support to SwiftBuild PIF builder (#8550)
pmattos Apr 23, 2025
387c4e0
Skip failing test in `TestCommandTests.swift` (#8553)
MaxDesiatov Apr 24, 2025
b021cef
[Build] Enable diagnostic serialization by default for swift modules …
xedin Apr 24, 2025
bc074bd
[Commands] Initial implementation of `swift package add-setting` comm…
xedin Apr 24, 2025
e952244
[Commands] Initial implementation of `swift package add-setting` comm…
xedin Apr 24, 2025
b842488
Output Swift Build PIF JSON for Graphviz visualization (#8539)
pmattos Apr 24, 2025
5da13be
Enable more plugin related tests for non-macOS platforms (#8477)
cmcgee1024 Apr 24, 2025
2b659da
Revert "Enable more plugin related tests for non-macOS platforms" (#8…
MaxDesiatov Apr 25, 2025
5b2118b
Prevent non-targets from depending on test targets (#8513)
johnbute Apr 25, 2025
ed30461
Adds DocC catalog to host SwiftPM documentation (#8487)
heckj Apr 25, 2025
d026b3f
Closes #8520 - Fix up test execution for IntegrationTests (#8538)
kcieplak Apr 25, 2025
a16474a
Re-enable more plugin related tests for non-macOS platforms (#8558)
cmcgee1024 Apr 25, 2025
2d48848
Re-enable tests in Windows CI (#8562)
dschaefer2 Apr 28, 2025
553f135
Tests: enable a test and update skip reason (#8542)
bkhouri Apr 28, 2025
f161b02
Test: Enable most AsyncProcessTests (#8500)
bkhouri Apr 28, 2025
68d55b1
Fix a number of minor curated documentation issues
jakepetroules Apr 25, 2025
f808b9f
Use `GENERATE_PRELINK_OBJECT_FILE` in `PackagePIFProjectBuilder` (#8570)
MaxDesiatov Apr 29, 2025
6965245
Avoid building targets that are conditional on platform when building…
cmcgee1024 Apr 29, 2025
e0afabb
Factor the working directory skip into a common function (#8561)
jakepetroules Apr 29, 2025
ed31e6e
Tests: Enable more WorkspaceTests on Windows (#8457)
bkhouri Apr 29, 2025
02436ea
Refactor slow to type check expression (#8565)
plemarquand Apr 30, 2025
244f99c
Use correct FileSystem in the PIF builder for Swift Build (#8574)
pmattos Apr 30, 2025
174cdc2
Make add-dependency idempotent (#8534)
plemarquand Apr 30, 2025
d57bd36
pipeline: support additional args in build-using-self (#8559)
bkhouri Apr 30, 2025
4a36f55
[Traits] Change `TraitConfiguration` to be an enum instead of struct …
bripeticca Apr 30, 2025
bc72d82
Fix dup modmaps taking into account macro test targets. (#8524)
dschaefer2 Apr 30, 2025
b092abe
Tests: Merge Windows helper function and update GH issues (#8569)
bkhouri Apr 30, 2025
e84c0ba
Some PIF delegate fixes for Swift Build (#8573)
pmattos Apr 30, 2025
1e1fecb
stubs for initial DocC structure (#8572)
heckj Apr 30, 2025
0dd66e8
Introduce new defines to enable #bundle in Swift Packages (#8556)
matthewseaman Apr 30, 2025
072bf1a
Add missing file to SwiftBuildSupport/CMakeLists.txt (#8581)
pmattos Apr 30, 2025
bdfd754
Rename remaining occurrences of the old helper. (#8583)
yyvch Apr 30, 2025
8dbd83e
Add swift version file to record the Swift toolchain to use (#8411)
cmcgee1024 May 1, 2025
c5582fb
Tests: Conditionally skip the Archiver tests (#8601)
bkhouri May 1, 2025
620cbb9
Tests: Enable some BuildTests/**/*.swift tests on Windows (#8512)
bkhouri May 2, 2025
96d86b0
Tests: Reference issue in skipped SourceControlPackageContainerTests …
bkhouri May 2, 2025
879236b
Tests: Enable BasicsTests/FileSystem/* Tests on Windows (Swift Testin…
bkhouri May 2, 2025
366e545
Implement SwiftFixIt — a library for deserializing diagnostics and ap…
AnthonyLatsis May 2, 2025
e8aff4b
Test: Guard a ManifestSourceGenerationTest and annotate skip message …
bkhouri May 2, 2025
a9e09ef
Test: Convert more tests to Swift Testing (#8100)
bkhouri May 3, 2025
98726b9
Bump iOS deployment target to 17 to match dependencies
jakepetroules May 2, 2025
8694d3c
Tests: Convert some WorkspaceTests module tests to Swift Testing (#8092)
bkhouri May 4, 2025
9688105
Tests: Convert more BasicTests to Swift Testing (#8617)
bkhouri May 5, 2025
a3cd491
[SwiftFixIt] Allow filtering diagnostics by category (#8620)
xedin May 6, 2025
a40b433
Tests: Convert SPMBuildCoreTests to Swift Testing (#8625)
bkhouri May 6, 2025
f770c45
normalize abstracts and help content for swift commands (#8566)
heckj May 6, 2025
7571d6a
Display PID of other running SwiftPM processes (#8575)
louisunlimited May 6, 2025
97fad74
[Commands] `swift package migrate` command (#8613)
xedin May 7, 2025
d368cb0
[Commands] Adjust `swift package migrate` to only apply fix-its to th…
xedin May 7, 2025
26d8417
Tests: Convert Environment/Graph and other suites to ST (#8624)
bkhouri May 8, 2025
6e60632
Use async methods when loading manifests (#8551)
plemarquand May 8, 2025
e5c210a
Tests: Convert more tests to Swift Testing (#8636)
bkhouri May 8, 2025
c28a891
Minor improvement in SwiftBuildSupport helpers (#8631)
pmattos May 9, 2025
a4cd504
Remove previous maintainers from CODEOWNERS
bnbarham May 8, 2025
9051756
Add more context for validation errors for target properties. (#8612)
yyvch May 9, 2025
3448da6
Support Swift SDKs w/ many metadata files in same directory (#8638)
MaxDesiatov May 9, 2025
0036a0b
Set tools version to 6.1 (#8637)
bkhouri May 9, 2025
8e4dd07
Forward cherry pick the prebuilts feature to main. (#8610)
dschaefer2 May 9, 2025
7a927cd
Do not try to add rpath arguments on noneOS (#8358)
rauhul May 11, 2025
2b0505e
Use mergeable symbols in embedded (#8654)
rauhul May 12, 2025
063c917
Revert "Tests: Convert Environment/Graph and other suites to ST" (#8647)
bkhouri May 12, 2025
43e524c
[cmake] Turn `SwiftFixIt` into a static library
xedin May 12, 2025
f4035c1
Build SwiftBuild as part of CMake bootstrapping (#8445)
owenv May 13, 2025
ba10e8a
Remove Swift-numerics dependency
bkhouri May 13, 2025
c5589c8
Merge remote-tracking branch 'origin/main' into 6.2-merge-main
dschaefer2 May 13, 2025
d9934bd
Clean up merge.
dschaefer2 May 13, 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: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.1.0
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if(FIND_PM_DEPS)
find_package(SwiftASN1 CONFIG REQUIRED)
find_package(SwiftCertificates CONFIG REQUIRED)
find_package(SwiftCrypto CONFIG REQUIRED)
find_package(SwiftBuild CONFIG REQUIRED)
endif()

find_package(dispatch QUIET)
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

Sources/XCBuildSupport/* @jakepetroules

* @bnbarham @MaxDesiatov @jakepetroules @xedin @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123
* @jakepetroules @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123
25 changes: 16 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ $> swift --version
Apple Swift version 5.3
```

Note: Alternatively use tools like [swiftly](https://www.swift.org/swiftly/documentation/swiftlydocs/) that help manage toolchains versions.
Alternatively, there are tools like [swiftly](https://github.com/swiftlang/swiftly) that can install and manage toolchains automatically. This repository has a file called `.swift-version` that will keep swiftly at the current recommended version of the toolchain for best results. The `swiftly install` command ensures that SwiftPM's in-use toolchain is installed on your system and ready for you to do your development work with the usual swift commands.

```bash
swiftly install
swift build
swift test
```

## Local Development

Expand Down Expand Up @@ -322,14 +328,15 @@ Note there are several Linux and Swift versions options to choose from, e.g.:
2. Clone a working copy of your fork
3. Create a new branch
4. Make your code changes
5. Try to keep your changes (when possible) below 200 lines of code.
6. We use [SwiftFormat](https://www.github.com/nicklockwood/SwiftFormat) to enforce code style. Please install and run SwiftFormat before submitting your PR, ideally isolating formatting changes only to code changed for the original goal of the PR. This will keep the PR diff smaller.
7. Commit (include the Radar link or GitHub issue id in the commit message if possible and a description your changes). Try to have only 1 commit in your PR (but, of course, if you add changes that can be helpful to be kept aside from the previous commit, make a new commit for them).
8. Push the commit / branch to your fork
9. Make a PR from your fork / branch to `apple: main`
10. While creating your PR, make sure to follow the PR Template providing information about the motivation and highlighting the changes.
11. Reviewers are going to be automatically added to your PR
12. Pull requests will be merged by the maintainers after it passes CI testing and receives approval from one or more reviewers. Merge timing may be impacted by release schedule considerations.
5. If a particular version of the Swift toolchain is needed then update the `.swift-version` file to that version (or use `swiftly use` to update it).
6. Try to keep your changes (when possible) below 200 lines of code.
7. We use [SwiftFormat](https://www.github.com/nicklockwood/SwiftFormat) to enforce code style. Please install and run SwiftFormat before submitting your PR, ideally isolating formatting changes only to code changed for the original goal of the PR. This will keep the PR diff smaller.
8. Commit (include the Radar link or GitHub issue id in the commit message if possible and a description your changes). Try to have only 1 commit in your PR (but, of course, if you add changes that can be helpful to be kept aside from the previous commit, make a new commit for them).
9. Push the commit / branch to your fork
10. Make a PR from your fork / branch to `apple: main`
11. While creating your PR, make sure to follow the PR Template providing information about the motivation and highlighting the changes.
12. Reviewers are going to be automatically added to your PR
13. Pull requests will be merged by the maintainers after it passes CI testing and receives approval from one or more reviewers. Merge timing may be impacted by release schedule considerations.

By submitting a pull request, you represent that you have the right to license
your contribution to Apple and the community, and agree by submitting the patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
{
"path": "mytool-linux/mytool",
"supportedTriples": ["x86_64-unknown-linux-gnu"]
},
{
"path": "mytool-windows/mytool.bat",
"supportedTriples": ["x86_64-unknown-windows-msvc", "aarch64-unknown-windows-msvc"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@echo off

set verbose=false
IF NOT "%1"=="" (
IF "%1"=="--verbose" (
SET verbose=true
SHIFT
)
)

set input=%1
set output=%2
shift
shift


if "%verbose%" == "true" (
echo "[mytool-windows] '%input%' '%output%'"
)
@echo on
echo f | xcopy.exe /f "%input%" "%output%"
10 changes: 10 additions & 0 deletions Fixtures/SwiftMigrate/ExistentialAnyMigration/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// swift-tools-version:5.8

import PackageDescription

let package = Package(
name: "ExistentialAnyMigration",
targets: [
.target(name: "Diagnostics", path: "Sources", exclude: ["Fixed"]),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
protocol P {
}

func test1(_: any P) {
}

func test2(_: (any P).Protocol) {
}

func test3() {
let _: [(any P)?] = []
}

func test4() {
var x = 42
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
protocol P {
}

func test1(_: P) {
}

func test2(_: P.Protocol) {
}

func test3() {
let _: [P?] = []
}

func test4() {
var x = 42
}
37 changes: 30 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:6.0
// swift-tools-version:6.1

//===----------------------------------------------------------------------===//
//
Expand Down Expand Up @@ -104,7 +104,7 @@ let package = Package(
name: "SwiftPM",
platforms: [
.macOS(.v13),
.iOS(.v16),
.iOS(.v17),
.macCatalyst(.v17),
],
products:
Expand Down Expand Up @@ -138,7 +138,7 @@ let package = Package(
type: .dynamic,
targets: ["AppleProductTypes"]
),

.library(
name: "PackagePlugin",
type: .dynamic,
Expand Down Expand Up @@ -304,6 +304,21 @@ let package = Package(
]
),

.target(
/** API for deserializing diagnostics and applying fix-its */
name: "SwiftFixIt",
dependencies: [
"Basics",
.product(name: "TSCBasic", package: "swift-tools-support-core"),
] + swiftSyntaxDependencies(
["SwiftDiagnostics", "SwiftIDEUtils", "SwiftParser", "SwiftSyntax"]
),
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),

// MARK: Project Model

.target(
Expand Down Expand Up @@ -573,6 +588,7 @@ let package = Package(
"Workspace",
"XCBuildSupport",
"SwiftBuildSupport",
"SwiftFixIt",
] + swiftSyntaxDependencies(["SwiftIDEUtils"]),
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: swift6CompatibleExperimentalFeatures + [
Expand Down Expand Up @@ -808,7 +824,11 @@ let package = Package(

.testTarget(
name: "BasicsTests",
dependencies: ["Basics", "_InternalTestSupport", "tsan_utils"],
dependencies: [
"Basics",
"_InternalTestSupport",
"tsan_utils",
],
exclude: [
"Archiver/Inputs/archive.tar.gz",
"Archiver/Inputs/archive.zip",
Expand Down Expand Up @@ -916,6 +936,10 @@ let package = Package(
dependencies: ["SourceControl", "_InternalTestSupport"],
exclude: ["Inputs/TestRepo.tgz"]
),
.testTarget(
name: "SwiftFixItTests",
dependencies: ["SwiftFixIt", "_InternalTestSupport"]
),
.testTarget(
name: "XCBuildSupportTests",
dependencies: ["XCBuildSupport", "_InternalTestSupport", "_InternalBuildTestSupport"],
Expand All @@ -928,7 +952,7 @@ let package = Package(
path: "Examples/package-info/Sources/package-info"
)
],
swiftLanguageVersions: [.v5]
swiftLanguageModes: [.v5]
)

#if canImport(Darwin)
Expand Down Expand Up @@ -1079,8 +1103,7 @@ if ProcessInfo.processInfo.environment["ENABLE_APPLE_PRODUCT_TYPES"] == "1" {
}
}

if ProcessInfo.processInfo.environment["SWIFTPM_SWBUILD_FRAMEWORK"] == nil &&
ProcessInfo.processInfo.environment["SWIFTPM_NO_SWBUILD_DEPENDENCY"] == nil {
if ProcessInfo.processInfo.environment["SWIFTPM_SWBUILD_FRAMEWORK"] == nil {

let swiftbuildsupport: Target = package.targets.first(where: { $0.name == "SwiftBuildSupport" } )!
swiftbuildsupport.dependencies += [
Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/Archiver/TarArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct TarArchiver: Archiver {
private let cancellator: Cancellator

/// The underlying command
private let tarCommand: String
internal let tarCommand: String

/// Creates a `TarArchiver`.
///
Expand Down
22 changes: 17 additions & 5 deletions Sources/Basics/Archiver/ZipArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ public struct ZipArchiver: Archiver, Cancellable {

/// Absolute path to the Windows tar in the system folder
#if os(Windows)
private let windowsTar: String
internal let windowsTar: String
#else
internal let unzip = "unzip"
internal let zip = "zip"
#endif

#if os(FreeBSD)
internal let tar = "tar"
#endif

/// Creates a `ZipArchiver`.
Expand Down Expand Up @@ -74,7 +81,9 @@ public struct ZipArchiver: Archiver, Cancellable {
// It's part of system32 anyway so use the absolute path.
let process = AsyncProcess(arguments: [windowsTar, "xf", archivePath.pathString, "-C", destinationPath.pathString])
#else
let process = AsyncProcess(arguments: ["unzip", archivePath.pathString, "-d", destinationPath.pathString])
let process = AsyncProcess(arguments: [
self.unzip, archivePath.pathString, "-d", destinationPath.pathString,
])
#endif
guard let registrationKey = self.cancellator.register(process) else {
throw CancellationError.failedToRegisterProcess(process)
Expand Down Expand Up @@ -113,7 +122,10 @@ public struct ZipArchiver: Archiver, Cancellable {
// On FreeBSD, the unzip command is available in base but not the zip command.
// Therefore; we use libarchive(bsdtar) to produce the ZIP archive instead.
let process = AsyncProcess(
arguments: ["tar", "-c", "--format", "zip", "-f", destinationPath.pathString, directory.basename],
arguments: [
self.tar, "-c", "--format", "zip", "-f", destinationPath.pathString,
directory.basename,
],
workingDirectory: directory.parentDirectory
)
#else
Expand All @@ -127,7 +139,7 @@ public struct ZipArchiver: Archiver, Cancellable {
arguments: [
"/bin/sh",
"-c",
"cd \(directory.parentDirectory.underlying.pathString) && zip -ry \(destinationPath.pathString) \(directory.basename)",
"cd \(directory.parentDirectory.underlying.pathString) && \(self.zip) -ry \(destinationPath.pathString) \(directory.basename)"
]
)
#endif
Expand All @@ -154,7 +166,7 @@ public struct ZipArchiver: Archiver, Cancellable {
#if os(Windows)
let process = AsyncProcess(arguments: [windowsTar, "tf", path.pathString])
#else
let process = AsyncProcess(arguments: ["unzip", "-t", path.pathString])
let process = AsyncProcess(arguments: [self.unzip, "-t", path.pathString])
#endif
guard let registrationKey = self.cancellator.register(process) else {
throw CancellationError.failedToRegisterProcess(process)
Expand Down
16 changes: 16 additions & 0 deletions Sources/Basics/Concurrency/ConcurrencyHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,20 @@ extension DispatchQueue {
}
}
}

package func asyncResult<T: Sendable>(_ callback: @escaping @Sendable (Result<T, Error>) -> Void, _ closure: @escaping @Sendable () async throws -> T) {
let completion: @Sendable (Result<T, Error>) -> Void = {
result in self.async {
callback(result)
}
}

Task {
do {
completion(.success(try await closure()))
} catch {
completion(.failure(error))
}
}
}
}
16 changes: 8 additions & 8 deletions Sources/Basics/Concurrency/SendableBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ import struct Foundation.Date
/// an `async` closure. This type serves as a replacement for `ThreadSafeBox`
/// implemented with Swift Concurrency primitives.
public actor SendableBox<Value: Sendable> {
init(_ value: Value? = nil) {
public init(_ value: Value) {
self.value = value
}

var value: Value?
public var value: Value

public func set(_ value: Value) {
self.value = value
}
}

extension SendableBox where Value == Int {
func increment() {
if let value {
self.value = value + 1
}
self.value = value + 1
}

func decrement() {
if let value {
self.value = value - 1
}
self.value = value - 1
}
}

Expand Down
14 changes: 14 additions & 0 deletions Sources/Basics/FileSystem/FileSystem+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,17 @@ extension FileSystem {
}
}
}

extension FileSystem {
/// Do a deep enumeration, passing each file to block
public func enumerate(directory: AbsolutePath, block: (AbsolutePath) throws -> ()) throws {
for file in try getDirectoryContents(directory) {
let path = directory.appending(file)
if isDirectory(path) {
try enumerate(directory: path, block: block)
} else {
try block(path)
}
}
}
}
Loading