Skip to content

Commit 40a345a

Browse files
committed
Merge latest changes from main branch
2 parents 859f155 + 1be6b35 commit 40a345a

File tree

85 files changed

+2011
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2011
-371
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
##
2+
## This source file is part of the Swift.org open source project
3+
##
4+
## Copyright (c) 2024-2025 Apple Inc. and the Swift project authors
5+
## Licensed under Apache License v2.0 with Runtime Library Exception
6+
##
7+
## See https://swift.org/LICENSE.txt for license information
8+
## See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
##
10+
111
# EditorConfig documentation: https://editorconfig.org
212

313
root = true

.github/workflows/pull_request.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
tests:
13+
name: Test
14+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
15+
with:
16+
linux_swift_versions: '["nightly-main", "nightly-6.2"]'
17+
windows_swift_versions: '["nightly-main", "nightly-6.2"]'
18+
enable_macos_checks: true
19+
macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.2\"}, {\"xcode_version\": \"16.3\"}]"
20+
enable_wasm_sdk_build: true
21+
soundness:
22+
name: Soundness
23+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
24+
with:
25+
license_header_check_project_name: "Swift"
26+
docs_check_enabled: false
27+
unacceptable_language_check_enabled: false
28+
format_check_enabled: false
29+
api_breakage_check_enabled: false

.license_header_template

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@@
2+
@@ This source file is part of the Swift.org open source project
3+
@@
4+
@@ Copyright (c) YEARS Apple Inc. and the Swift project authors
5+
@@ Licensed under Apache License v2.0 with Runtime Library Exception
6+
@@
7+
@@ See https://swift.org/LICENSE.txt for license information
8+
@@ See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
@@

.licenseignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Package.swift
2+
**/*.xctestplan
3+
**/*.xcscheme
4+
**/*.swiftoverlay

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Copyright (c) 2024 Apple Inc. and the Swift project authors
44
# Licensed under Apache License v2.0 with Runtime Library Exception
55
#
6-
# See http://swift.org/LICENSE.txt for license information
7-
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
6+
# See https://swift.org/LICENSE.txt for license information
7+
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
cmake_minimum_required(VERSION 3.19.6...3.29)
1010

Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# This source file is part of the Swift.org open source project
2-
#
3-
# Copyright (c) 2023 Apple Inc. and the Swift project authors
4-
# Licensed under Apache License v2.0 with Runtime Library Exception
5-
#
6-
# See https://swift.org/LICENSE.txt for license information
7-
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
1+
##
2+
## This source file is part of the Swift.org open source project
3+
##
4+
## Copyright (c) 2023 Apple Inc. and the Swift project authors
5+
## Licensed under Apache License v2.0 with Runtime Library Exception
6+
##
7+
## See https://swift.org/LICENSE.txt for license information
8+
## See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
##
810

911
FROM swiftlang/swift:nightly-main-jammy
1012

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2023–2025 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
-->
10+
11+
# Environment variables in Swift Testing
12+
13+
This document lists the environment variables that Swift Testing currently uses.
14+
This list is meant for use by developers working on Swift Testing.
15+
16+
Those environment variables marked with `*` are defined by components outside
17+
Swift Testing. In general, environment variables that Swift Testing defines have
18+
names prefixed with `SWT_`.
19+
20+
> [!WARNING]
21+
> This document is not an API contract. The set of environment variables Swift
22+
> Testing uses may change at any time.
23+
24+
## Console output
25+
26+
| Variable Name | Value Type | Notes |
27+
|-|:-:|-|
28+
| `COLORTERM`\* | `String` | Used to determine if the current terminal supports 24-bit color. Common across UNIX-like platforms. |
29+
| `NO_COLOR`[\*](https://no-color.org) | `Any?` | If set to any value, disables color output regardless of terminal capabilities. |
30+
| `SWT_ENABLE_EXPERIMENTAL_CONSOLE_OUTPUT` | `Bool` | Used to enable or disable experimental console output. |
31+
| `SWT_SF_SYMBOLS_ENABLED` | `Bool` | Used to explicitly enable or disable SF&nbsp;Symbols support on macOS. |
32+
| `TERM`[\*](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html) | `String` | Used to determine if the current terminal supports 4- or 8-bit color. Common across UNIX-like platforms. |
33+
34+
## Error handling
35+
36+
| Variable Name | Value Type | Notes |
37+
|-|:-:|-|
38+
| `SWT_FOUNDATION_ERROR_BACKTRACING_ENABLED` | `Bool` | Used to explicitly enable or disable error backtrace capturing when an instance of `NSError` or `CFError` is created on Apple platforms. |
39+
| `SWT_SWIFT_ERROR_BACKTRACING_ENABLED` | `Bool` | Used to explicitly enable or disable error backtrace capturing when a Swift error is thrown. |
40+
41+
## Event streams
42+
43+
| Variable Name | Value Type | Notes |
44+
|-|:-:|-|
45+
| `SWT_EXPERIMENTAL_EVENT_STREAM_FIELDS_ENABLED` | `Bool` | Used to explicitly enable or disable experimental fields in the JSON event stream. |
46+
| `SWT_PRETTY_PRINT_JSON` | `Bool` | Used to enable pretty-printed JSON output to the event stream (for debugging purposes). |
47+
48+
## Exit tests
49+
50+
| Variable Name | Value Type | Notes |
51+
|-|:-:|-|
52+
| `SWT_BACKCHANNEL` | `CInt`/`HANDLE` | A file descriptor (handle on Windows) to which the exit test's events are written. |
53+
| `SWT_CAPTURED_VALUES` | `CInt`/`HANDLE` | A file descriptor (handle on Windows) containing captured values passed to the exit test. |
54+
| `SWT_CLOSEFROM` | `CInt` | Used on OpenBSD to emulate `posix_spawn_file_actions_addclosefrom_np()`. |
55+
| `SWT_EXIT_TEST_ID` | `String` (JSON) | Specifies which exit test to run. |
56+
| `XCTestBundlePath`\* | `String` | Used on Apple platforms to determine if Xcode is hosting the test run. |
57+
58+
## Miscellaneous
59+
60+
| Variable Name | Value Type | Notes |
61+
|-|:-:|-|
62+
| `CFFIXED_USER_HOME`\* | `String` | Used on Apple platforms to determine the user's home directory. |
63+
| `HOME`[\*](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html) | `String` | Used to determine the user's home directory. |
64+
| `SIMULATOR_RUNTIME_BUILD_VERSION`\* | `String` | Used when running in the iOS (etc.) Simulator to determine the simulator's version. |
65+
| `SIMULATOR_RUNTIME_VERSION`\* | `String` | Used when running in the iOS (etc.) Simulator to determine the simulator's version. |
66+
| `SWT_USE_LEGACY_TEST_DISCOVERY` | `Bool` | Used to explicitly enable or disable legacy test discovery. |

Package.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ let package = Package(
218218
"_Testing_CoreGraphics",
219219
],
220220
path: "Sources/Overlays/_Testing_AppKit",
221+
exclude: ["CMakeLists.txt"],
221222
swiftSettings: .packageSettings + .enableLibraryEvolution()
222223
),
223224
.target(
@@ -226,6 +227,7 @@ let package = Package(
226227
"Testing",
227228
],
228229
path: "Sources/Overlays/_Testing_CoreGraphics",
230+
exclude: ["CMakeLists.txt"],
229231
swiftSettings: .packageSettings + .enableLibraryEvolution()
230232
),
231233
.target(
@@ -235,6 +237,7 @@ let package = Package(
235237
"_Testing_CoreGraphics",
236238
],
237239
path: "Sources/Overlays/_Testing_CoreImage",
240+
exclude: ["CMakeLists.txt"],
238241
swiftSettings: .packageSettings + .enableLibraryEvolution()
239242
),
240243
.target(
@@ -257,6 +260,7 @@ let package = Package(
257260
"_Testing_CoreImage",
258261
],
259262
path: "Sources/Overlays/_Testing_UIKit",
263+
exclude: ["CMakeLists.txt"],
260264
swiftSettings: .packageSettings + .enableLibraryEvolution()
261265
),
262266
.target(
@@ -265,6 +269,7 @@ let package = Package(
265269
"Testing",
266270
],
267271
path: "Sources/Overlays/_Testing_WinSDK",
272+
exclude: ["CMakeLists.txt"],
268273
swiftSettings: .packageSettings + .enableLibraryEvolution()
269274
),
270275

@@ -463,16 +468,16 @@ extension Array where Element == PackageDescription.CXXSetting {
463468
.define("SWT_NO_LIBDISPATCH", .whenEmbedded()),
464469
]
465470

466-
// Capture the testing library's version as a C++ string constant.
471+
// Capture the testing library's commit info as C++ constants.
467472
if let git {
468-
let testingLibraryVersion = if let tag = git.currentTag {
469-
tag
470-
} else if git.hasUncommittedChanges {
471-
"\(git.currentCommit) (modified)"
472-
} else {
473-
git.currentCommit
473+
result.append(.define("SWT_TESTING_LIBRARY_COMMIT_HASH", to: #""\#(git.currentCommit)""#))
474+
if git.hasUncommittedChanges {
475+
result.append(.define("SWT_TESTING_LIBRARY_COMMIT_MODIFIED", to: "1"))
474476
}
475-
result.append(.define("SWT_TESTING_LIBRARY_VERSION", to: #""\#(testingLibraryVersion)""#))
477+
} else if let gitHubSHA = Context.environment["GITHUB_SHA"] {
478+
// When building in GitHub Actions, the git command may fail to get us the
479+
// commit hash, so check if GitHub shared it with us instead.
480+
result.append(.define("SWT_TESTING_LIBRARY_COMMIT_HASH", to: #""\#(gitHubSHA)""#))
476481
}
477482

478483
return result

Sources/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Copyright (c) 2024 Apple Inc. and the Swift project authors
44
# Licensed under Apache License v2.0 with Runtime Library Exception
55
#
6-
# See http://swift.org/LICENSE.txt for license information
7-
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
6+
# See https://swift.org/LICENSE.txt for license information
7+
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
set(SwiftTesting_MACRO "<auto>" CACHE STRING
1010
"Path to SwiftTesting macro plugin, or '<auto>' for automatically building it")

Sources/Overlays/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# This source file is part of the Swift.org open source project
22
#
3-
# Copyright (c) 2024 Apple Inc. and the Swift project authors
3+
# Copyright (c) 2024–2025 Apple Inc. and the Swift project authors
44
# Licensed under Apache License v2.0 with Runtime Library Exception
55
#
6-
# See http://swift.org/LICENSE.txt for license information
7-
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
6+
# See https://swift.org/LICENSE.txt for license information
7+
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9+
add_subdirectory(_Testing_AppKit)
10+
add_subdirectory(_Testing_CoreGraphics)
11+
add_subdirectory(_Testing_CoreImage)
912
add_subdirectory(_Testing_Foundation)
13+
add_subdirectory(_Testing_UIKit)
14+
add_subdirectory(_Testing_WinSDK)

0 commit comments

Comments
 (0)