Skip to content
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

Move from @_implementationOnly to internal imports #8412

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import PackageDescription

// This package acts as a regression test for the FoundationlessPackages to
// assert that Swift targets with resources are not affected by using
// `@_implementationOnly import Foundation` in the generated resource accessor.
// `internal import Foundation` in the generated resource accessor.
let package = Package(
name: "UtilsWithFoundationPkg",
targets: [
7 changes: 2 additions & 5 deletions Sources/Basics/Concurrency/AsyncProcess.swift
Original file line number Diff line number Diff line change
@@ -20,11 +20,8 @@ import Android

#if os(Linux)
#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly
import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np_supported

@_implementationOnly
import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np
package import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np_supported
package import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np
#else
private import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np_supported
private import func TSCclibc.SPM_posix_spawn_file_actions_addchdir_np
4 changes: 2 additions & 2 deletions Sources/Basics/SQLite.swift
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@ import Foundation

#if SWIFT_PACKAGE && (os(Windows) || os(Android))
#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftToolchainCSQLite
internal import SwiftToolchainCSQLite
#else
import SwiftToolchainCSQLite
#endif
#else
#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SPMSQLite3
package import SPMSQLite3
#else
import SPMSQLite3
#endif
2 changes: 1 addition & 1 deletion Sources/Basics/SwiftVersion.swift
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import TSCclibc
package import TSCclibc
#else
private import TSCclibc
#endif
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import PackageModel
import SPMBuildCore

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import DriverSupport
internal import DriverSupport
#else
import DriverSupport
#endif
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ import func TSCBasic.topologicalSort
import struct Basics.Environment

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import class DriverSupport.SPMSwiftDriverExecutor
@_implementationOnly import SwiftDriver
internal import class DriverSupport.SPMSwiftDriverExecutor
internal import SwiftDriver
#else
import class DriverSupport.SPMSwiftDriverExecutor
import SwiftDriver
2 changes: 1 addition & 1 deletion Sources/Build/BuildManifest/LLBuildManifestBuilder.swift
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ import PackageModel
import SPMBuildCore

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftDriver
internal import SwiftDriver
#else
import SwiftDriver
#endif
4 changes: 2 additions & 2 deletions Sources/Build/BuildOperation.swift
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@ import struct TSCBasic.RegEx
import enum TSCUtility.Diagnostics

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import DriverSupport
@_implementationOnly import SwiftDriver
internal import DriverSupport
internal import SwiftDriver
#else
import DriverSupport
import SwiftDriver
2 changes: 1 addition & 1 deletion Sources/Build/BuildPlan/BuildPlan.swift
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import PackageModel
import SPMBuildCore

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftDriver
internal import SwiftDriver
#else
import SwiftDriver
#endif
2 changes: 1 addition & 1 deletion Sources/Commands/Utilities/SymbolGraphExtract.swift
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ import PackageModel
import SPMBuildCore

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import DriverSupport
internal import DriverSupport
#else
import DriverSupport
#endif
3 changes: 1 addition & 2 deletions Sources/CoreCommands/SwiftCommandState.swift
Original file line number Diff line number Diff line change
@@ -24,9 +24,8 @@ import SPMBuildCore
import Workspace

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly
@_spi(SwiftPMInternal)
import DriverSupport
internal import DriverSupport
#else
@_spi(SwiftPMInternal)
import DriverSupport
4 changes: 2 additions & 2 deletions Sources/PackageCollectionsSigning/CertificatePolicy.swift
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ import Foundation
import Basics

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftASN1
@_implementationOnly import X509
internal import SwiftASN1
internal import X509
#else
import SwiftASN1
import X509
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ import Foundation
import PackageCollectionsModel

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import _CryptoExtras
@_implementationOnly import Crypto
@_implementationOnly import X509
internal import _CryptoExtras
internal import Crypto
internal import X509
#else
import _CryptoExtras
import Crypto
6 changes: 3 additions & 3 deletions Sources/PackageCollectionsSigning/Signature.swift
Original file line number Diff line number Diff line change
@@ -26,9 +26,9 @@
import Foundation

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import _CryptoExtras
@_implementationOnly import Crypto
@_implementationOnly import X509
internal import _CryptoExtras
internal import Crypto
internal import X509
#else
import _CryptoExtras
import Crypto
4 changes: 2 additions & 2 deletions Sources/PackageCollectionsSigning/X509Extensions.swift
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftASN1
@_implementationOnly import X509
internal import SwiftASN1
internal import X509
#else
import SwiftASN1
import X509
6 changes: 3 additions & 3 deletions Sources/PackageDescription/PackageDescription.swift
Original file line number Diff line number Diff line change
@@ -11,10 +11,10 @@
//===----------------------------------------------------------------------===//

#if canImport(ucrt) && canImport(WinSDK)
@_implementationOnly import ucrt
@_implementationOnly import struct WinSDK.HANDLE
internal import ucrt
internal import struct WinSDK.HANDLE
#endif
@_implementationOnly import Foundation
internal import Foundation

/// The configuration of a Swift package.
///
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import Foundation
internal import Foundation
#else
import Foundation
#endif
2 changes: 1 addition & 1 deletion Sources/PackageDescription/Target.swift
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import Foundation
internal import Foundation

/// The basic building block of a Swift package.
///
2 changes: 1 addition & 1 deletion Sources/PackageLoading/ContextModel.swift
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import Foundation
internal import Foundation
#else
import Foundation
#endif
4 changes: 2 additions & 2 deletions Sources/PackagePlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@

import Foundation
#if os(Windows)
@_implementationOnly import ucrt
@_implementationOnly import WinSDK
internal import ucrt
internal import WinSDK

internal func dup(_ fd: CInt) -> CInt {
return _dup(fd)
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import PackageSigning
import Workspace

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import X509 // FIXME: need this import or else SwiftSigningIdentity initializer fails
internal import X509 // FIXME: need this import or else SwiftSigningIdentity initializer fails
#else
import X509
#endif
2 changes: 1 addition & 1 deletion Sources/PackageSigning/CertificateStores.swift
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import X509
internal import X509
#else
import X509
#endif
6 changes: 3 additions & 3 deletions Sources/PackageSigning/SignatureProvider.swift
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@ import struct Foundation.Date

#if USE_IMPL_ONLY_IMPORTS
#if canImport(Security)
@_implementationOnly import Security
internal import Security
#endif

@_implementationOnly import SwiftASN1
@_implementationOnly @_spi(CMS) import X509
internal import SwiftASN1
@_spi(CMS) internal import X509
#else
#if canImport(Security)
import Security
4 changes: 2 additions & 2 deletions Sources/PackageSigning/SigningEntity/SigningEntity.swift
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftASN1
@_implementationOnly import X509
internal import SwiftASN1
internal import X509
#else
import SwiftASN1
import X509
6 changes: 3 additions & 3 deletions Sources/PackageSigning/SigningIdentity.swift
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@

#if USE_IMPL_ONLY_IMPORTS
#if canImport(Security)
@_implementationOnly import Security
internal import Security
#endif

@_implementationOnly import Crypto
@_implementationOnly import X509
internal import Crypto
internal import X509
#else
#if canImport(Security)
import Security
4 changes: 2 additions & 2 deletions Sources/PackageSigning/VerifierPolicies.swift
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ import struct Foundation.URL
import Basics

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftASN1
@_implementationOnly @_spi(DisableValidityCheck) import X509
internal import SwiftASN1
@_spi(DisableValidityCheck) internal import X509
#else
import SwiftASN1
@_spi(DisableValidityCheck) import X509
6 changes: 3 additions & 3 deletions Sources/PackageSigning/X509Extensions.swift
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ import struct Foundation.Data

#if USE_IMPL_ONLY_IMPORTS
#if canImport(Security)
@_implementationOnly import Security
internal import Security
#endif

@_implementationOnly import SwiftASN1
@_implementationOnly import X509
internal import SwiftASN1
internal import X509
#else
#if canImport(Security)
import Security