Skip to content

Declare a package name for CMake builds and remove @_spi(ForSwiftTestingOnly) #954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Documentation/SPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ external tools, _both_ groups are specified. Such SPI is not generally meant to
be promoted to public API, but is still experimental until tools authors have a
chance to evaluate it.

For interfaces internal to Swift Testing that must be available across targets,
the SPI group `@_spi(ForSwiftTestingOnly)` is used. They _should_ be marked
`package` and may be in the future, but are currently exported due to technical
constraints when Swift Testing is built using CMake.

> [!WARNING]
> Never use symbols marked `@_spi(ForSwiftTestingOnly)`.

## SPI stability

The testing library does **not** guarantee SPI stability for either group of
Expand All @@ -59,12 +51,6 @@ to newer interfaces.
SPI marked `@_spi(Experimental)` should be assumed to be unstable. It may be
modified or removed at any time.

SPI marked `@_spi(ForSwiftTestingOnly)` is unstable and subject to change at any
time.

> [!WARNING]
> Never use symbols marked `@_spi(ForSwiftTestingOnly)`.

## API and ABI stability

When Swift Testing reaches its 1.0 release, API changes will follow the same
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//

#if SWT_TARGET_OS_APPLE && canImport(CoreGraphics)
@_spi(ForSwiftTestingOnly) @_spi(Experimental) public import Testing
@_spi(Experimental) public import Testing

public import UniformTypeIdentifiers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

#if SWT_TARGET_OS_APPLE && canImport(CoreGraphics)
/// A type representing an error that can occur when attaching an image.
@_spi(ForSwiftTestingOnly)
public enum ImageAttachmentError: Error, CustomStringConvertible {
package enum ImageAttachmentError: Error, CustomStringConvertible {
/// The image could not be converted to an instance of `CGImage`.
case couldNotCreateCGImage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//

#if canImport(Foundation)
@_spi(Experimental) @_spi(ForSwiftTestingOnly) public import Testing
@_spi(Experimental) public import Testing
public import Foundation

#if !SWT_NO_PROCESS_SPAWNING && os(Windows)
Expand Down
3 changes: 1 addition & 2 deletions Sources/Testing/Attachments/Attachment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public struct Attachment<AttachableValue>: ~Copyable where AttachableValue: Atta
public var fileSystemPath: String?

/// The default preferred name to use if the developer does not supply one.
@_spi(ForSwiftTestingOnly)
public static var defaultPreferredName: String {
package static var defaultPreferredName: String {
"untitled"
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/TestingTests/AttachmentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation
#endif
#if canImport(CoreGraphics)
import CoreGraphics
@_spi(Experimental) @_spi(ForSwiftTestingOnly) import _Testing_CoreGraphics
@_spi(Experimental) import _Testing_CoreGraphics
#endif
#if canImport(UniformTypeIdentifiers)
import UniformTypeIdentifiers
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/shared/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

# Settings intended to be applied to every Swift target in this project.
# Analogous to project-level build settings in an Xcode project.
add_compile_options(
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-package-name org.swift.testing>")
add_compile_options(
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -require-explicit-sendable>")
add_compile_options(
Expand Down