Skip to content

Commit 4b68e9e

Browse files
committed
wip: port to system, same module separate folders
1 parent a9597cc commit 4b68e9e

38 files changed

Lines changed: 3877 additions & 1162 deletions

Package.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,26 @@ let swiftSettings = swiftSettingsAvailability + swiftSettingsCI + [
8181
.define("SYSTEM_PACKAGE"),
8282
.define("ENABLE_MOCKING", .when(configuration: .debug)),
8383
.enableExperimentalFeature("Lifetimes"),
84+
// --- SE-0529 FilePath port ---
85+
// Settings folded in for the base (Sources/System/FilePath) and the compat
86+
// layer (Sources/System/SystemFilePath), mirroring the prep repo's separate
87+
// FilePath + SystemFilePath targets now that they share one module.
88+
//
89+
// Defines the `SwiftStdlib 9999` availability token every base decl carries.
90+
.enableExperimentalFeature(
91+
"AvailabilityMacro=SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999"),
92+
// Selects the base's real per-platform resolve() syscall branch and its own
93+
// _internalInvariant, instead of the stdlib SwiftShims stub branch.
94+
.define("FILEPATH_PACKAGE"),
95+
// swift-system historically ships a non-failable FilePath(_: String); the
96+
// base's is failable and the two can't coexist on one type. This makes the
97+
// base drop its public failable init?(_:) so the compat layer's non-failable
98+
// init(_:) is the sole one (see FilePathStringBridging.swift / the compat
99+
// FilePathString.swift PORT note).
100+
.define("FILEPATH_SYSTEM_STRING_COMPAT"),
101+
// The base is 9999-gated; the swift-system substrate that calls it is not.
102+
// Disable enforcement (matches the prep's consumer targets).
103+
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
84104
]
85105

86106
let cSettings: [CSetting] = [

Sources/System/CMakeLists.txt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,30 @@ target_compile_options(SystemPackage PRIVATE
2828
"SHELL:-package-name swift-system")
2929
target_sources(SystemPackage PRIVATE
3030
FilePath/FilePath.swift
31-
FilePath/FilePathComponents.swift
31+
FilePath/FilePathAnchor.swift
32+
FilePath/FilePathCodeUnits.swift
33+
FilePath/FilePathComponent.swift
3234
FilePath/FilePathComponentView.swift
35+
FilePath/FilePathDarwin.swift
36+
FilePath/FilePathDecomposition.swift
37+
FilePath/FilePathInternals.swift
3338
FilePath/FilePathParsing.swift
34-
FilePath/FilePathString.swift
35-
FilePath/FilePathSyntax.swift
36-
FilePath/FilePathTemp.swift
37-
FilePath/FilePathTempPosix.swift
38-
FilePath/FilePathTempWindows.swift
39+
FilePath/FilePathResolve.swift
40+
FilePath/FilePathStringBridging.swift
41+
FilePath/FilePathSystemString.swift
3942
FilePath/FilePathWindows.swift)
43+
target_sources(SystemPackage PRIVATE
44+
SystemFilePath/FilePathCompatInternals.swift
45+
SystemFilePath/FilePathCompatShims.swift
46+
SystemFilePath/FilePathComponentCompat.swift
47+
SystemFilePath/FilePathComponents.swift
48+
SystemFilePath/FilePathConformances.swift
49+
SystemFilePath/FilePathString.swift
50+
SystemFilePath/FilePathSyntax.swift
51+
SystemFilePath/FilePathTemp.swift
52+
SystemFilePath/FilePathTempPosix.swift
53+
SystemFilePath/FilePathTempWindows.swift
54+
SystemFilePath/SystemStringShim.swift)
4055
target_sources(SystemPackage PRIVATE
4156
FileSystem/FileFlags.swift
4257
FileSystem/FileMode.swift
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#[[
2+
This source file is part of the Swift System open source project
3+
4+
Copyright (c) 2020 Apple Inc. and the Swift System 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+
#]]
9+
10+
add_library(SystemPackage
11+
Errno.swift
12+
ErrnoWindows.swift
13+
FileDescriptor.swift
14+
FileHelpers.swift
15+
FileOperations.swift
16+
FilePermissions.swift
17+
MachPort.swift
18+
PlatformString.swift
19+
SystemString.swift
20+
Util.swift
21+
Util+StringArray.swift
22+
UtilConsumers.swift
23+
WinSDK+Overlay.swift)
24+
set_target_properties(SystemPackage PROPERTIES
25+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
26+
target_compile_options(SystemPackage PRIVATE
27+
-enable-experimental-feature Lifetimes
28+
"SHELL:-package-name swift-system")
29+
target_sources(SystemPackage PRIVATE
30+
FilePath/FilePath.swift
31+
FilePath/FilePathAnchor.swift
32+
FilePath/FilePathCodeUnits.swift
33+
FilePath/FilePathComponent.swift
34+
FilePath/FilePathComponentView.swift
35+
FilePath/FilePathDarwin.swift
36+
FilePath/FilePathDecomposition.swift
37+
FilePath/FilePathInternals.swift
38+
FilePath/FilePathParsing.swift
39+
<<<<<<< HEAD
40+
FilePath/FilePathString.swift
41+
FilePath/FilePathSyntax.swift
42+
FilePath/FilePathTemp.swift
43+
FilePath/FilePathTempPosix.swift
44+
FilePath/FilePathTempWindows.swift
45+
FilePath/FilePathWindows.swift)
46+
target_sources(SystemPackage PRIVATE
47+
FileSystem/FileFlags.swift
48+
FileSystem/FileMode.swift
49+
FileSystem/FileType.swift
50+
FileSystem/Identifiers.swift
51+
FileSystem/Stat.swift)
52+
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
53+
target_sources(SystemPackage PRIVATE
54+
IORing/IOCompletion.swift
55+
IORing/IORequest.swift
56+
IORing/IORing.swift
57+
IORing/IORing+Util.swift
58+
IORing/RawIORequest.swift)
59+
endif()
60+
=======
61+
FilePath/FilePathResolve.swift
62+
FilePath/FilePathStringBridging.swift
63+
FilePath/FilePathSystemString.swift
64+
FilePath/FilePathWindows.swift)
65+
target_sources(SystemPackage PRIVATE
66+
SystemFilePath/FilePathCompatInternals.swift
67+
SystemFilePath/FilePathCompatShims.swift
68+
SystemFilePath/FilePathComponentCompat.swift
69+
SystemFilePath/FilePathComponents.swift
70+
SystemFilePath/FilePathConformances.swift
71+
SystemFilePath/FilePathString.swift
72+
SystemFilePath/FilePathSyntax.swift
73+
SystemFilePath/FilePathTemp.swift
74+
SystemFilePath/FilePathTempPosix.swift
75+
SystemFilePath/FilePathTempWindows.swift
76+
SystemFilePath/SystemStringShim.swift)
77+
>>>>>>> d17277b (wip: port to system, same module separate folders)
78+
target_sources(SystemPackage PRIVATE
79+
Internals/Backcompat.swift
80+
Internals/CInterop.swift
81+
Internals/Constants.swift
82+
Internals/Exports.swift
83+
Internals/Mocking.swift
84+
Internals/RawBuffer.swift
85+
Internals/Syscalls.swift
86+
Internals/WindowsSyscallAdapters.swift)
87+
target_link_libraries(SystemPackage PUBLIC
88+
CSystem)
89+
90+
set(SWIFT_SYSTEM_APPLE_PLATFORMS "Darwin" "iOS" "watchOS" "tvOS" "visionOS")
91+
if(CMAKE_SYSTEM_NAME IN_LIST SWIFT_SYSTEM_APPLE_PLATFORMS)
92+
target_compile_definitions(SystemPackage PRIVATE SYSTEM_PACKAGE_DARWIN)
93+
endif()
94+
95+
_install_target(SystemPackage)
96+
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS SystemPackage)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#[[
2+
This source file is part of the Swift System open source project
3+
4+
Copyright (c) 2020 Apple Inc. and the Swift System 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+
#]]
9+
10+
add_library(SystemPackage
11+
Errno.swift
12+
FileDescriptor.swift
13+
FileHelpers.swift
14+
FileOperations.swift
15+
FilePermissions.swift
16+
MachPort.swift
17+
PlatformString.swift
18+
SystemString.swift
19+
Util.swift
20+
Util+StringArray.swift
21+
UtilConsumers.swift)
22+
set_target_properties(SystemPackage PROPERTIES
23+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
24+
target_sources(SystemPackage PRIVATE
25+
FilePath/FilePath.swift
26+
FilePath/FilePathComponents.swift
27+
FilePath/FilePathComponentView.swift
28+
FilePath/FilePathParsing.swift
29+
FilePath/FilePathString.swift
30+
FilePath/FilePathSyntax.swift
31+
FilePath/FilePathWindows.swift)
32+
target_sources(SystemPackage PRIVATE
33+
Internals/Backcompat.swift
34+
Internals/CInterop.swift
35+
Internals/Constants.swift
36+
Internals/Exports.swift
37+
Internals/Mocking.swift
38+
Internals/RawBuffer.swift
39+
Internals/Syscalls.swift
40+
Internals/WindowsSyscallAdapters.swift)
41+
target_link_libraries(SystemPackage PUBLIC
42+
CSystem)
43+
44+
set(SWIFT_SYSTEM_APPLE_PLATFORMS "Darwin" "iOS" "watchOS" "tvOS" "visionOS")
45+
if(CMAKE_SYSTEM_NAME IN_LIST SWIFT_SYSTEM_APPLE_PLATFORMS)
46+
target_compile_definitions(SystemPackage PRIVATE SYSTEM_PACKAGE_DARWIN)
47+
endif()
48+
49+
_install_target(SystemPackage)
50+
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS SystemPackage)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#[[
2+
This source file is part of the Swift System open source project
3+
4+
Copyright (c) 2020 Apple Inc. and the Swift System 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+
#]]
9+
10+
add_library(SystemPackage
11+
Errno.swift
12+
ErrnoWindows.swift
13+
FileDescriptor.swift
14+
FileHelpers.swift
15+
FileOperations.swift
16+
FilePermissions.swift
17+
MachPort.swift
18+
PlatformString.swift
19+
SystemString.swift
20+
Util.swift
21+
Util+StringArray.swift
22+
UtilConsumers.swift
23+
WinSDK+Overlay.swift)
24+
set_target_properties(SystemPackage PROPERTIES
25+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
26+
target_compile_options(SystemPackage PRIVATE
27+
-enable-experimental-feature Lifetimes
28+
"SHELL:-package-name swift-system")
29+
target_sources(SystemPackage PRIVATE
30+
FilePath/FilePath.swift
31+
FilePath/FilePathComponents.swift
32+
FilePath/FilePathComponentView.swift
33+
FilePath/FilePathParsing.swift
34+
FilePath/FilePathString.swift
35+
FilePath/FilePathSyntax.swift
36+
FilePath/FilePathTemp.swift
37+
FilePath/FilePathTempPosix.swift
38+
FilePath/FilePathTempWindows.swift
39+
FilePath/FilePathWindows.swift)
40+
target_sources(SystemPackage PRIVATE
41+
FileSystem/FileFlags.swift
42+
FileSystem/FileMode.swift
43+
FileSystem/FileType.swift
44+
FileSystem/Identifiers.swift
45+
FileSystem/Stat.swift)
46+
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
47+
target_sources(SystemPackage PRIVATE
48+
IORing/IOCompletion.swift
49+
IORing/IORequest.swift
50+
IORing/IORing.swift
51+
IORing/IORing+Util.swift
52+
IORing/RawIORequest.swift)
53+
endif()
54+
target_sources(SystemPackage PRIVATE
55+
Internals/Backcompat.swift
56+
Internals/CInterop.swift
57+
Internals/Constants.swift
58+
Internals/Exports.swift
59+
Internals/Mocking.swift
60+
Internals/RawBuffer.swift
61+
Internals/Syscalls.swift
62+
Internals/WindowsSyscallAdapters.swift)
63+
target_link_libraries(SystemPackage PUBLIC
64+
CSystem)
65+
66+
set(SWIFT_SYSTEM_APPLE_PLATFORMS "Darwin" "iOS" "watchOS" "tvOS" "visionOS")
67+
if(CMAKE_SYSTEM_NAME IN_LIST SWIFT_SYSTEM_APPLE_PLATFORMS)
68+
target_compile_definitions(SystemPackage PRIVATE SYSTEM_PACKAGE_DARWIN)
69+
endif()
70+
71+
_install_target(SystemPackage)
72+
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS SystemPackage)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#[[
2+
This source file is part of the Swift System open source project
3+
4+
Copyright (c) 2020 Apple Inc. and the Swift System 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+
#]]
9+
10+
add_library(SystemPackage
11+
Errno.swift
12+
FileDescriptor.swift
13+
FileHelpers.swift
14+
FileOperations.swift
15+
FilePermissions.swift
16+
MachPort.swift
17+
PlatformString.swift
18+
SystemString.swift
19+
Util.swift
20+
Util+StringArray.swift
21+
UtilConsumers.swift)
22+
set_target_properties(SystemPackage PROPERTIES
23+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
24+
target_sources(SystemPackage PRIVATE
25+
FilePath/FilePath.swift
26+
FilePath/FilePathAnchor.swift
27+
FilePath/FilePathCodeUnits.swift
28+
FilePath/FilePathComponent.swift
29+
FilePath/FilePathComponentView.swift
30+
FilePath/FilePathDarwin.swift
31+
FilePath/FilePathDecomposition.swift
32+
FilePath/FilePathInternals.swift
33+
FilePath/FilePathParsing.swift
34+
FilePath/FilePathResolve.swift
35+
FilePath/FilePathStringBridging.swift
36+
FilePath/FilePathSystemString.swift
37+
FilePath/FilePathWindows.swift)
38+
target_sources(SystemPackage PRIVATE
39+
SystemFilePath/FilePathCompatInternals.swift
40+
SystemFilePath/FilePathCompatShims.swift
41+
SystemFilePath/FilePathComponentCompat.swift
42+
SystemFilePath/FilePathComponents.swift
43+
SystemFilePath/FilePathConformances.swift
44+
SystemFilePath/FilePathString.swift
45+
SystemFilePath/FilePathSyntax.swift
46+
SystemFilePath/FilePathTemp.swift
47+
SystemFilePath/FilePathTempPosix.swift
48+
SystemFilePath/FilePathTempWindows.swift
49+
SystemFilePath/SystemStringShim.swift)
50+
target_sources(SystemPackage PRIVATE
51+
Internals/Backcompat.swift
52+
Internals/CInterop.swift
53+
Internals/Constants.swift
54+
Internals/Exports.swift
55+
Internals/Mocking.swift
56+
Internals/RawBuffer.swift
57+
Internals/Syscalls.swift
58+
Internals/WindowsSyscallAdapters.swift)
59+
target_link_libraries(SystemPackage PUBLIC
60+
CSystem)
61+
62+
set(SWIFT_SYSTEM_APPLE_PLATFORMS "Darwin" "iOS" "watchOS" "tvOS" "visionOS")
63+
if(CMAKE_SYSTEM_NAME IN_LIST SWIFT_SYSTEM_APPLE_PLATFORMS)
64+
target_compile_definitions(SystemPackage PRIVATE SYSTEM_PACKAGE_DARWIN)
65+
endif()
66+
67+
_install_target(SystemPackage)
68+
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS SystemPackage)

0 commit comments

Comments
 (0)