Skip to content

6.2 merge main 0602 #8754

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 151 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 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
477466d
Add `.staticLibrary` support for binary targets (#8639)
FranzBusch May 13, 2025
fee72c5
CLI command docs (#8642)
heckj May 13, 2025
a60c617
Tests: Convert Environment/Graph and other suites to ST (#8663)
bkhouri May 14, 2025
c515bda
Fix comment typo in `SwiftCommandState.swift` (#8667)
MaxDesiatov May 14, 2025
ebe8d82
Clarify release branch cherry-picks process in `CONTRIBUTING.md` (#8634)
MaxDesiatov May 14, 2025
9804c81
Copy helpers internally - take 3 (#8495)
bkhouri May 14, 2025
e947d92
clean up misformatting for CLI command options (#8666)
heckj May 14, 2025
c5009fd
SwiftBuild: Fix executable can't find dynamic lib runtime error (#8650)
pmattos May 15, 2025
df28439
Fix typos in package registry documentation (#8669)
robinkunde May 15, 2025
02fe923
Use WasmKit by default for Wasm triples in toolsets (#8668)
MaxDesiatov May 15, 2025
2e98598
Fixes many tests (plus skips) to get more tests running on windows (#…
daveinglis May 15, 2025
0c47332
Include search path for Swift Testing's macro plugin from toolchain i…
stmontgomery May 15, 2025
64b4746
SwiftFixIt: Misc improvements (#8671)
AnthonyLatsis May 16, 2025
6d4ce1c
Add target name to PIF graphviz output (#8678)
pmattos May 16, 2025
57ce13a
Migrate README (#8621)
heckj May 16, 2025
99b0b06
Clean up some Darwin platform conditions
jakepetroules May 16, 2025
955d36a
Tests: Convert RegistryClientTests to Swift Testing (#8640)
plemarquand May 21, 2025
43aa87a
[Commands] Migrate: Group manifest update errors per target (#8677)
xedin May 21, 2025
297b487
[Commands] Migrate: Avoid injecting feature settings into every Swift…
xedin May 21, 2025
6e8b312
[Commands] AddSetting: Searching for a target in the manifest shouldn…
xedin May 22, 2025
d0d9f62
Add new maintainers to migrate command and SwiftFixIt module (#8713)
xedin May 23, 2025
f54a325
[CODEOWNERS] Move code owners for specific directories/files under wi…
xedin May 23, 2025
5fe143f
Mark completion callbacks as Sendable (#8712)
plemarquand May 23, 2025
ccbf01f
Fix issue with running test on windows w/no-parallel (#8676)
daveinglis May 24, 2025
99bd4ed
Dynamically determine the swift compiler version. (#8708)
dschaefer2 May 24, 2025
cc4468b
[test] SwiftFixIt: Switch to Swift Testing (#8683)
AnthonyLatsis May 24, 2025
789ace3
[Swift migrate] Handle migration for optional features (#8711)
DougGregor May 24, 2025
352b820
Convert git WorkingCopy API to async (#8681)
plemarquand May 24, 2025
8156d48
Improve output formatting with Swift Build backend
jakepetroules May 24, 2025
dcab689
swift-package-migrate: Report a fix-it application summary (#8684)
AnthonyLatsis May 25, 2025
8ab590c
Swift Build: pass some additional settings needed for cross-compilation
jakepetroules May 24, 2025
5539bc1
Migrate PackageDescription.md reference (#8675)
bripeticca May 26, 2025
ed2dfbb
Curate (organize layout) and remove DocC warnings for PackageDescript…
heckj May 26, 2025
1cbb77a
Pass the correct toolchain path to SwiftBuild
jakepetroules May 24, 2025
3eac931
Partial migration of Usage.md - topics related to dependencies and C …
heckj May 27, 2025
4e45170
build-using-self: Add ability to pass extra build/run/test arguments …
kcieplak May 27, 2025
f625710
Generate the compatibility header for libraries on all platforms (#8695)
xymus May 27, 2025
1d9f2b9
SwiftFixIt: Always rely on the UTF-8 offset of an input source location
AnthonyLatsis May 27, 2025
c37bf5e
Allow staging in new BuildSettings.Declaration cases without introduc…
owenv May 28, 2025
7c5e290
[test] SwiftFixIt: Add XFAILed test for duplicate insertion fix-its
AnthonyLatsis May 28, 2025
612d503
Wire up the plugin script runner to the PIF Builder for build tool pl…
cmcgee1024 May 29, 2025
3d239c9
Pass the correct toolchain path to SwiftBuild on Windows and FreeBSD
jakepetroules May 28, 2025
e75b4d2
Tests: Convert StaticBinaryLibrary Test to Swift Testing (#8685)
bkhouri May 29, 2025
5dc2e3c
Fix several warnings across the codebase (#8743)
AndrewHoos May 30, 2025
4a33cc7
Add PackageIdentity to Workspace prebuilt delegate methods (#8740)
plemarquand May 30, 2025
598a053
Move to TrieTest to swift-testing (#8742)
AndrewHoos May 30, 2025
0fa9f73
Port contents of `Documentation/PackageSecurity.md` to DocC (#8726)
bripeticca May 30, 2025
fa5fcdb
Port contents of `Documentation/libSwiftPM.md` to DocC (#8725)
bripeticca May 30, 2025
443fa2d
Add sandboxing to build tool plugins in swiftbuild build system (#8747)
cmcgee1024 May 31, 2025
c5d77e5
Detect embedded swift in flags (#8693)
rauhul Jun 1, 2025
4dce989
Leverage package graph, add include paths. (#8750)
dschaefer2 Jun 2, 2025
d2c203d
Merge remote-tracking branch 'origin/main' into 62-merge-main-0602
dschaefer2 Jun 2, 2025
3d5612d
Clean up stuff that snuck through the merge
dschaefer2 Jun 2, 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
7 changes: 5 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

# The following lines are used by GitHub to automatically recommend reviewers.

Sources/XCBuildSupport/* @jakepetroules

* @jakepetroules @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123

Sources/XCBuildSupport/* @jakepetroules
Sources/Commands/PackageCommands/Migrate.swift @AnthonyLatsis @bnbarham @xedin @jakepetroules @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123
Sources/SwiftFixIt/* @AnthonyLatsis @bnbarham @xedin @jakepetroules @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123
Tests/SwiftFixItTests/* @AnthonyLatsis @bnbarham @xedin @jakepetroules @dschaefer2 @shawnhyam @bripeticca @plemarquand @owenv @bkhouri @cmcgee1024 @daveyc123
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ your contribution to Apple and the community, and agree by submitting the patch
that your contributions are licensed under the [Swift
license](https://swift.org/LICENSE.txt).

After a change is known not to cause regressions in the `main` branch, it may be considered for cherry-picking to the latest release branch depending on the release schedule. Cherry-picks require [a specific template to be followed](https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md) in PR description that consolidates information about the change necessary for inclusion in the release branch and provides risk evaluation for nominating the change.

## Continuous Integration

SwiftPM uses [swift-ci](https://ci.swift.org) infrastructure for its continuous integration testing. The bots can be triggered on pull-requests if you have commit access. Otherwise, ask one of the code owners to trigger them for you.
Expand Down
311 changes: 0 additions & 311 deletions Documentation/Design/PackageManagerCommunityProposal.md

This file was deleted.

2 changes: 1 addition & 1 deletion Documentation/PackageRegistry/PackageRegistryUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Here is an example of a source control dependency:

```swift
dependencies: [
.package(id: "https://github.com/mona/LinkedList", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/mona/LinkedList", .upToNextMajor(from: "1.0.0")),
],
```

Expand Down
2 changes: 1 addition & 1 deletion Documentation/PackageRegistry/Registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ Content-Disposition: attachment; filename="Package.swift"
Content-Length: 361
Content-Version: 1
Link: <http://packages.example.com/mona/LinkedList/1.1.1/Package.swift?swift-version=4>; rel="alternate"; filename="[email protected]"; swift-tools-version="4.0",
<http://packages.example.com/mona/LinkedList/1.1.1/Package.swift?swift-version=4.2>; rel="alternate"; filename="[email protected]"; swift-tools-version="4.0"
<http://packages.example.com/mona/LinkedList/1.1.1/Package.swift?swift-version=4.2>; rel="alternate"; filename="[email protected]"; swift-tools-version="4.2"

// swift-tools-version:5.0
import PackageDescription
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
#if os(macOS) || os(iOS)
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif canImport(Bionic)
import Bionic
#endif

public extension Collection {
func shuffle() -> [Iterator.Element] {
Expand All @@ -24,15 +15,13 @@ public extension MutableCollection {
guard c > 1 else { return }

for (firstUnshuffled, unshuffledCount) in zip(indices, stride(from: c, to: 1, by: -1)) {
#if os(macOS) || os(iOS)
let d = arc4random_uniform(numericCast(unshuffledCount))
#else
let d = numericCast(random()) % unshuffledCount
#endif
let i = index(firstUnshuffled, offsetBy: numericCast(d))
var g = SystemRandomNumberGenerator()
let d = Int.random(in: 1...unshuffledCount, using: &g)
let i = index(firstUnshuffled, offsetBy: d)
swapAt(firstUnshuffled, i)
}
}
}


public let shuffle = false
5 changes: 4 additions & 1 deletion Fixtures/Miscellaneous/AtMainSupport/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ let package = Package(
.executable(name: "SwiftExecMultiFile", targets: ["SwiftExecMultiFile"]),
],
targets: [
.executableTarget(name: "ClangExecSingleFile"),
.executableTarget(name: "ClangExecSingleFile",
linkerSettings: [
.linkedLibrary("swiftCore", .when(platforms: [.windows])), // for swift_addNewDSOImage
]),
.executableTarget(name: "SwiftExecSingleFile"),
.executableTarget(name: "SwiftExecMultiFile"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import Musl
#elseif canImport(Android)
import Android
#else
#elseif canImport(Darwin.C)
import Darwin.C
#elseif canImport(ucrt)
import ucrt
let PATH_MAX = 260
typealias Int = Int32
#endif

let cwd = getcwd(nil, Int(PATH_MAX))
Expand Down
2 changes: 2 additions & 0 deletions Fixtures/Miscellaneous/EchoExecutable/echo.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo sentinel
echo %*
6 changes: 6 additions & 0 deletions Fixtures/Miscellaneous/EchoExecutable/toolset.win32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"debugger": { "path": "echo.bat" },
"testRunner": { "path": "echo.bat" },
"schemaVersion" : "1.0",
"rootPath" : "."
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 6.0

import PackageDescription

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import PackagePlugin
import Foundation

#if os(Android)
let touchExe = "/system/bin/touch"
let touchArgs: [String] = []
#elseif os(Windows)
let touchExe = "C:/Windows/System32/cmd.exe"
let touchArgs = ["/c", "copy", "NUL"]
#else
let touchExe = "/usr/bin/touch"
let touchArgs: [String] = []
#endif

@main
Expand All @@ -12,9 +18,9 @@ struct GeneratorPlugin: BuildToolPlugin {
return [
.prebuildCommand(
displayName: "Generating empty file",
executable: .init(touchExe),
arguments: [context.pluginWorkDirectory.appending("best.txt")],
outputFilesDirectory: context.pluginWorkDirectory
executable: .init(fileURLWithPath: touchExe),
arguments: touchArgs + [String(cString: (context.pluginWorkDirectoryURL.appending(path: "best.txt") as NSURL).fileSystemRepresentation)],
outputFilesDirectory: context.pluginWorkDirectoryURL
)
]
}
Expand Down
16 changes: 13 additions & 3 deletions Fixtures/Miscellaneous/TestableExe/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ let package = Package(
name: "TestableExe",
targets: [
.executableTarget(
name: "TestableExe1"
name: "TestableExe1",
linkerSettings: [
.linkedLibrary("swiftCore", .when(platforms: [.windows])), // for swift_addNewDSOImage
]
),
.executableTarget(
name: "TestableExe2"
name: "TestableExe2",
linkerSettings: [
.linkedLibrary("swiftCore", .when(platforms: [.windows])), // for swift_addNewDSOImage
]

),
.executableTarget(
name: "TestableExe3"
name: "TestableExe3",
linkerSettings: [
.linkedLibrary("swiftCore", .when(platforms: [.windows])), // for swift_addNewDSOImage
]
),
.testTarget(
name: "TestableExeTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import XCTest
import class Foundation.Bundle

final class TestableExeTests: XCTestCase {

#if os(Windows)
let eol = "\r\n"
#else
let eol = "\n"
#endif

func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
Expand All @@ -30,7 +37,7 @@ final class TestableExeTests: XCTestCase {
process.waitUntilExit()
var data = pipe.fileHandleForReading.readDataToEndOfFile()
var output = String(data: data, encoding: .utf8)
XCTAssertEqual(output, "Hello, world!\n")
XCTAssertEqual(output, "Hello, world!\(eol)")

execPath = productsDirectory.appendingPathComponent("TestableExe2")
process = Process()
Expand All @@ -41,7 +48,7 @@ final class TestableExeTests: XCTestCase {
process.waitUntilExit()
data = pipe.fileHandleForReading.readDataToEndOfFile()
output = String(data: data, encoding: .utf8)
XCTAssertEqual(output, "Hello, planet!\n")
XCTAssertEqual(output, "Hello, planet!\(eol)")

execPath = productsDirectory.appendingPathComponent("TestableExe3")
process = Process()
Expand All @@ -52,7 +59,7 @@ final class TestableExeTests: XCTestCase {
process.waitUntilExit()
data = pipe.fileHandleForReading.readDataToEndOfFile()
output = String(data: data, encoding: .utf8)
XCTAssertEqual(output, "Hello, universe!\n")
XCTAssertEqual(output, "Hello, universe!\(eol)")
}

/// Returns path to the built products directory.
Expand Down
22 changes: 7 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,13 @@ let package = Package(
dependencies: ["XCBuildSupport", "_InternalTestSupport", "_InternalBuildTestSupport"],
exclude: ["Inputs/Foo.pc"]
),
.testTarget(
name: "FunctionalPerformanceTests",
dependencies: [
"swift-package-manager",
"_InternalTestSupport",
]
),
// Examples (These are built to ensure they stay up to date with the API.)
.executableTarget(
name: "package-info",
Expand All @@ -963,19 +970,6 @@ package.targets.append(contentsOf: [
])
#endif

// Workaround SwiftPM's attempt to link in executables which does not work on all
// platforms.
#if !os(Windows)
package.targets.append(contentsOf: [
.testTarget(
name: "FunctionalPerformanceTests",
dependencies: [
"swift-package-manager",
"_InternalTestSupport",
]
),
])

// rdar://101868275 "error: cannot find 'XCTAssertEqual' in scope" can affect almost any functional test, so we flat out
// disable them all until we know what is going on
if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == nil {
Expand All @@ -988,7 +982,6 @@ if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] ==
"_InternalTestSupport",
]
),

.executableTarget(
name: "dummy-swiftc",
dependencies: [
Expand Down Expand Up @@ -1019,7 +1012,6 @@ if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] ==
),
])
}
#endif


func swiftSyntaxDependencies(_ names: [String]) -> [Target.Dependency] {
Expand Down
1 change: 1 addition & 0 deletions Sources/Basics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ add_library(Basics
Netrc.swift
Observability.swift
OSSignpost.swift
Process.swift
ProgressAnimation/NinjaProgressAnimation.swift
ProgressAnimation/PercentProgressAnimation.swift
ProgressAnimation/ProgressAnimationProtocol.swift
Expand Down
4 changes: 2 additions & 2 deletions Sources/Basics/Cancellator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class Cancellator: Cancellable, Sendable {
self.register(name: "\(process.arguments.joined(separator: " "))", handler: process.terminate)
}

#if !os(iOS) && !os(watchOS) && !os(tvOS)
#if !canImport(Darwin) || os(macOS)
public func register(_ process: Foundation.Process) -> RegistrationKey? {
self.register(name: "\(process.description)", handler: process.terminate(timeout:))
}
Expand Down Expand Up @@ -245,7 +245,7 @@ extension AsyncProcess {
}
}

#if !os(iOS) && !os(watchOS) && !os(tvOS)
#if !canImport(Darwin) || os(macOS)
extension Foundation.Process {
fileprivate func terminate(timeout: DispatchTime) {
guard self.isRunning else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/DispatchTimeInterval+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension DispatchTimeInterval {
return String(format: "%.2f", Double(value) / Double(1_000_000_000)) + "s"
case .never:
return "n/a"
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
#if canImport(Darwin)
@unknown default:
return "n/a"
#endif
Expand Down
68 changes: 3 additions & 65 deletions Sources/Basics/JSON+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,8 @@ import class Foundation.DateFormatter
import class Foundation.JSONDecoder
import class Foundation.JSONEncoder

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
extension DateFormatter {
public static let iso8601: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
return dateFormatter
}()
}

extension JSONEncoder.DateEncodingStrategy {
public static let customISO8601 = custom {
var container = $1.singleValueContainer()
try container.encode(DateFormatter.iso8601.string(from: $0))
}
}

extension JSONDecoder.DateDecodingStrategy {
public static let customISO8601 = custom {
let container = try $0.singleValueContainer()
let string = try container.decode(String.self)
if let date = DateFormatter.iso8601.date(from: string) {
return date
}
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Invalid date: \(string)")
}
}
#endif

extension JSONEncoder.DateEncodingStrategy {
public static var safeISO8601: JSONEncoder.DateEncodingStrategy {
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
return .iso8601
} else {
return .customISO8601
}
#else
return .iso8601
#endif
}
}

extension JSONDecoder.DateDecodingStrategy {
public static var safeISO8601: JSONDecoder.DateDecodingStrategy {
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
return .iso8601
} else {
return .customISO8601
}
#else
return .iso8601
#endif
}
}

extension JSONDecoder {
public static func makeWithDefaults(dateDecodingStrategy: DateDecodingStrategy = .safeISO8601) -> JSONDecoder {
public static func makeWithDefaults(dateDecodingStrategy: DateDecodingStrategy = .iso8601) -> JSONDecoder {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = dateDecodingStrategy
return decoder
Expand All @@ -82,7 +26,7 @@ extension JSONDecoder {
extension JSONEncoder {
public static func makeWithDefaults(
prettified: Bool = true,
dateEncodingStrategy: DateEncodingStrategy = .safeISO8601
dateEncodingStrategy: DateEncodingStrategy = .iso8601
) -> JSONEncoder {
Self.makeWithDefaults(
sortKeys: prettified,
Expand All @@ -96,19 +40,13 @@ extension JSONEncoder {
sortKeys: Bool,
prettyPrint: Bool,
escapeSlashes: Bool,
dateEncodingStrategy: DateEncodingStrategy = .safeISO8601
dateEncodingStrategy: DateEncodingStrategy = .iso8601
) -> JSONEncoder {
let encoder = JSONEncoder()
var outputFormatting: JSONEncoder.OutputFormatting = []

if sortKeys {
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
if #available(macOS 10.15, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
outputFormatting.insert(.sortedKeys)
}
#else
outputFormatting.insert(.sortedKeys)
#endif
}
if prettyPrint {
outputFormatting.insert(.prettyPrinted)
Expand Down
Loading