Skip to content

Commit d2c0d1b

Browse files
committed
Merge branch 'main' into t/main/gh8121_radar139977454_swift_test_on_windows
2 parents dcf82c8 + 8268261 commit d2c0d1b

File tree

208 files changed

+16563
-5479
lines changed

Some content is hidden

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

208 files changed

+16563
-5479
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Note: This is in reverse chronological order, so newer entries are added to the
33
Swift Next
44
-----------
55

6+
Swift 6.2
7+
---------
8+
9+
* [#8314]
10+
11+
Starting from tools-version 6.2, `SwiftSetting` provides a `strictMemorySafety` setting to enable the strict memory safety checking introduced in [SE-0458].
12+
613
Swift 6.0
714
-----------
815

@@ -393,7 +400,7 @@ Swift 3.0
393400
[SE-0387]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md
394401
[SE-0391]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0391-package-registry-publish.md
395402
[SE-0387 proposal text]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#swift-sdk-installation-and-configuration
396-
403+
[SE-0458]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0458-strict-memory-safety.md
397404
[SR-5918]: https://bugs.swift.org/browse/SR-5918
398405
[SR-6978]: https://bugs.swift.org/browse/SR-6978
399406
[SR-13566]: https://bugs.swift.org/browse/SR-13566

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ find_package(Foundation QUIET)
5252
find_package(SQLite3 REQUIRED)
5353

5454
# Enable `package` modifier for the whole package.
55-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:-package-name;SwiftPM>")
55+
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
56+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:-package-name;SwiftPM>" -L/usr/local/lib)
57+
else()
58+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:-package-name;SwiftPM>")
59+
endif()
5660

5761
add_subdirectory(BuildSupport/SwiftSyntax)
5862
add_subdirectory(Sources)

CONTRIBUTING.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,26 +174,19 @@ Clone the following repositories beside the SwiftPM directory:
174174
$> git clone https://github.com/apple/swift-tools-support-core
175175
```
176176

177-
4. [Yams] and checkout tag with the [latest version](https://github.com/jpsim/Yams.git/tags) before 5.0.0.
178-
179-
For example, if the latest tag is 4.0.6:
180-
```sh
181-
$> git clone https://github.com/jpsim/yams --branch 4.0.6
182-
```
183-
184-
5. [swift-driver]
177+
4. [swift-driver]
185178
```sh
186179
$> git clone https://github.com/apple/swift-driver
187180
```
188181

189-
6. [swift-system] and check out tag with the [latest version](https://github.com/apple/swift-system/tags).
182+
5. [swift-system] and check out tag with the [latest version](https://github.com/apple/swift-system/tags).
190183

191184
For example, if the latest tag is 1.0.0:
192185
```sh
193186
$> git clone https://github.com/apple/swift-system --branch 1.0.0
194187
```
195188

196-
7. [swift-collections] and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
189+
6. [swift-collections] and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
197190

198191
For example, if the latest tag is 1.0.1:
199192
```sh
@@ -217,6 +210,16 @@ Clone the following repositories beside the SwiftPM directory:
217210
$> git clone https://github.com/apple/swift-certificates
218211
```
219212

213+
10. [swift-syntax]
214+
```sh
215+
$> git clone https://github.com/swiftlang/swift-syntax
216+
```
217+
218+
11. [swift-toolchain-sqlite]
219+
```sh
220+
$> git clone https://github.com/swiftlang/swift-toolchain-sqlite
221+
```
222+
220223
[swift-argument-parser]: https://github.com/apple/swift-argument-parser
221224
[swift-collections]: https://github.com/apple/swift-collections
222225
[swift-driver]: https://github.com/apple/swift-driver
@@ -226,7 +229,8 @@ Clone the following repositories beside the SwiftPM directory:
226229
[swift-crypto]: https://github.com/apple/swift-crypto
227230
[swift-asn1]: https://github.com/apple/swift-asn1
228231
[swift-certificates]: https://github.com/apple/swift-certificates
229-
[Yams]: https://github.com/jpsim/yams
232+
[swift-toolchain-sqlite]: https://github.com/swiftlang/swift-toolchain-sqlite
233+
[swift-syntax]: https://github.com/swiftlang/swift-syntax
230234

231235

232236
#### Building
@@ -319,7 +323,7 @@ Note there are several Linux and Swift versions options to choose from, e.g.:
319323
3. Create a new branch
320324
4. Make your code changes
321325
5. Try to keep your changes (when possible) below 200 lines of code.
322-
6. We use [SwiftFormat](https://www.github.com/nicklockwood/SwiftFormat) to enforce code style. Please install and run SwiftFormat before submitting your PR.
326+
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.
323327
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).
324328
8. Push the commit / branch to your fork
325329
9. Make a PR from your fork / branch to `apple: main`

Documentation/Design/EvolutionIdeas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Bug: N/A
190190
We need an easy way to edit the Package.swift manifest from automated tools, for
191191
cases where you don't want users to have to update the Swift code directly. We
192192
think that it's possible to provide an API to allow this, probably using
193-
[`SwiftSyntax`](https://github.com/apple/swift/tree/master/tools/SwiftSyntax).
193+
[`SwiftSyntax`](https://github.com/swiftlang/swift-syntax).
194194

195195
Thread: N/A
196196
Bug: N/A

Documentation/Usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ You can link against system libraries using the package manager. To do so, you'l
140140
need to add a special `target` of type `.systemLibrary`, and a `module.modulemap`
141141
for each system library you're using.
142142

143-
Let's see an example of adding [libgit2](https://libgit2.github.com) as a
143+
Let's see an example of adding [libgit2](https://github.com/libgit2/libgit2) as a
144144
dependency to an executable target.
145145

146146
Create a directory called `example`, and initialize it as a package that
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import XCTest
22

33
final class CheckTestLibraryEnvironmentVariableTests: XCTestCase {
4-
func testEnvironmentVariable() throws {
5-
let envvar = ProcessInfo.processInfo.environment["SWIFT_TESTING_ENABLED"]
6-
XCTAssertEqual(envvar, "0")
4+
func testEnvironmentVariables() throws {
5+
#if !os(macOS)
6+
try XCTSkipIf(true, "Test is macOS specific")
7+
#endif
8+
9+
let testingEnabled = ProcessInfo.processInfo.environment["SWIFT_TESTING_ENABLED"]
10+
XCTAssertEqual(testingEnabled, "0")
11+
12+
if ProcessInfo.processInfo.environment["CONTAINS_SWIFT_TESTING"] != nil {
13+
let frameworkPath = try XCTUnwrap(ProcessInfo.processInfo.environment["DYLD_FRAMEWORK_PATH"])
14+
let libraryPath = try XCTUnwrap(ProcessInfo.processInfo.environment["DYLD_LIBRARY_PATH"])
15+
XCTAssertTrue(
16+
frameworkPath.contains("testing") || libraryPath.contains("testing"),
17+
"Expected 'testing' in '\(frameworkPath)' or '\(libraryPath)'"
18+
)
19+
}
720
}
821
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// swift-tools-version: 6.1
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "DisablingEmptyDefaultsExample",
7+
dependencies: [
8+
.package(
9+
path: "../Package11",
10+
traits: []
11+
),
12+
],
13+
targets: [
14+
.executableTarget(
15+
name: "DisablingEmptyDefaultsExample"
16+
),
17+
]
18+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@main
2+
struct Example {
3+
static func main() {
4+
5+
}
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// swift-tools-version: 6.1
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "Package11",
7+
products: [
8+
.library(
9+
name: "Package11Library1",
10+
targets: ["Package11Library1"]
11+
),
12+
],
13+
targets: [
14+
.target(
15+
name: "Package11Library1"
16+
),
17+
]
18+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public func hello() {
2+
print("Package11Library1")
3+
}

IntegrationTests/Tests/IntegrationTests/BasicTests.swift

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ final class BasicTests: XCTestCase {
1919

2020
func testExamplePackageDealer() throws {
2121
try XCTSkipIf(isSelfHosted, "These packages don't use the latest runtime library, which doesn't work with self-hosted builds.")
22-
try skipUnlessAtLeastSwift6()
2322

2423
try withTemporaryDirectory { tempDir in
2524
let packagePath = tempDir.appending(component: "dealer")
@@ -94,8 +93,6 @@ final class BasicTests: XCTestCase {
9493
}
9594

9695
func testSwiftPackageInitExec() throws {
97-
try skipUnlessAtLeastSwift6()
98-
9996
try withTemporaryDirectory { tempDir in
10097
// Create a new package with an executable target.
10198
let packagePath = tempDir.appending(component: "Project")
@@ -121,8 +118,6 @@ final class BasicTests: XCTestCase {
121118
}
122119

123120
func testSwiftPackageInitExecTests() throws {
124-
try skipUnlessAtLeastSwift6()
125-
126121
try XCTSkip("FIXME: swift-test invocations are timing out in Xcode and self-hosted CI")
127122

128123
try withTemporaryDirectory { tempDir in
@@ -146,8 +141,6 @@ final class BasicTests: XCTestCase {
146141
}
147142

148143
func testSwiftPackageInitLib() throws {
149-
try skipUnlessAtLeastSwift6()
150-
151144
try withTemporaryDirectory { tempDir in
152145
// Create a new package with an executable target.
153146
let packagePath = tempDir.appending(component: "Project")
@@ -166,8 +159,6 @@ final class BasicTests: XCTestCase {
166159
}
167160

168161
func testSwiftPackageLibsTests() throws {
169-
try skipUnlessAtLeastSwift6()
170-
171162
try XCTSkip("FIXME: swift-test invocations are timing out in Xcode and self-hosted CI")
172163

173164
try withTemporaryDirectory { tempDir in
@@ -226,8 +217,6 @@ final class BasicTests: XCTestCase {
226217
}
227218

228219
func testSwiftRun() throws {
229-
try skipUnlessAtLeastSwift6()
230-
231220
try withTemporaryDirectory { tempDir in
232221
let packagePath = tempDir.appending(component: "secho")
233222
try localFileSystem.createDirectory(packagePath)
@@ -255,8 +244,6 @@ final class BasicTests: XCTestCase {
255244
}
256245

257246
func testSwiftTest() throws {
258-
try skipUnlessAtLeastSwift6()
259-
260247
try XCTSkip("FIXME: swift-test invocations are timing out in Xcode and self-hosted CI")
261248

262249
try withTemporaryDirectory { tempDir in
@@ -378,9 +365,3 @@ private extension Character {
378365
}
379366
}
380367
}
381-
382-
private func skipUnlessAtLeastSwift6() throws {
383-
#if compiler(<6.0)
384-
try XCTSkipIf(true, "Skipping because test requires at least Swift 6.0")
385-
#endif
386-
}

IntegrationTests/Tests/IntegrationTests/SwiftPMTests.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,38 @@ final class SwiftPMTests: XCTestCase {
4949
}
5050
}
5151

52+
func testSwiftBuild() throws {
53+
#if os(Linux)
54+
if FileManager.default.contents(atPath: "/etc/system-release").map { String(decoding: $0, as: UTF8.self) == "Amazon Linux release 2 (Karoo)\n" } ?? false {
55+
throw XCTSkip("Skipping SwiftBuild testing on Amazon Linux because of platform issues.")
56+
}
57+
#endif
58+
59+
// Test SwiftBuildSystem
60+
do {
61+
try withTemporaryDirectory { tmpDir in
62+
let packagePath = tmpDir.appending(component: "foo")
63+
try localFileSystem.createDirectory(packagePath)
64+
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "executable")
65+
try sh(swiftBuild, "--package-path", packagePath, "--build-system", "swiftbuild")
66+
// SWBINTTODO: Path issues related to swift run of the output from swiftbuild buildsystem
67+
//let (stdout, stderr) = try sh(swiftRun, "--package-path", packagePath, "--build-system", "swiftbuild")
68+
//XCTAssertMatch(stdout, .contains("Hello, world!"))
69+
}
70+
}
71+
72+
do {
73+
try withTemporaryDirectory { tmpDir in
74+
let packagePath = tmpDir.appending(component: "foo")
75+
try localFileSystem.createDirectory(packagePath)
76+
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "library")
77+
try sh(swiftBuild, "--package-path", packagePath, "--build-system", "swiftbuild")
78+
// SWBINTTODO: Path issues related to swift test of the output from a swiftbuild buildsystem
79+
//try sh(swiftTest, "--package-path", packagePath, "--build-system", "swiftbuild")
80+
}
81+
}
82+
}
83+
5284
func testArchCustomization() throws {
5385
#if !os(macOS)
5486
try XCTSkip("Test requires macOS")

0 commit comments

Comments
 (0)