Skip to content

Commit 0767984

Browse files
authored
Rename traits: drop the Support suffix (#101)
### Motivation Fixes #99. The `Support` suffix of all package traits isn't necessary and the ecosystem seems to be converging on simpler, shorter names that describe the capability. ### Modifications Renamed traits, removed the `Support` suffix. ### Result Shorter trait names, more in line with other packages. ### Test Plan Tests passed. Will update the example post-1.0, #100.
1 parent cc2944b commit 0767984

21 files changed

+43
-43
lines changed

Examples/hello-world-cli-example/Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let package = Package(
1111
.package(
1212
url: "https://github.com/apple/swift-configuration",
1313
// TODO: Update once 1.0.0 is tagged.
14-
exact: "1.0.0-alpha.1",
15-
traits: [.defaults, "CommandLineArgumentsSupport"]
14+
branch: "main",
15+
traits: [.defaults, "CommandLineArguments"]
1616
)
1717
],
1818
targets: [

Package.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ import Foundation
88
#endif
99

1010
let defaultTraits: Set<String> = [
11-
"JSONSupport"
11+
"JSON"
1212
]
1313

1414
var traits: Set<Trait> = [
1515
.trait(
16-
name: "LoggingSupport",
16+
name: "Logging",
1717
description: "Adds support for swift-log integration."
1818
),
1919
.trait(
20-
name: "JSONSupport",
20+
name: "JSON",
2121
description: "Adds support for parsing JSON configuration files."
2222
),
2323
.trait(
24-
name: "ReloadingSupport",
24+
name: "Reloading",
2525
description:
2626
"Adds support for reloading built-in provider variants, such as ReloadingFileProvider.",
2727
enabledTraits: [
28-
"LoggingSupport"
28+
"Logging"
2929
]
3030
),
3131
.trait(
32-
name: "CommandLineArgumentsSupport",
32+
name: "CommandLineArguments",
3333
description: "Adds support for parsing command line arguments."
3434
),
3535
.trait(
36-
name: "YAMLSupport",
36+
name: "YAML",
3737
description: "Adds support for parsing YAML configuration files."
3838
),
3939
]
@@ -95,22 +95,22 @@ let package = Package(
9595
.product(
9696
name: "Logging",
9797
package: "swift-log",
98-
condition: .when(traits: ["LoggingSupport"])
98+
condition: .when(traits: ["Logging"])
9999
),
100100
.product(
101101
name: "Metrics",
102102
package: "swift-metrics",
103-
condition: .when(traits: ["ReloadingSupport"])
103+
condition: .when(traits: ["Reloading"])
104104
),
105105
.product(
106106
name: "ServiceLifecycle",
107107
package: "swift-service-lifecycle",
108-
condition: .when(traits: ["ReloadingSupport"])
108+
condition: .when(traits: ["Reloading"])
109109
),
110110
.product(
111111
name: "Yams",
112112
package: "Yams",
113-
condition: .when(traits: ["YAMLSupport"])
113+
condition: .when(traits: ["YAML"])
114114
),
115115
],
116116
exclude: [

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ To enable an additional trait on the package, update the package dependency:
9393
.package(
9494
url: "https://github.com/apple/swift-configuration",
9595
from: "1.0.0",
96-
+ traits: [.defaults, "OtherFeatureSupport"]
96+
+ traits: [.defaults, "YAML"]
9797
)
9898
```
9999

100100
Available traits:
101-
- **`JSONSupport`** (default): Adds support for `FileProvider<JSONSnapshot>`, a `ConfigProvider` for reading JSON files.
102-
- **`LoggingSupport`** (opt-in): Adds support for `AccessLogger`, a way to emit access events into a `SwiftLog.Logger`.
103-
- **`ReloadingSupport`** (opt-in): Adds support for auto-reloading variants of file providers, such as `ReloadingFileProvider<JSONSnapshot>` (when `JSONSupport` is enabled) and `ReloadingFileProvider<YAMLSnapshot>` (when `YAMLSupport` is enabled).
104-
- **`CommandLineArgumentsSupport`** (opt-in): Adds support for `CommandLineArgumentsProvider` for parsing command line arguments.
105-
- **`YAMLSupport`** (opt-in): Adds support for `FileProvider<YAMLSnapshot>`, a `ConfigProvider` for reading YAML files.
101+
- **`JSON`** (default): Adds support for `FileProvider<JSONSnapshot>`, a `ConfigProvider` for reading JSON files.
102+
- **`Logging`** (opt-in): Adds support for `AccessLogger`, a way to emit access events into a `SwiftLog.Logger`.
103+
- **`Reloading`** (opt-in): Adds support for auto-reloading variants of file providers, such as `ReloadingFileProvider<JSONSnapshot>` (when `JSON` is enabled) and `ReloadingFileProvider<YAMLSnapshot>` (when `YAML` is enabled).
104+
- **`CommandLineArguments`** (opt-in): Adds support for `CommandLineArgumentsProvider` for parsing command line arguments.
105+
- **`YAML`** (opt-in): Adds support for `FileProvider<YAMLSnapshot>`, a `ConfigProvider` for reading YAML files.
106106

107107
## Supported platforms and minimum versions
108108

Sources/Configuration/AccessReporters/AccessLogger.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if LoggingSupport
15+
#if Logging
1616

1717
public import Logging
1818

@@ -27,7 +27,7 @@ import Synchronization
2727
///
2828
/// ## Package traits
2929
///
30-
/// This type is guarded by the `LoggingSupport` package trait.
30+
/// This type is guarded by the `Logging` package trait.
3131
///
3232
/// ## Usage
3333
///

Sources/Configuration/Documentation.docc/Documentation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,16 @@ To enable an additional trait on the package, update the package dependency:
180180
.package(
181181
url: "https://github.com/apple/swift-configuration",
182182
from: "1.0.0",
183-
+ traits: [.defaults, "OtherFeatureSupport"]
183+
+ traits: [.defaults, "YAML"]
184184
)
185185
```
186186

187187
Available traits:
188-
- **`JSONSupport`** (default): Adds support for ``JSONSnapshot``, which enables using ``FileProvider`` and ``ReloadingFileProvider`` with JSON files.
189-
- **`LoggingSupport`** (opt-in): Adds support for ``AccessLogger``, a way to emit access events into a `SwiftLog.Logger`.
190-
- **`ReloadingSupport`** (opt-in): Adds support for ``ReloadingFileProvider``, which provides auto-reloading capability for file-based configuration.
191-
- **`CommandLineArgumentsSupport`** (opt-in): Adds support for ``CommandLineArgumentsProvider`` for parsing command line arguments.
192-
- **`YAMLSupport`** (opt-in): Adds support for ``YAMLSnapshot``, which enables using ``FileProvider`` and ``ReloadingFileProvider`` with YAML files.
188+
- **`JSON`** (default): Adds support for ``JSONSnapshot``, which enables using ``FileProvider`` and ``ReloadingFileProvider`` with JSON files.
189+
- **`Logging`** (opt-in): Adds support for ``AccessLogger``, a way to emit access events into a Swift Log `Logger`.
190+
- **`Reloading`** (opt-in): Adds support for ``ReloadingFileProvider``, which provides auto-reloading capability for file-based configuration.
191+
- **`CommandLineArguments`** (opt-in): Adds support for ``CommandLineArgumentsProvider`` for parsing command line arguments.
192+
- **`YAML`** (opt-in): Adds support for ``YAMLSnapshot``, which enables using ``FileProvider`` and ``ReloadingFileProvider`` with YAML files.
193193

194194
### Supported platforms and minimum versions
195195

Sources/Configuration/Providers/CLI/CLIArgumentParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if CommandLineArgumentsSupport
15+
#if CommandLineArguments
1616

1717
#if canImport(FoundationEssentials)
1818
import FoundationEssentials

Sources/Configuration/Providers/CLI/CLISnapshot.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if CommandLineArgumentsSupport
15+
#if CommandLineArguments
1616

1717
#if canImport(FoundationEssentials)
1818
import FoundationEssentials

Sources/Configuration/Providers/CLI/CommandLineArgumentsProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if CommandLineArgumentsSupport
15+
#if CommandLineArguments
1616

1717
/// A configuration provider that sources values from command-line arguments.
1818
///

Sources/Configuration/Providers/Files/JSONSnapshot.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if JSONSupport
15+
#if JSON
1616

1717
import SystemPackage
1818

Sources/Configuration/Providers/Files/ReloadingFileProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if ReloadingSupport
15+
#if Reloading
1616

1717
#if canImport(FoundationEssentials)
1818
import FoundationEssentials

0 commit comments

Comments
 (0)