Skip to content

Commit f55d45c

Browse files
authored
Removed deprecated code (#93)
### Motivation Fixes #80. In prep for 1.0, remove deprecated code we kept around for easier migration between alphas. ### Modifications Removed deprecated code. ### Result Less code to maintain for the lifetime of 1.0. ### Test Plan Updated tests.
1 parent b1fc0c0 commit f55d45c

File tree

2 files changed

+3
-85
lines changed

2 files changed

+3
-85
lines changed

Sources/Configuration/Deprecations.swift

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,4 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if JSONSupport
16-
/// A provider of configuration in JSON files.
17-
@available(Configuration 1.0, *)
18-
@available(*, deprecated, message: "Renamed to FileProvider<JSONSnapshot>")
19-
public typealias JSONProvider = FileProvider<JSONSnapshot>
20-
#endif
21-
22-
#if YAMLSupport
23-
/// A provider of configuration in YAML files.
24-
@available(Configuration 1.0, *)
25-
@available(*, deprecated, message: "Renamed to FileProvider<YAMLSnapshot>")
26-
public typealias YAMLProvider = FileProvider<YAMLSnapshot>
27-
#endif
28-
29-
#if ReloadingSupport
30-
31-
#if JSONSupport
32-
/// A reloading provider of configuration in JSON files.
33-
@available(Configuration 1.0, *)
34-
@available(*, deprecated, message: "Renamed to ReloadingFileProvider<JSONSnapshot>")
35-
public typealias ReloadingJSONProvider = ReloadingFileProvider<JSONSnapshot>
36-
#endif
37-
38-
#if YAMLSupport
39-
/// A reloading provider of configuration in JSON files.
40-
@available(Configuration 1.0, *)
41-
@available(*, deprecated, message: "Renamed to ReloadingFileProvider<YAMLSnapshot>")
42-
public typealias ReloadingYAMLProvider = ReloadingFileProvider<YAMLSnapshot>
43-
#endif
44-
45-
#endif
46-
47-
/// An immutable snapshot of a configuration provider's state.
48-
@available(Configuration 1.0, *)
49-
@available(*, deprecated, renamed: "ConfigSnapshot")
50-
public typealias ConfigSnapshotProtocol = ConfigSnapshot
51-
52-
@available(Configuration 1.0, *)
53-
extension ConfigReader {
54-
/// Provides a snapshot of the current configuration state and passes it to the provided closure.
55-
///
56-
/// This method creates a snapshot of the current configuration state and passes it to the
57-
/// provided closure. The snapshot reader provides read-only access to the configuration's state
58-
/// at the time the method was called.
59-
///
60-
/// ```swift
61-
/// let result = config.withSnapshot { snapshot in
62-
/// // Use snapshot to read config values
63-
/// let cert = snapshot.string(forKey: "cert")
64-
/// let privateKey = snapshot.string(forKey: "privateKey")
65-
/// // Ensures that both values are coming from the same underlying snapshot and that a provider
66-
/// // didn't change its internal state between the two `string(...)` calls.
67-
/// return MyCert(cert: cert, privateKey: privateKey)
68-
/// }
69-
/// ```
70-
///
71-
/// - Parameter body: A closure that takes a `ConfigSnapshotReader` and returns a value.
72-
/// - Returns: The value returned by the closure.
73-
/// - Throws: Rethrows any errors thrown by the provided closure.
74-
@available(*, deprecated, message: "Renamed to snapshot().")
75-
public func withSnapshot<Failure: Error, Return: ~Copyable>(
76-
_ body: (ConfigSnapshotReader) throws(Failure) -> Return
77-
) throws(Failure) -> Return {
78-
let multiSnapshot = provider.snapshot()
79-
let snapshotReader = ConfigSnapshotReader(
80-
keyPrefix: keyPrefix,
81-
storage: .init(
82-
snapshot: multiSnapshot,
83-
accessReporter: accessReporter
84-
)
85-
)
86-
return try body(snapshotReader)
87-
}
88-
}
15+
// Put deprecated symbols here and they will be removed during the next API-break.

Tests/ConfigurationTests/Deprecations.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@
1515
import Configuration
1616
import SystemPackage
1717

18-
/// This type only exists to test that deprecated symbols are still usable.
18+
/// Test that deprecated symbols are still usable.
1919
@available(Configuration 1.0, *)
2020
@available(*, deprecated)
21-
struct Deprecations {
22-
#if ReloadingSupport && JSONSupport && YAMLSupport
23-
func fileProviders() async throws {
24-
let _ = try await JSONProvider(filePath: "/dev/null")
25-
let _ = try await ReloadingJSONProvider(filePath: "/dev/null")
26-
let _ = try await YAMLProvider(filePath: "/dev/null")
27-
let _ = try await ReloadingYAMLProvider(filePath: "/dev/null")
28-
}
29-
#endif
30-
}
21+
struct Deprecations {}

0 commit comments

Comments
 (0)