From 6b33489e643049d2bb4c25e27cd785432e2c54c1 Mon Sep 17 00:00:00 2001 From: Joseph Heck Date: Tue, 13 Jan 2026 06:22:46 -0800 Subject: [PATCH] Updates to present docs on _NIOFileSystem (#3477) This re-enables documentation lost during refactoring work, under the target _NIOFileSystem resolves #3474 ### Motivation: During the refactoring of NIOFileSystem and recent Swift updates, the mechanism to "shadow" symbols using `@_exported import` has stopped working for documentation and imports for symbols, which means that _NIOFileSystem is the target that needs to host the documentation for this (for now) ### Modifications: Moves DocC catalog into _NIOFileSystem target, and updates disambiguation hashes on overloaded symbols in order to verify no warnings are presented while generating documentation. Updates .spi.yml to present _NIOFileSystem instead of NIOFileSystem ### Result: Previous documentation should be available again, although at a slightly different URI structure within Swift Package Index. Co-authored-by: Cory Benfield --- .spi.yml | 2 +- .../Extensions/DirectoryFileHandleProtocol.md | 2 +- .../Extensions/FileHandleProtocol.md | 2 +- .../Extensions/FileSystemProtocol.md | 2 +- .../Extensions/ReadableFileHandleProtocol.md | 2 +- .../Extensions/WritableFileHandleProtocol.md | 2 +- .../Docs.docc/index.md | 4 ++-- .../_NIOFileSystem/FileHandleProtocol.swift | 21 +++++++++++-------- Sources/_NIOFileSystem/FileSystem.swift | 2 +- .../_NIOFileSystem/FileSystemProtocol.swift | 21 +++++++++++-------- Sources/_NIOFileSystem/OpenOptions.swift | 7 ++++--- 11 files changed, 37 insertions(+), 30 deletions(-) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/Extensions/DirectoryFileHandleProtocol.md (94%) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/Extensions/FileHandleProtocol.md (91%) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/Extensions/FileSystemProtocol.md (96%) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/Extensions/ReadableFileHandleProtocol.md (90%) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/Extensions/WritableFileHandleProtocol.md (81%) rename Sources/{NIOFS => _NIOFileSystem}/Docs.docc/index.md (96%) diff --git a/.spi.yml b/.spi.yml index 54aa41a04..b7e67f93a 100644 --- a/.spi.yml +++ b/.spi.yml @@ -1,4 +1,4 @@ version: 1 builder: configs: - - documentation_targets: [NIO, NIOConcurrencyHelpers, NIOCore, NIOEmbedded, NIOFoundationCompat, NIOHTTP1, NIOPosix, NIOTLS, NIOWebSocket, NIOTestUtils, NIOFileSystem] + - documentation_targets: [NIO, NIOConcurrencyHelpers, NIOCore, NIOEmbedded, NIOFoundationCompat, NIOHTTP1, NIOPosix, NIOTLS, NIOWebSocket, NIOTestUtils, _NIOFileSystem] diff --git a/Sources/NIOFS/Docs.docc/Extensions/DirectoryFileHandleProtocol.md b/Sources/_NIOFileSystem/Docs.docc/Extensions/DirectoryFileHandleProtocol.md similarity index 94% rename from Sources/NIOFS/Docs.docc/Extensions/DirectoryFileHandleProtocol.md rename to Sources/_NIOFileSystem/Docs.docc/Extensions/DirectoryFileHandleProtocol.md index 7ea77068e..fa60071ad 100644 --- a/Sources/NIOFS/Docs.docc/Extensions/DirectoryFileHandleProtocol.md +++ b/Sources/_NIOFileSystem/Docs.docc/Extensions/DirectoryFileHandleProtocol.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem/DirectoryFileHandleProtocol`` +# ``_NIOFileSystem/DirectoryFileHandleProtocol`` ## Topics diff --git a/Sources/NIOFS/Docs.docc/Extensions/FileHandleProtocol.md b/Sources/_NIOFileSystem/Docs.docc/Extensions/FileHandleProtocol.md similarity index 91% rename from Sources/NIOFS/Docs.docc/Extensions/FileHandleProtocol.md rename to Sources/_NIOFileSystem/Docs.docc/Extensions/FileHandleProtocol.md index bc3834911..34b193681 100644 --- a/Sources/NIOFS/Docs.docc/Extensions/FileHandleProtocol.md +++ b/Sources/_NIOFileSystem/Docs.docc/Extensions/FileHandleProtocol.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem/FileHandleProtocol`` +# ``_NIOFileSystem/FileHandleProtocol`` ## Topics diff --git a/Sources/NIOFS/Docs.docc/Extensions/FileSystemProtocol.md b/Sources/_NIOFileSystem/Docs.docc/Extensions/FileSystemProtocol.md similarity index 96% rename from Sources/NIOFS/Docs.docc/Extensions/FileSystemProtocol.md rename to Sources/_NIOFileSystem/Docs.docc/Extensions/FileSystemProtocol.md index cdfc193e9..c7f2d4b07 100644 --- a/Sources/NIOFS/Docs.docc/Extensions/FileSystemProtocol.md +++ b/Sources/_NIOFileSystem/Docs.docc/Extensions/FileSystemProtocol.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem/FileSystemProtocol`` +# ``_NIOFileSystem/FileSystemProtocol`` ## Topics diff --git a/Sources/NIOFS/Docs.docc/Extensions/ReadableFileHandleProtocol.md b/Sources/_NIOFileSystem/Docs.docc/Extensions/ReadableFileHandleProtocol.md similarity index 90% rename from Sources/NIOFS/Docs.docc/Extensions/ReadableFileHandleProtocol.md rename to Sources/_NIOFileSystem/Docs.docc/Extensions/ReadableFileHandleProtocol.md index 17069f953..26c2e99d1 100644 --- a/Sources/NIOFS/Docs.docc/Extensions/ReadableFileHandleProtocol.md +++ b/Sources/_NIOFileSystem/Docs.docc/Extensions/ReadableFileHandleProtocol.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem/ReadableFileHandleProtocol`` +# ``_NIOFileSystem/ReadableFileHandleProtocol`` ## Topics diff --git a/Sources/NIOFS/Docs.docc/Extensions/WritableFileHandleProtocol.md b/Sources/_NIOFileSystem/Docs.docc/Extensions/WritableFileHandleProtocol.md similarity index 81% rename from Sources/NIOFS/Docs.docc/Extensions/WritableFileHandleProtocol.md rename to Sources/_NIOFileSystem/Docs.docc/Extensions/WritableFileHandleProtocol.md index 23a7b76f1..639c2a962 100644 --- a/Sources/NIOFS/Docs.docc/Extensions/WritableFileHandleProtocol.md +++ b/Sources/_NIOFileSystem/Docs.docc/Extensions/WritableFileHandleProtocol.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem/WritableFileHandleProtocol`` +# ``_NIOFileSystem/WritableFileHandleProtocol`` ## Topics diff --git a/Sources/NIOFS/Docs.docc/index.md b/Sources/_NIOFileSystem/Docs.docc/index.md similarity index 96% rename from Sources/NIOFS/Docs.docc/index.md rename to Sources/_NIOFileSystem/Docs.docc/index.md index 26ff82e74..fc1b2cf1b 100644 --- a/Sources/NIOFS/Docs.docc/index.md +++ b/Sources/_NIOFileSystem/Docs.docc/index.md @@ -1,4 +1,4 @@ -# ``NIOFileSystem`` +# ``_NIOFileSystem`` A file system library for Swift. @@ -8,7 +8,7 @@ This module implements a file system library for Swift, providing ways to intera files. It provides a concrete ``FileSystem`` for interacting with the local file system in addition to a set of protocols for creating other file system implementations. -``NIOFileSystem`` is cross-platform with the following caveats: +`_NIOFileSystem` is cross-platform with the following caveats: - _Platforms don't have feature parity or system-level API parity._ Where this is the case these implementation details are documented. One example is copying files, on Apple platforms files are cloned if possible. diff --git a/Sources/_NIOFileSystem/FileHandleProtocol.swift b/Sources/_NIOFileSystem/FileHandleProtocol.swift index 12edeadb6..f26deac80 100644 --- a/Sources/_NIOFileSystem/FileHandleProtocol.swift +++ b/Sources/_NIOFileSystem/FileHandleProtocol.swift @@ -644,9 +644,10 @@ extension DirectoryFileHandleProtocol { /// Opens the file at the given path and provides scoped read access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the call returns. Files may also be opened in write-only and read-write - /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forWritingAt:options:execute:)-36f0k`` - /// and ``DirectoryFileHandleProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)-5j0f3``, + /// automatically before the call returns. + /// Files may also be opened in write-only and read-write + /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forWritingAt:options:execute:)`` + /// and ``DirectoryFileHandleProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)``, /// respectively. /// /// If `path` is a relative path then it is opened relative to the handle. The file being @@ -677,9 +678,10 @@ extension DirectoryFileHandleProtocol { /// Opens the file at the given path and provides scoped write access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the call returns. Files may also be opened in read-only or read-write - /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forReadingAt:options:execute:)-52xsn`` and - /// ``DirectoryFileHandleProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)-5j0f3``, + /// automatically before the call returns. + /// Files may also be opened in read-only or read-write + /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forReadingAt:options:execute:)`` and + /// ``DirectoryFileHandleProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)``, /// respectively. /// /// If `path` is a relative path then it is opened relative to the handle. @@ -713,9 +715,10 @@ extension DirectoryFileHandleProtocol { /// Opens the file at the given path and provides scoped read-write access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the call returns. Files may also be opened in read-only or write-only - /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forReadingAt:options:execute:)-52xsn`` and - /// ``DirectoryFileHandleProtocol/withFileHandle(forWritingAt:options:execute:)-36f0k``, respectively. + /// automatically before the call returns. + /// Files may also be opened in read-only or write-only + /// mode by calling ``DirectoryFileHandleProtocol/withFileHandle(forReadingAt:options:execute:)`` and + /// ``DirectoryFileHandleProtocol/withFileHandle(forWritingAt:options:execute:)``, respectively. /// /// If `path` is a relative path then it is opened relative to the handle. /// diff --git a/Sources/_NIOFileSystem/FileSystem.swift b/Sources/_NIOFileSystem/FileSystem.swift index adc6bbfd3..d4622f2f1 100644 --- a/Sources/_NIOFileSystem/FileSystem.swift +++ b/Sources/_NIOFileSystem/FileSystem.swift @@ -607,7 +607,7 @@ public struct FileSystem: Sendable, FileSystemProtocol { /// The destination of the symbolic link is not guaranteed to be a valid path, nor is it /// guaranteed to be an absolute path. If you need to open a file which is the destination of a /// symbolic link then the appropriate `open` function: - /// - ``openFile(forReadingAt:)-55z6f`` + /// - ``openFile(forReadingAt:options:) /// - ``openFile(forWritingAt:options:)`` /// - ``openFile(forReadingAndWritingAt:options:)`` /// - ``openDirectory(atPath:options:)`` diff --git a/Sources/_NIOFileSystem/FileSystemProtocol.swift b/Sources/_NIOFileSystem/FileSystemProtocol.swift index 7b3f771c2..eeceb6a30 100644 --- a/Sources/_NIOFileSystem/FileSystemProtocol.swift +++ b/Sources/_NIOFileSystem/FileSystemProtocol.swift @@ -317,9 +317,10 @@ extension FileSystemProtocol { /// Opens the file at the given path and provides scoped read-only access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the call returns. Files may also be opened in read-write or write-only - /// mode by calling ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)-9nqu3`` and - /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)-1p6ka``. + /// automatically before the call returns. + /// Files may also be opened in read-write or write-only mode by calling + /// ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)`` and + /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)``. /// /// - Parameters: /// - path: The path of the file to open for reading. @@ -344,9 +345,10 @@ extension FileSystemProtocol { /// Opens the file at the given path and provides scoped write-only access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the call returns. Files may also be opened in read-write or read-only - /// mode by calling ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)-9nqu3`` and - /// ``FileSystemProtocol/withFileHandle(forReadingAt:options:execute:)-nsue``. + /// automatically before the call returns. + /// Files may also be opened in read-write or write-only mode by calling + /// ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)`` and + /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)``. /// /// - Parameters: /// - path: The path of the file to open for reading. @@ -376,9 +378,10 @@ extension FileSystemProtocol { /// Opens the file at the given path and provides scoped read-write access to it. /// /// The file remains open during lifetime of the `execute` block and will be closed - /// automatically before the function returns. Files may also be opened in read-only or - /// write-only mode by with ``FileSystemProtocol/withFileHandle(forReadingAt:options:execute:)-nsue`` and - /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)-1p6ka``. + /// automatically before the function returns. + /// Files may also be opened in read-only or + /// write-only mode by with ``FileSystemProtocol/withFileHandle(forReadingAt:options:execute:)`` and + /// ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)``. /// /// - Parameters: /// - path: The path of the file to open for reading and writing. diff --git a/Sources/_NIOFileSystem/OpenOptions.swift b/Sources/_NIOFileSystem/OpenOptions.swift index a20898852..0d5cfae9b 100644 --- a/Sources/_NIOFileSystem/OpenOptions.swift +++ b/Sources/_NIOFileSystem/OpenOptions.swift @@ -176,9 +176,10 @@ extension OpenOptions { /// applicable. /// /// When this option is set and applied the newly created file will only materialize - /// on the file system when the file is closed. When used in conjunction with - /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)-1p6ka`` and - /// ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)-9nqu3`` the + /// on the file system when the file is closed. + /// When used in conjunction with + /// ``FileSystemProtocol/withFileHandle(forWritingAt:options:execute:)`` and + /// ``FileSystemProtocol/withFileHandle(forReadingAndWritingAt:options:execute:)`` the /// file will only materialize when the file is closed and no errors have been thrown. /// /// - Important: This flag is only applied if ``OpenOptions/Write/existingFile`` is