Skip to content

Opt the entire project into MemberImportVisibility #406

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 3 commits into from
Apr 14, 2025
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
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ func swiftSettings(languageMode: SwiftLanguageMode) -> [SwiftSetting] {
.enableUpcomingFeature("ConciseMagicFile"),
.enableUpcomingFeature("DeprecateApplicationMain"),
.enableUpcomingFeature("DisableOutwardActorInference"),
//.enableUpcomingFeature("DynamicActorIsolation"),
.enableUpcomingFeature("ForwardTrailingClosures"),
.enableUpcomingFeature("GlobalActorIsolatedTypesUsability"),
.enableUpcomingFeature("GlobalConcurrency"),
.enableUpcomingFeature("ImplicitOpenExistentials"),
.enableUpcomingFeature("ImportObjcForwardDeclarations"),
.enableUpcomingFeature("InferSendableFromCaptures"),
.enableUpcomingFeature("IsolatedDefaultValues"),
.enableUpcomingFeature("NonfrozenEnumExhaustivity"),
//.enableUpcomingFeature("RegionBasedIsolation"), // rdar://137809703

// Future Swift features
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("MemberImportVisibility"),
.enableUpcomingFeature("InternalImportsByDefault"),

.swiftLanguageMode(.v5),
Expand All @@ -51,6 +55,7 @@ func swiftSettings(languageMode: SwiftLanguageMode) -> [SwiftSetting] {
return [
// Future Swift features
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("MemberImportVisibility"),
.enableUpcomingFeature("InternalImportsByDefault"),

.swiftLanguageMode(.v6),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBCore
import SWBUtil
import Foundation

/// A grouping strategy that groups all asset catalogs and all strings files that match sticker packs inside those asset catalogs.
@_spi(Testing) public final class ActoolInputFileGroupingStrategy: InputFileGroupingStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import SWBCore
import SWBUtil
import SWBTaskConstruction
import SWBMacro

final class AppIntentsMetadataTaskProducer: PhasedTaskProducer, TaskProducer {

Expand Down
1 change: 1 addition & 0 deletions Sources/SWBApplePlatform/CoreDataCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import SWBUtil
public import SWBCore
import SWBMacro

public final class CoreDataModelCompilerSpec : GenericCompilerSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.compilers.model.coredata"
Expand Down
5 changes: 3 additions & 2 deletions Sources/SWBApplePlatform/CoreMLCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public import SWBUtil
public import SWBCore
public import SWBMacro
import SWBProtocol

public struct DiscoveredCoreMLToolSpecInfo: DiscoveredCommandLineToolSpecInfo {
public let toolPath: Path
Expand Down Expand Up @@ -151,7 +152,7 @@ public final class CoreMLCompilerSpec : GenericCompilerSpec, SpecIdentifierType,
// When the build setting is empty or is set to Automatic, then use an appropriate string based on the predominant source code language for the target.
if languageSettingValue.isEmpty || languageSettingValue == "Automatic" {
// Note that it would be pretty weird here to not have a configured target, or to have a target which is not a StandardTarget.
let predominantSourceCodeLanguage = (cbc.producer.configuredTarget?.target as? StandardTarget)?.predominantSourceCodeLanguage ?? .undefined
let predominantSourceCodeLanguage = (cbc.producer.configuredTarget?.target as? SWBCore.StandardTarget)?.predominantSourceCodeLanguage ?? .undefined
switch predominantSourceCodeLanguage {
case .swift:
codegenLanguage = "Swift"
Expand Down Expand Up @@ -289,7 +290,7 @@ public final class CoreMLCompilerSpec : GenericCompilerSpec, SpecIdentifierType,
}

guard
let target = cbc.producer.configuredTarget?.target as? BuildPhaseTarget,
let target = cbc.producer.configuredTarget?.target as? SWBCore.BuildPhaseTarget,
let outputPath = headerOutputPath,
target.headersBuildPhase != nil else { continue }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import SWBCore
import SWBUtil
import SWBTaskConstruction
import SWBMacro

final class DevelopmentAssetsTaskProducer: StandardTaskProducer, TaskProducer {
func generateTasks() async -> [any PlannedTask] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import SWBUtil
public import SWBCore
import SWBMacro

public final class InstrumentsPackageBuilderSpec: GenericCompilerSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.compilers.instruments-package-builder"
Expand Down
8 changes: 5 additions & 3 deletions Sources/SWBApplePlatform/IntentsCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import SWBUtil
public import SWBCore
import SWBProtocol
import SWBMacro

/// Payload information for Intents tasks.
fileprivate struct IntentsTaskPayload: TaskPayload, Encodable {
Expand Down Expand Up @@ -122,7 +124,7 @@ public final class IntentsCompilerSpec : GenericCompilerSpec, SpecIdentifierType
let outputDir = cbc.scope.evaluate(BuiltinMacros.DERIVED_FILE_DIR).join("IntentDefinitionGenerated").join(modelName).normalize()

guard
let target = cbc.producer.configuredTarget?.target as? BuildPhaseTarget,
let target = cbc.producer.configuredTarget?.target as? SWBCore.BuildPhaseTarget,
target.sourcesBuildPhase != nil,
let intentsCodegenVisibility = input.intentsCodegenVisibility else { return }

Expand All @@ -136,7 +138,7 @@ public final class IntentsCompilerSpec : GenericCompilerSpec, SpecIdentifierType
// When the build setting is empty or is set to Automatic, then use an appropriate string based on the predominant source code language for the target.
if languageSettingValue.isEmpty || languageSettingValue == "Automatic" {
// Note that it would be pretty weird here to not have a configured target, or to have a target which is not a StandardTarget.
let predominantSourceCodeLanguage = (cbc.producer.configuredTarget?.target as? StandardTarget)?.predominantSourceCodeLanguage ?? .undefined
let predominantSourceCodeLanguage = (cbc.producer.configuredTarget?.target as? SWBCore.StandardTarget)?.predominantSourceCodeLanguage ?? .undefined
switch predominantSourceCodeLanguage {
case .swift:
codegenLanguage = "Swift"
Expand Down Expand Up @@ -236,7 +238,7 @@ public final class IntentsCompilerSpec : GenericCompilerSpec, SpecIdentifierType
}

guard
let target = cbc.producer.configuredTarget?.target as? BuildPhaseTarget,
let target = cbc.producer.configuredTarget?.target as? SWBCore.BuildPhaseTarget,
let outputPath = headerOutputPath,
target.headersBuildPhase != nil else { continue }

Expand Down
1 change: 1 addition & 0 deletions Sources/SWBApplePlatform/MiGCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public import SWBUtil
public import SWBCore
public import SWBMacro
import SWBProtocol

public struct DiscoveredMiGToolSpecInfo: DiscoveredCommandLineToolSpecInfo {
public let toolPath: Path
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBApplePlatform/RealityAssetsCompilerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import Foundation
package import SWBCore
import SWBUtil
import SWBMacro

//---------------------
//
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBApplePlatform/ResMergerLinkerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import SWBUtil
public import SWBCore
import SWBMacro

public final class ResMergerLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.pbx.linkers.resmerger"
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBApplePlatform/XCStringsCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import SWBUtil
public import SWBCore
import Foundation

public final class XCStringsCompilerSpec: GenericCompilerSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.compilers.xcstrings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBCore
import SWBUtil

/// A grouping strategy that places each xcstrings table in its own group, along with any other .strings or .stringsdicts with the same basename.
///
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBBuildService/BuildOperationMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import SWBTaskConstruction
import SWBTaskExecution
package import SWBUtil
import SWBMacro
import Synchronization

// FIXME: Workaround: <rdar://problem/26249252> Unable to prefer my own type over NS renamed types
import class SWBTaskExecution.Task
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBBuildService/PreviewInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package import SWBCore
import SWBTaskConstruction
package import SWBTaskExecution
package import SWBUtil
import SWBMacro

enum PreviewInfoErrors: Error {
case noBuildDescription(any Error)
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBBuildService/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public import SWBServiceCore
package import SWBTaskExecution
import SWBUtil
import struct Foundation.UUID
import Synchronization

enum SessionError: Error {
case noSettings(String)
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBBuildSystem/CleanOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package import var Foundation.NSLocalizedDescriptionKey
package import class Foundation.NSError
package import struct Foundation.URL
package import struct Foundation.UUID
import SWBMacro

package final class CleanOperation: BuildSystemOperation, TargetDependencyResolverDelegate {
package var diagnosticContext: DiagnosticContextData {
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBBuildSystem/DependencyCycleFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import SWBTaskExecution
import SWBUtil
import Foundation
private import SWBLLBuild
import SWBTaskConstruction

/// Convenience enum to encode whether a task is the beginning or end of a target, or something else.
/// "End of a target" in this case is a task which tasks in other targets may be directly depending on, and so can mark the point at which we cross a target boundary.
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/BuildFileResolution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import SWBMacro

/// Protocol to support getting resolved information about a `BuildFile` within a `ConfiguredTarget`.
public protocol BuildFileResolution: SpecLookupContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import Foundation

public struct ModuleVerifierFramework {
@_spi(Testing) public let directory: Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import Foundation

enum HeaderKind: String {
case publicHeader = "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import Foundation

public struct ModuleVerifierTarget: Equatable {
public let value: String
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/ConfiguredTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import SWBProtocol

public final class ConfiguredTarget: Hashable, CustomStringConvertible, Serializable, Comparable, Sendable, Encodable {
/// The build parameters to use for this target.
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/MacroConfigFileLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBUtil
public import SWBMacro
import Foundation

/// Information on a macro config file.
@_spi(Testing) public struct MacroConfigInfo: Sendable {
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/MacroEvaluationExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBUtil
public import SWBMacro
import Foundation

public extension PropertyListItem
{
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/MacroExpressionSourceExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBMacro
public import SWBProtocol
import SWBUtil

extension MacroNamespace {
/// Parses `strings` as a macro expression string list, returning a MacroExpression object to represent it. The returned macro expression contains a copy of the input string and a compiled representation that can be used to evaluate the expression in a particular context. The diagnostics handler is invoked once for every issue found during the parsing. Even in the presence of errors, this method always returns an expression that’s as parsed as possible.
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/PlatformFiltering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBMacro
import SWBUtil

extension PlatformFilter {
public convenience init?(_ scope: MacroEvaluationScope) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SWBCore/ProjectModel/FilePathResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public import SWBUtil
public import SWBMacro

import SWBProtocol

/// A FilePathResolver is used to resolve the absolute paths for Reference objects.
public final class FilePathResolver: Sendable
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/ProjectModel/PIFLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public import SWBUtil
public import SWBProtocol
public import SWBMacro
import Foundation

enum PIFLoadingError: Error {
/// Indicates a general PIF object decoding error.
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/ProjectModel/PlatformFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import SWBUtil
import SWBProtocol
import Foundation

/// Provides a generic mechanism to provide project model items to be filterable for a given platform.
public final class PlatformFilter: ProjectModelItem, Hashable, Codable {
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/ProjectModel/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import SWBProtocol
public import SWBUtil
public import SWBMacro
import Foundation

public enum DuplicatedIdentifierObjectType: String, Sendable {
case project
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/Settings/BuildRuleFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import Foundation
import SWBMacro
import SWBUtil

/// Decodable representation of a .xcbuildrules file's on-disk format.
struct BuildRuleFile: Codable {
Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/Settings/BuiltinMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBMacro
import Synchronization

/// The builtin macro declarations for things which are used directly by the build system.
public final class BuiltinMacros {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public import SWBUtil
public import struct Foundation.Data
public import class Foundation.JSONDecoder
public import SWBMacro
import SWBProtocol

/// Describes the type and other characteristics of a single kind of input file accepted by a build tool.
struct InputFileTypeDescriptor: Encodable, Sendable {
Expand Down
2 changes: 2 additions & 0 deletions Sources/SWBCore/SpecImplementations/SpecRegistry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import SWBLibc
public import SWBUtil
public import SWBMacro
import Foundation
import Synchronization

/// Delegate protocol used by the registry to report diagnostics.
@_spi(Testing) public protocol SpecRegistryDelegate: DiagnosticProducingDelegate {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBUtil
public import SWBMacro
import Foundation


/// Abstract C Compiler. This is not a concrete implementation, but rather it uses various information in the command build context to choose a specific compiler and to call `constructTasks()` on that compiler. This provides a level of indirection for projects that just want their source files compiled using the default C compiler. Depending on the context, the default C compiler for any particular combination of platform, architecture, and other factors may be Clang, ICC, GCC, or some other compiler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//
//===----------------------------------------------------------------------===//

import SWBUtil

final public class ClangStatCacheSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.compilers.clang-stat-cache"

Expand Down
1 change: 1 addition & 0 deletions Sources/SWBCore/SpecImplementations/Tools/CodeSign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public import SWBUtil
public import SWBMacro
import Foundation

public final class CodesignToolSpec : CommandLineToolSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.build-tools.codesign"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import SWBMacro

public final class ConcatenateToolSpec : CommandLineToolSpec, SpecImplementationType, @unchecked Sendable {
public static let identifier = "com.apple.build-tools.concatenate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

import SWBUtil
import SWBMacro

public final class CreateBuildDirectorySpec: CommandLineToolSpec, SpecImplementationType, @unchecked Sendable {
public static let identifier = "com.apple.tools.create-build-directory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
//===----------------------------------------------------------------------===//

public import SWBUtil
import SWBMacro
import Foundation

public final class InfoPlistToolSpec : GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable {
public static let identifier = "com.apple.tools.info-plist-utility"
Expand Down
Loading