Skip to content

Merge main to 6.2 #8516

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 48 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
48 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
f0b3529
Merge remote-tracking branch 'origin/main' into merge-main-to-6.2
dschaefer2 Apr 28, 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
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
xcode_trim_whitespace_on_empty_lines = true

[*.{yml,yaml}]
indent_size = 2
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $> swift --version
Apple Swift version 5.3
```

Note: Alternatively use tools like [swiftenv](https://github.com/kylef/swiftenv) that help manage toolchains versions.
Note: Alternatively use tools like [swiftly](https://www.swift.org/swiftly/documentation/swiftlydocs/) that help manage toolchains versions.

## Local Development

Expand Down
26 changes: 17 additions & 9 deletions Documentation/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ This feature is intended for use in the following scenarios:

It is *not* expected that the packages would ever use this feature unless absolutely
necessary to support existing clients. Specifically, packages *should not*
adopt this syntax for tagging versions supporting the _latest GM_ Swift
adopt this syntax for tagging versions supporting the _latest released_ Swift
version.

The package manager supports looking for any of the following marked tags, in
Expand All @@ -511,7 +511,7 @@ order of preference:

The package manager will additionally look for a version-specific marked
manifest version when loading the particular version of a package, by searching
for a manifest in the form of `Package@swift-3.swift`. The set of markers
for a manifest in the form of `Package@swift-6.swift`. The set of markers
looked for is the same as for version-specific tag selection.

This feature is intended for use in cases where a package wishes to maintain
Expand All @@ -521,20 +521,28 @@ changes in the manifest API).

It is *not* expected the packages would ever use this feature unless absolutely
necessary to support existing clients. Specifically, packages *should not*
adopt this syntax for tagging versions supporting the _latest GM_ Swift
adopt this syntax for tagging versions supporting the _latest released_ Swift
version.

In case the current Swift version doesn't match any version-specific manifest,
the package manager will pick the manifest with the most compatible tools
version. For example, if there are three manifests:

`Package.swift` (tools version 3.0)
`Package@swift-4.swift` (tools version 4.0)
`Package@swift-4.2.swift` (tools version 4.2)
- `Package.swift` (tools version 6.0)
- `Package@swift-5.10.swift` (tools version 5.10)
- `Package@swift-5.9.swift` (tools version 5.9)

The package manager will pick `Package.swift` on Swift 3, `Package@swift-4.swift` on
Swift 4, and `Package@swift-4.2.swift` on Swift 4.2 and above because its tools
version will be most compatible with future version of the package manager.
The package manager will pick `Package.swift` on Swift 6 and above, because its
tools version will be most compatible with future version of the package manager.
When using Swift 5.10, it will pick `Package@swift-5.10.swift`. Otherwise, when
using Swift 5.9 it will pick `Package@swift-5.9.swift`, and this is the minimum
tools version this package may be used with.

A package may have versioned manifest files which specify newer tools versions
than its unversioned `Package.swift` file[^1]. In this scenario, the manifest
corresponding to the newest-compatible tools version will be used.

[^1]: Support for having a versioned manifest file with a _newer_ tools version was required when the feature was first introduced, because prior versions of the package manager were not aware of the concept and only knew to look for the unversioned `Package.swift`. This is still supported, but there have been many Swift releases since the feature was introduced and it is now considered best practice to have `Package.swift` declare the newest-supported tools version and for versioned manifest files to only specifer older versions.

## Editing a Package

Expand Down
14 changes: 8 additions & 6 deletions IntegrationTests/Sources/IntegrationTestSupport/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import TSCBasic
import TSCTestSupport
import enum TSCUtility.Git

public typealias ShReturnType = (stdout: String, stderr: String, returnCode: ProcessResult.ExitStatus)

public let sdkRoot: AbsolutePath? = {
if let environmentPath = ProcessInfo.processInfo.environment["SDK_ROOT"] {
return try! AbsolutePath(validating: environmentPath)
Expand Down Expand Up @@ -106,7 +108,7 @@ public let lldb: AbsolutePath = {
}()

public let swiftpmBinaryDirectory: AbsolutePath = {
if let environmentPath = ProcessInfo.processInfo.environment["SWIFTPM_BIN_DIR"] {
if let environmentPath = ProcessInfo.processInfo.environment["SWIFTPM_CUSTOM_BIN_DIR"] {
return try! AbsolutePath(validating: environmentPath)
}

Expand All @@ -131,7 +133,7 @@ public func sh(
env: [String: String] = [:],
file: StaticString = #file,
line: UInt = #line
) throws -> (stdout: String, stderr: String) {
) throws -> ShReturnType {
let result = try _sh(arguments, env: env, file: file, line: line)
let stdout = try result.utf8Output()
let stderr = try result.utf8stderrOutput()
Expand All @@ -145,7 +147,7 @@ public func sh(
)
}

return (stdout, stderr)
return (stdout, stderr, result.exitStatus)
}

@discardableResult
Expand All @@ -154,7 +156,7 @@ public func shFails(
env: [String: String] = [:],
file: StaticString = #file,
line: UInt = #line
) throws -> (stdout: String, stderr: String) {
) throws -> ShReturnType {
let result = try _sh(arguments, env: env, file: file, line: line)
let stdout = try result.utf8Output()
let stderr = try result.utf8stderrOutput()
Expand All @@ -168,7 +170,7 @@ public func shFails(
)
}

return (stdout, stderr)
return (stdout, stderr, result.exitStatus)
}

@discardableResult
Expand Down Expand Up @@ -385,4 +387,4 @@ extension ProcessResult {
\((try? utf8stderrOutput()) ?? "")
"""
}
}
}
92 changes: 47 additions & 45 deletions IntegrationTests/Tests/IntegrationTests/BasicTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private struct BasicTests {
}

@Test(
.skipHostOS(.windows, "'try!' expression unexpectedly raised an error: TSCBasic.Process.Error.missingExecutableProgram(program: \"which\")"),
.skipHostOS(.windows, "'try!' expression unexpectedly raised an error: TSCBasic.Process.Error.missingExecutableProgram(program: \"which\")")
)
func testSwiftCompiler() throws {
try withTemporaryDirectory { tempDir in
Expand Down Expand Up @@ -124,22 +124,22 @@ private struct BasicTests {
let packagePath = tempDir.appending(component: "Project")
try localFileSystem.createDirectory(packagePath)
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "executable")
let buildOutput = try sh(swiftBuild, "--package-path", packagePath).stdout
let packageOutput = try sh(swiftBuild, "--package-path", packagePath)

// Check the build log.
let checker = StringChecker(string: buildOutput)
#expect(checker.check(.regex("Compiling .*Project.*")))
#expect(checker.check(.regex("Linking .*Project")))
#expect(checker.check(.contains("Build complete")))
let checker = StringChecker(string: packageOutput.stdout)
#expect(checker.check(.regex("Compiling .*Project.*")), "stdout: '\(packageOutput.stdout)'\n stderr:'\(packageOutput.stderr)'")
#expect(checker.check(.regex("Linking .*Project")), "stdout: '\(packageOutput.stdout)'\n stderr:'\(packageOutput.stderr)'")
#expect(checker.check(.contains("Build complete")), "stdout: '\(packageOutput.stdout)'\n stderr:'\(packageOutput.stderr)'")

// Verify that the tool was built and works.
let toolOutput = try sh(packagePath.appending(components: ".build", "debug", "Project"))
.stdout
#expect(toolOutput.lowercased().contains("hello, world!"))

// Check there were no compile errors or warnings.
#expect(buildOutput.contains("error") == false)
#expect(buildOutput.contains("warning") == false)
#expect(packageOutput.stdout.contains("error") == false)
#expect(packageOutput.stdout.contains("warning") == false)
}
}

Expand All @@ -151,17 +151,19 @@ private struct BasicTests {
try localFileSystem.createDirectory(packagePath)
withKnownIssue("error: no tests found; create a target in the 'Tests' directory") {
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "executable")
let testOutput = try sh(swiftTest, "--package-path", packagePath).stdout
let packageOutput = try sh(swiftTest, "--package-path", packagePath, "--vv")

// Check the test log.
let checker = StringChecker(string: testOutput)
#expect(checker.check(.regex("Compiling .*ProjectTests.*")))
#expect(checker.check("Test Suite 'All tests' passed"))
#expect(checker.checkNext("Executed 1 test"))
let checker = StringChecker(string: packageOutput.stdout)
#expect(checker.check(.regex("Compiling .*ProjectTests.*")), "stdout: '\(packageOutput.stdout)'\n stderr:'\(packageOutput.stderr)'")
#expect(checker.checkNext("Executed 1 test"), "stdout: '\(packageOutput.stdout)'\n stderr:'\(packageOutput.stderr)'")

// Check the return code
#expect(packageOutput.returnCode == .terminated(code: 0))

// Check there were no compile errors or warnings.
#expect(testOutput.contains("error") == false)
#expect(testOutput.contains("warning") == false)
#expect(packageOutput.stdout.contains("error") == false)
#expect(packageOutput.stdout.contains("warning") == false)
}
}
}
Expand Down Expand Up @@ -192,17 +194,14 @@ private struct BasicTests {
let packagePath = tempDir.appending(component: "Project")
try localFileSystem.createDirectory(packagePath)
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "library")
let testOutput = try sh(swiftTest, "--package-path", packagePath).stdout
let shOutput = try sh(swiftTest, "--package-path", packagePath)

// Check the test log.
let checker = StringChecker(string: testOutput)
#expect(checker.check(.contains("Test Suite 'All tests' started")))
#expect(checker.check(.contains("Test example() passed after")))
#expect(checker.checkNext(.contains("Test run with 1 test passed after")))
// Check the return code
#expect(shOutput.returnCode == .terminated(code: 0))

// Check there were no compile errors or warnings.
#expect(testOutput.contains("error") == false)
#expect(testOutput.contains("warning") == false)
#expect(shOutput.stdout.contains("error") == false)
#expect(shOutput.stdout.contains("warning") == false)
}
}

Expand Down Expand Up @@ -248,11 +247,11 @@ private struct BasicTests {
#expect(buildOutput.contains("Build complete"))

// Verify that the tool exists and works.
let toolOutput = try sh(
let shOutput = try sh(
packagePath.appending(components: ".build", "debug", "special tool")
).stdout

#expect(toolOutput == "HI\(ProcessInfo.EOL)")
#expect(shOutput == "HI\(ProcessInfo.EOL)")
}
}

Expand Down Expand Up @@ -281,17 +280,20 @@ private struct BasicTests {
"""
)
)
let (runOutput, runError) = try sh(
let shOutput = try sh(
swiftRun, "--package-path", packagePath, "secho", "1", #""two""#
)

// Check the run log.
let checker = StringChecker(string: runError)
#expect(checker.check(.regex("Compiling .*secho.*")))
#expect(checker.check(.regex("Linking .*secho")))
#expect(checker.check(.contains("Build of product 'secho' complete")))
let checker = StringChecker(string: shOutput.stderr)
#expect(checker.check(.regex("Compiling .*secho.*")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.regex("Linking .*secho")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.contains("Build of product 'secho' complete")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")

#expect(shOutput.stdout == "1 \"two\"\(ProcessInfo.EOL)")

#expect(runOutput == "1 \"two\"\(ProcessInfo.EOL)")
// Check the return code
#expect(shOutput.returnCode == .terminated(code: 0))
}
}

Expand All @@ -318,16 +320,16 @@ private struct BasicTests {
"""
)
)
let testOutput = try sh(
let shOutput = try sh(
swiftTest, "--package-path", packagePath, "--filter", "MyTests.*", "--skip",
"testBaz"
).stderr
"testBaz", "--vv"
)

// Check the test log.
let checker = StringChecker(string: testOutput)
#expect(checker.check(.contains("Test Suite 'MyTests' started")))
#expect(checker.check(.contains("Test Suite 'MyTests' passed")))
#expect(checker.check(.contains("Executed 2 tests, with 0 failures")))
let checker = StringChecker(string: shOutput.stderr)
#expect(checker.check(.contains("Test Suite 'MyTests' started")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.contains("Test Suite 'MyTests' passed")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.contains("Executed 2 tests, with 0 failures")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
}
}

Expand Down Expand Up @@ -410,15 +412,15 @@ private struct BasicTests {
)
)

let testOutput = try sh(
swiftTest, "--package-path", packagePath, "--filter", "MyTests.*"
).stdout
let shOutput = try sh(
swiftTest, "--package-path", packagePath, "--filter", "MyTests.*", "--vv"
)

// Check the test log.
let checker = StringChecker(string: testOutput)
#expect(checker.check(.contains("Test Suite 'MyTests' started")))
#expect(checker.check(.contains("Test Suite 'MyTests' passed")))
#expect(checker.check(.contains("Executed 2 tests, with 0 failures")))
let checker = StringChecker(string: shOutput.stdout)
#expect(checker.check(.contains("Test Suite 'MyTests' started")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.contains("Test Suite 'MyTests' passed")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
#expect(checker.check(.contains("Executed 2 tests, with 0 failures")), "stdout: '\(shOutput.stdout)'\n stderr:'\(shOutput.stderr)'")
}
}
}
Expand Down
Loading