Skip to content

Commit 461ff3d

Browse files
committed
Mark the PackageDescription manifest API as being available only with tools version 999.0 since this hasn't been approved yet.
1 parent 0dd702e commit 461ff3d

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

Sources/PackageDescription/Target.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public final class Target {
131131
/// this enum will be extended as new plugin capabilities are added.
132132
public enum PluginCapability {
133133
case _buildTool
134+
@available(_PackageDescription, introduced: 999.0)
134135
case _command(intent: PluginCommandIntent, permissions: [PluginPermission])
135136
}
136137

@@ -1015,7 +1016,7 @@ extension Target.PluginCapability {
10151016
/// Specifies that the plugin provides a user command capability. It will
10161017
/// be available to invoke manually on one or more targets in a package.
10171018
/// The package can specify the verb that is used to invoke the command.
1018-
@available(_PackageDescription, introduced: 5.6)
1019+
@available(_PackageDescription, introduced: 999.0)
10191020
/// Plugins that specify a `command` capability define commands that can be run
10201021
/// using the SwiftPM CLI (`swift package <verb>`), or in an IDE that supports
10211022
/// Swift Packages.
@@ -1033,6 +1034,7 @@ extension Target.PluginCapability {
10331034
}
10341035
}
10351036

1037+
@available(_PackageDescription, introduced: 999.0)
10361038
public enum PluginCommandIntent {
10371039
/// The intent of the command is to generate documentation, either by parsing the
10381040
/// package contents directly or by using the build system support for generating
@@ -1050,6 +1052,7 @@ public enum PluginCommandIntent {
10501052
case custom(verb: String, description: String)
10511053
}
10521054

1055+
@available(_PackageDescription, introduced: 999.0)
10531056
public enum PluginPermission {
10541057
/// The custom command plugin requests permission to modify the files inside the
10551058
/// package directory. The `reason` string is shown to the user at the time of

Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,6 @@ class PackageDescription5_6LoadingTests: PackageDescriptionLoadingTests {
9494
XCTAssertEqual(manifest.targets[0].pluginCapability, .buildTool)
9595
}
9696

97-
func testCommandPluginTarget() throws {
98-
let content = """
99-
import PackageDescription
100-
let package = Package(
101-
name: "Foo",
102-
targets: [
103-
.plugin(
104-
name: "Foo",
105-
capability: .command(
106-
intent: .custom(verb: "mycmd", description: "helpful description of mycmd"),
107-
permissions: [ .packageWritability(reason: "YOLO") ]
108-
)
109-
)
110-
]
111-
)
112-
"""
113-
114-
let observability = ObservabilitySystem.makeForTesting()
115-
let manifest = try loadManifest(content, observabilityScope: observability.topScope)
116-
XCTAssertNoDiagnostics(observability.diagnostics)
117-
118-
XCTAssertEqual(manifest.targets[0].type, .plugin)
119-
XCTAssertEqual(manifest.targets[0].pluginCapability, .command(intent: .custom(verb: "mycmd", description: "helpful description of mycmd"), permissions: [.packageWritability(reason: "YOLO")]))
120-
}
121-
12297
func testPluginTargetCustomization() throws {
12398
let content = """
12499
import PackageDescription

Tests/PackageLoadingTests/PD_Next_LoadingTests.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,29 @@ class PackageDescriptionNextLoadingTests: PackageDescriptionLoadingTests {
4444
XCTAssertEqual(deps["x.qux"], .registry(identity: "x.qux", requirement: .range("1.1.1" ..< "1.2.0")))
4545
XCTAssertEqual(deps["x.quux"], .registry(identity: "x.quux", requirement: .range("1.1.1" ..< "3.0.0")))
4646
}
47+
48+
func testCommandPluginTarget() throws {
49+
let content = """
50+
import PackageDescription
51+
let package = Package(
52+
name: "Foo",
53+
targets: [
54+
.plugin(
55+
name: "Foo",
56+
capability: .command(
57+
intent: .custom(verb: "mycmd", description: "helpful description of mycmd"),
58+
permissions: [ .packageWritability(reason: "YOLO") ]
59+
)
60+
)
61+
]
62+
)
63+
"""
64+
65+
let observability = ObservabilitySystem.makeForTesting()
66+
let manifest = try loadManifest(content, observabilityScope: observability.topScope)
67+
XCTAssertNoDiagnostics(observability.diagnostics)
68+
69+
XCTAssertEqual(manifest.targets[0].type, .plugin)
70+
XCTAssertEqual(manifest.targets[0].pluginCapability, .command(intent: .custom(verb: "mycmd", description: "helpful description of mycmd"), permissions: [.packageWritability(reason: "YOLO")]))
71+
}
4772
}

0 commit comments

Comments
 (0)