Skip to content

Replace 5.11 version with 6.0 in the code base #7361

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 6 commits into from
Feb 23, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.11
// swift-tools-version: 6.0

import PackageDescription

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.11
// swift-tools-version: 6.0

import PackageDescription

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.11
// swift-tools-version: 6.0
import PackageDescription

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/SwiftVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public struct SwiftVersion {
extension SwiftVersion {
/// The current version of the package manager.
public static let current = SwiftVersion(
version: (5, 11, 0),
version: (6, 0, 0),
isDevelopment: true,
buildIdentifier: getBuildIdentifier()
)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Build/BuildManifest/LLBuildManifestBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ extension LLBuildManifestBuilder {
}
let additionalOutputs: [Node]
if command.outputFiles.isEmpty {
if target.toolsVersion >= .v5_11 {
if target.toolsVersion >= .v6_0 {
additionalOutputs = [.virtual("\(target.target.c99name)-\(command.configuration.displayName ?? "\(pluginNumber)")")]
phonyOutputs += additionalOutputs
} else {
additionalOutputs = []
observabilityScope.emit(warning: "Build tool command '\(displayName)' (applied to target '\(target.target.name)') does not declare any output files and therefore will not run. You may want to consider updating the given package to tools-version 5.11 (or higher) which would run such a build tool command even without declared outputs.")
observabilityScope.emit(warning: "Build tool command '\(displayName)' (applied to target '\(target.target.name)') does not declare any output files and therefore will not run. You may want to consider updating the given package to tools-version 6.0 (or higher) which would run such a build tool command even without declared outputs.")
}
pluginNumber += 1
} else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/PackageTools/Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extension SwiftPackageTool {
}
}

#if swift(<5.11)
#if swift(<6.0)
extension InitPackage.PackageType: ExpressibleByArgument {}
#else
extension InitPackage.PackageType: @retroactive ExpressibleByArgument {}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/Utilities/APIDigester.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ extension SerializedDiagnostics.SourceLocation {
}
}

#if swift(<5.11)
#if swift(<6.0)
extension SerializedDiagnostics.SourceLocation: DiagnosticLocation {}
#else
extension SerializedDiagnostics.SourceLocation: @retroactive DiagnosticLocation {}
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreCommands/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ extension URL {
}
}

#if swift(<5.11)
#if swift(<6.0)
extension BuildConfiguration: ExpressibleByArgument {}
extension AbsolutePath: ExpressibleByArgument {}
extension WorkspaceConfiguration.CheckingMode: ExpressibleByArgument {}
Expand Down
4 changes: 2 additions & 2 deletions Sources/PackageDescription/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct Context {
}

/// Information about the git status of a given package, if available.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public static var gitInformation: GitInformation? {
model.gitInformation.map {
GitInformation(
Expand All @@ -45,7 +45,7 @@ public struct Context {
}

/// Information about the git status of a given package, if available.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public struct GitInformation {
public let currentTag: String?
public let currentCommit: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/PackageLoading/TargetSourcesBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public struct TargetSourcesBuilder {
}

let additionalResources: [Resource]
if toolsVersion >= .v5_11 {
if toolsVersion >= .v6_0 {
additionalResources = declaredResources.compactMap { resource in
if handledResources.contains(resource.path) {
return nil
Expand Down
18 changes: 9 additions & 9 deletions Sources/PackageLoading/ToolsVersionParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public struct ToolsVersionParser {
while let newlineIndex = string.firstIndex(where: { $0.isNewline }) {
string = String(string[newlineIndex...].dropFirst())
if !string.isEmpty, let result = try? Self._parse(utf8String: string) {
if result >= ToolsVersion.v5_11 {
if result >= ToolsVersion.v6_0 {
return result
} else {
throw Error.backwardIncompatiblePre5_11(.toolsVersionNeedsToBeFirstLine, specifiedVersion: result)
throw Error.backwardIncompatiblePre6_0(.toolsVersionNeedsToBeFirstLine, specifiedVersion: result)
}
}
}
Expand Down Expand Up @@ -504,9 +504,9 @@ extension ToolsVersionParser {
case unidentified
}

/// Details of backward-incompatible contents with Swift tools version < 5.11.
public enum BackwardIncompatibilityPre5_11 {
/// Tools-versions on subsequent lines of the manifest are only accepted by 5.11 or later.
/// Details of backward-incompatible contents with Swift tools version < 6.0.
public enum BackwardIncompatibilityPre6_0 {
/// Tools-versions on subsequent lines of the manifest are only accepted by 6.0 or later.
case toolsVersionNeedsToBeFirstLine
}

Expand All @@ -520,8 +520,8 @@ extension ToolsVersionParser {
case malformedToolsVersionSpecification(_ malformationLocation: ToolsVersionSpecificationMalformationLocation)
/// Backward-incompatible contents with Swift tools version < 5.4.
case backwardIncompatiblePre5_4(_ incompatibility: BackwardIncompatibilityPre5_4, specifiedVersion: ToolsVersion)
/// Backward-incompatible contents with Swift tools version < 5.11.
case backwardIncompatiblePre5_11(_ incompatibility: BackwardIncompatibilityPre5_11, specifiedVersion: ToolsVersion)
/// Backward-incompatible contents with Swift tools version < 6.0.
case backwardIncompatiblePre6_0(_ incompatibility: BackwardIncompatibilityPre6_0, specifiedVersion: ToolsVersion)

public var description: String {

Expand Down Expand Up @@ -588,10 +588,10 @@ extension ToolsVersionParser {
case .unidentified:
return "the manifest is backward-incompatible with Swift < 5.4, but the package manager is unable to pinpoint the exact incompatibility; consider replacing the current Swift tools version specification with '\(specifiedVersion.specification())' to specify Swift \(specifiedVersion) as the lowest Swift version supported by the project, then move the new specification to the very beginning of this manifest file; additionally, please consider filing a bug report on https://bugs.swift.org with this file attached"
}
case let .backwardIncompatiblePre5_11(incompatibility, _):
case let .backwardIncompatiblePre6_0(incompatibility, _):
switch incompatibility {
case .toolsVersionNeedsToBeFirstLine:
return "the manifest is backward-incompatible with Swift < 5.11 because the tools-version was specified in a subsequent line of the manifest, not the first line. Either move the tools-version specification or increase the required tools-version of your manifest"
return "the manifest is backward-incompatible with Swift < 6.0 because the tools-version was specified in a subsequent line of the manifest, not the first line. Either move the tools-version specification or increase the required tools-version of your manifest"
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/PackageModel/ToolsVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct ToolsVersion: Equatable, Hashable, Codable, Sendable {
public static let v5_8 = ToolsVersion(version: "5.8.0")
public static let v5_9 = ToolsVersion(version: "5.9.0")
public static let v5_10 = ToolsVersion(version: "5.10.0")
public static let v5_11 = ToolsVersion(version: "5.11.0")
public static let v6_0 = ToolsVersion(version: "6.0.0")
public static let vNext = ToolsVersion(version: "999.0.0")

/// The current tools version in use.
Expand Down
8 changes: 4 additions & 4 deletions Sources/PackagePlugin/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public enum Command {
/// was generated as if in its source directory; other files are treated
/// as resources as if explicitly listed in `Package.swift` using
/// `.process(...)`.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
case buildCommand(
displayName: String?,
executable: URL,
Expand Down Expand Up @@ -76,7 +76,7 @@ public enum Command {
/// this command was generated as if in its source directory; other
/// files are treated as resources as if explicitly listed in
/// `Package.swift` using `.process(...)`.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
case prebuildCommand(
displayName: String?,
executable: URL,
Expand Down Expand Up @@ -114,7 +114,7 @@ public extension Command {
/// was generated as if in its source directory; other files are treated
/// as resources as if explicitly listed in `Package.swift` using
/// `.process(...)`.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
static func buildCommand(
displayName: String?,
executable: Path,
Expand Down Expand Up @@ -204,7 +204,7 @@ public extension Command {
/// this command was generated as if in its source directory; other
/// files are treated as resources as if explicitly listed in
/// `Package.swift` using `.process(...)`.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
static func prebuildCommand(
displayName: String?,
executable: Path,
Expand Down
12 changes: 6 additions & 6 deletions Sources/PackagePlugin/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct PluginContext {
/// write its outputs to that directory. The plugin may also create other
/// directories for cache files and other file system content that either
/// it or the command will need.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
public let pluginWorkDirectory: Path

/// The path of a writable directory into which the plugin or the build
Expand All @@ -46,7 +46,7 @@ public struct PluginContext {
/// write its outputs to that directory. The plugin may also create other
/// directories for cache files and other file system content that either
/// it or the command will need.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public let pluginWorkDirectoryURL: URL

/// Looks up and returns the path of a named command line executable tool.
Expand Down Expand Up @@ -86,12 +86,12 @@ public struct PluginContext {

/// The paths of directories of in which to search for tools that aren't in
/// the `toolNamesToPaths` map.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
let toolSearchDirectories: [Path]

/// The paths of directories of in which to search for tools that aren't in
/// the `toolNamesToPaths` map.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
let toolSearchDirectoryURLs: [URL]

/// Information about a particular tool that is available to a plugin.
Expand All @@ -100,11 +100,11 @@ public struct PluginContext {
public let name: String

/// Full path of the built or provided tool in the file system.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
public let path: Path

/// Full path of the built or provided tool in the file system.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public let url: URL
}
}
12 changes: 6 additions & 6 deletions Sources/PackagePlugin/PackageManagerProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ public struct PackageManager {
/// Represents a single artifact produced during a build.
public struct BuiltArtifact {
/// Full path of the built artifact in the local file system.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
public var path: Path {
return Path(url: url)
}

/// Full path of the built artifact in the local file system.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public var url: URL

/// The kind of artifact that was built.
Expand Down Expand Up @@ -182,14 +182,14 @@ public struct PackageManager {

/// Path of a generated `.profdata` file suitable for processing using
/// `llvm-cov`, if `enableCodeCoverage` was set in the test parameters.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
public var codeCoverageDataFile: Path? {
return codeCoverageDataFileURL.map { Path(url: $0) }
}

/// Path of a generated `.profdata` file suitable for processing using
/// `llvm-cov`, if `enableCodeCoverage` was set in the test parameters.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public var codeCoverageDataFileURL: URL?

/// Represents the results of running some or all of the tests in a
Expand Down Expand Up @@ -265,13 +265,13 @@ public struct PackageManager {
/// Represents the result of symbol graph generation.
public struct SymbolGraphResult {
/// The directory that contains the symbol graph files for the target.
@available(_PackageDescription, deprecated: 5.11)
@available(_PackageDescription, deprecated: 6.0)
public var directoryPath: Path {
return Path(url: directoryURL)
}

/// The directory that contains the symbol graph files for the target.
@available(_PackageDescription, introduced: 5.11)
@available(_PackageDescription, introduced: 6.0)
public var directoryURL: URL
}
}
Expand Down
Loading