Skip to content

Commit 4e03b81

Browse files
MaxDesiatovxedinSimplyDannyrauhul
authored
[6.0] Cherry-pick recent NFC changes to reduce merge conflicts (#7721)
Includes these PRs cherry-picked off `main` * #7605 * #7660 * #7667 * #7682 * #7687 * #7690 * #7684 * #7679 **Explanation**: Cherry-pick of recent NFC changes, which makes it easier to cherry-pick actual bug fixes onto 6.0 due to the reduced number of merge conflicts. **Scope**: broad, includes both modules graph and llbuild-related changes. **Risk**: low, the test suite is passing, no functional changes are included, and cherry-picked changes were incubated on `main` for some time. **Testing**: Existing automated test suite. **Issue**: N/A **Reviewers**: @xedin @MaxDesiatov @rauhul --------- Co-authored-by: Pavel Yaskevich <[email protected]> Co-authored-by: Danny Mösch <[email protected]> Co-authored-by: Rauhul Varma <[email protected]>
1 parent 3bbca26 commit 4e03b81

File tree

215 files changed

+6927
-5227
lines changed

Some content is hidden

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

215 files changed

+6927
-5227
lines changed

CONTRIBUTORS.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ needs to be listed here.
291291
- Quinn McHenry <[email protected]>
292292
- Rahul Malik <[email protected]>
293293
- Randy Becker <[email protected]>
294-
- Rauhul Varma <rauhul@users.noreply.github.com>
294+
- Rauhul Varma <rauhul@apple.com>
295295
- Renzo Crisóstomo <[email protected]>
296296
- Rich Ellis <[email protected]>
297297
- Rick Ballard <[email protected]>

Examples/package-info/Sources/package-info/example.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ struct Example {
3939
print("Targets:", targets)
4040

4141
// Package
42-
let executables = package.targets.filter({ $0.type == .executable }).map({ $0.name })
42+
let executables = package.modules.filter({ $0.type == .executable }).map({ $0.name })
4343
print("Executable targets:", executables)
4444

4545
// PackageGraph
46-
let numberOfFiles = graph.reachableTargets.reduce(0, { $0 + $1.sources.paths.count })
46+
let numberOfFiles = graph.reachableModules.reduce(0, { $0 + $1.sources.paths.count })
4747
print("Total number of source files (including dependencies):", numberOfFiles)
4848
}
4949
}

Package.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ let package = Package(
169169
"SPMBuildCore"
170170
],
171171
exclude: ["CMakeLists.txt"],
172-
swiftSettings: [.enableExperimentalFeature("AccessLevelOnImport")]
172+
swiftSettings: [
173+
.enableExperimentalFeature("AccessLevelOnImport"),
174+
]
173175
),
174176

175177
// MARK: SwiftPM specific support libraries
@@ -188,6 +190,7 @@ let package = Package(
188190
exclude: ["CMakeLists.txt", "Vendor/README.md"],
189191
swiftSettings: [
190192
.enableExperimentalFeature("StrictConcurrency"),
193+
.enableExperimentalFeature("AccessLevelOnImport"),
191194
]
192195
),
193196

Sources/Basics/Archiver/TarArchiver.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import class Dispatch.DispatchQueue
1414
import struct Dispatch.DispatchTime
1515
import struct TSCBasic.FileSystemError
16-
import class TSCBasic.Process
1716

1817
/// An `Archiver` that handles Tar archives using the command-line `tar` tool.
1918
public struct TarArchiver: Archiver {
@@ -58,7 +57,7 @@ public struct TarArchiver: Archiver {
5857
throw FileSystemError(.notDirectory, destinationPath.underlying)
5958
}
6059

61-
let process = TSCBasic.Process(
60+
let process = AsyncProcess(
6261
arguments: [self.tarCommand, "zxf", archivePath.pathString, "-C", destinationPath.pathString]
6362
)
6463

@@ -91,9 +90,10 @@ public struct TarArchiver: Archiver {
9190
throw FileSystemError(.notDirectory, directory.underlying)
9291
}
9392

94-
let process = TSCBasic.Process(
93+
let process = AsyncProcess(
9594
arguments: [self.tarCommand, "acf", destinationPath.pathString, directory.basename],
96-
workingDirectory: directory.parentDirectory.underlying
95+
environment: .current,
96+
workingDirectory: directory.parentDirectory
9797
)
9898

9999
guard let registrationKey = self.cancellator.register(process) else {
@@ -121,7 +121,7 @@ public struct TarArchiver: Archiver {
121121
throw FileSystemError(.noEntry, path.underlying)
122122
}
123123

124-
let process = TSCBasic.Process(arguments: [self.tarCommand, "tf", path.pathString])
124+
let process = AsyncProcess(arguments: [self.tarCommand, "tf", path.pathString])
125125
guard let registrationKey = self.cancellator.register(process) else {
126126
throw CancellationError.failedToRegisterProcess(process)
127127
}

Sources/Basics/Archiver/ZipArchiver.swift

+7-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import Dispatch
1414
import struct TSCBasic.FileSystemError
15-
import class TSCBasic.Process
1615

1716
/// An `Archiver` that handles ZIP archives using the command-line `zip` and `unzip` tools.
1817
public struct ZipArchiver: Archiver, Cancellable {
@@ -49,11 +48,9 @@ public struct ZipArchiver: Archiver, Cancellable {
4948
}
5049

5150
#if os(Windows)
52-
let process = TSCBasic
53-
.Process(arguments: ["tar.exe", "xf", archivePath.pathString, "-C", destinationPath.pathString])
51+
let process = AsyncProcess(arguments: ["tar.exe", "xf", archivePath.pathString, "-C", destinationPath.pathString])
5452
#else
55-
let process = TSCBasic
56-
.Process(arguments: ["unzip", archivePath.pathString, "-d", destinationPath.pathString])
53+
let process = AsyncProcess(arguments: ["unzip", archivePath.pathString, "-d", destinationPath.pathString])
5754
#endif
5855
guard let registrationKey = self.cancellator.register(process) else {
5956
throw CancellationError.failedToRegisterProcess(process)
@@ -85,10 +82,10 @@ public struct ZipArchiver: Archiver, Cancellable {
8582
}
8683

8784
#if os(Windows)
88-
let process = TSCBasic.Process(
85+
let process = AsyncProcess(
8986
// FIXME: are these the right arguments?
9087
arguments: ["tar.exe", "-a", "-c", "-f", destinationPath.pathString, directory.basename],
91-
workingDirectory: directory.parentDirectory.underlying
88+
workingDirectory: directory.parentDirectory
9289
)
9390
#else
9491
// This is to work around `swift package-registry publish` tool failing on
@@ -97,7 +94,7 @@ public struct ZipArchiver: Archiver, Cancellable {
9794
// Instead of passing `workingDirectory` param to TSC.Process, which will trigger
9895
// SPM_posix_spawn_file_actions_addchdir_np_supported check, we shell out and
9996
// do `cd` explicitly before `zip`.
100-
let process = TSCBasic.Process(
97+
let process = AsyncProcess(
10198
arguments: [
10299
"/bin/sh",
103100
"-c",
@@ -132,9 +129,9 @@ public struct ZipArchiver: Archiver, Cancellable {
132129
}
133130

134131
#if os(Windows)
135-
let process = TSCBasic.Process(arguments: ["tar.exe", "tf", path.pathString])
132+
let process = AsyncProcess(arguments: ["tar.exe", "tf", path.pathString])
136133
#else
137-
let process = TSCBasic.Process(arguments: ["unzip", "-t", path.pathString])
134+
let process = AsyncProcess(arguments: ["unzip", "-t", path.pathString])
138135
#endif
139136
guard let registrationKey = self.cancellator.register(process) else {
140137
throw CancellationError.failedToRegisterProcess(process)

0 commit comments

Comments
 (0)