Skip to content

Remove @_implementationOnly imports guarded by 'SWT_BUILDING_WITH_CMAKE' #554

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
4 changes: 0 additions & 4 deletions Sources/Testing/ABI/EntryPoints/EntryPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// The common implementation of the entry point functions in this package.
///
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/ABI/EntryPoints/SwiftPMEntryPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// The exit code returned to Swift Package Manager by Swift Testing when no
/// tests matched the inputs specified by the developer (or, for the case of
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Events/Clock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@_spi(Experimental) @_spi(ForToolsIntegrationOnly)
extension Test {
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Events/TimeValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

// `internal` because `TimeValue.init(_ timespec:)` below is internal and
// references a type (`timespec`) which comes from this import.
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

/// A container type representing a time value that is suitable for storage,
/// conversion, encoding, and decoding.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/ExitTests/ExitCondition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// An enumeration describing possible conditions under which an exit test will
/// succeed or fail.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/ExitTests/ExitTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

#if !SWT_NO_EXIT_TESTS
/// A type describing an exit test.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/ExitTests/WaitFor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

#if !SWT_NO_EXIT_TESTS

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

#if SWT_TARGET_OS_APPLE || os(Linux)
/// Block the calling thread, wait for the target process to exit, and return
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/SourceAttribution/Backtrace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// A type representing a backtrace or stack trace.
@_spi(ForToolsIntegrationOnly)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

extension CommandLine {
/// The path to the current process' executable.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/CError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

/// A type representing an error from a C function such as `fopen()`.
///
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// A type describing the environment of the current process.
///
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/FileHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

#if !SWT_NO_FILE_IO
/// A type representing a file handle.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/GetSymbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

#if !SWT_NO_DYNAMIC_LINKING

Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/Locked.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
internal import _TestingInternals
#endif

/// A type that wraps a value requiring access from a synchronous caller during
/// concurrent execution.
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Support/Versions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// A human-readable string describing the current operating system's version.
///
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Test+Discovery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

/// A protocol describing a type that contains tests.
///
Expand Down
4 changes: 0 additions & 4 deletions Sources/Testing/Traits/Tags/Tag.Color+Loading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

#if !SWT_NO_FILE_IO
#if os(macOS) || (os(iOS) && targetEnvironment(macCatalyst)) || os(Linux)
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/ABIEntryPointTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
#if canImport(Foundation) && !SWT_NO_ABI_ENTRY_POINT
@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("ABI entry point tests")
struct ABIEntryPointTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/ClockTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing

#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("Clock API Tests")
struct ClockTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/DumpTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

// NOTE: The tests in this file are here to exercise Plan.dump(), but they are
// not intended to actually test that the output is in a particular format since
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/EventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

#if !SWT_NO_SNAPSHOT_TYPES
@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("Event Tests")
struct EventTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/ExitTestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

#if !SWT_NO_EXIT_TESTS
@Suite("Exit test tests") struct ExitTestTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/IssueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

#if canImport(XCTest)
import XCTest
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/Support/CErrorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("CError Tests")
struct CErrorTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/Support/EnvironmentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(Experimental) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("Environment Tests", .serialized)
struct EnvironmentTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/Support/FileHandleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

#if !SWT_NO_FILE_IO
// NOTE: we don't run these tests on iOS (etc.) because processes on those
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/SwiftPMTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

private func configurationForEntryPoint(withArguments args: [String]) throws -> Configuration {
let args = try parseCommandLineArguments(from: args)
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/Traits/TagListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("Tag/Tag List Tests", .tags(.traitRelated))
struct TagListTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/TypeInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

@testable @_spi(ForToolsIntegrationOnly) import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Suite("TypeInfo Tests")
struct TypeInfoTests {
Expand Down
4 changes: 0 additions & 4 deletions Tests/TestingTests/VariadicGenericTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
//

import Testing
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif

@Test func variadicCStringArguments() async throws {
#expect(swt_pointersNotEqual2("abc", "123"))
Expand Down
3 changes: 0 additions & 3 deletions cmake/modules/shared/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ add_compile_options(
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-upcoming-feature -Xfrontend ExistentialAny>"
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-upcoming-feature -Xfrontend InternalImportsByDefault>")

# Definitions applied unconditionally to files of all languages, in all targets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave this in actually, as it may come in handy in the future that we're able to distinguish CMake from SwiftPM and xcodeproj builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, but in retrospect I think this sort of pattern would be better accomplished with feature-scoped guards. For example, I think this one could have been phrased as SWT_NO_ACCESS_LEVEL_IMPORTS, matching some of our other build time conditionals. So I will proceed with removing this, and we can easily add back other, more specific conditions in the future the need arises.

add_compile_definitions("SWT_BUILDING_WITH_CMAKE")

# Platform-specific definitions.
if(APPLE)
add_compile_definitions("SWT_TARGET_OS_APPLE")
Expand Down