File tree Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 7
7
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8
8
9
9
add_library (PackageRegistry
10
+ Registry.swift
10
11
RegistryConfiguration.swift )
11
12
target_link_libraries (PackageRegistry PUBLIC
12
13
TSCBasic
Original file line number Diff line number Diff line change
1
+ /*
2
+ This source file is part of the Swift.org open source project
3
+
4
+ Copyright (c) 2021 Apple Inc. and the Swift project authors
5
+ Licensed under Apache License v2.0 with Runtime Library Exception
6
+
7
+ See http://swift.org/LICENSE.txt for license information
8
+ See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9
+ */
10
+
11
+ import struct Foundation. URL
12
+
13
+ public struct Registry : Hashable , Codable {
14
+ public var url : Foundation . URL
15
+
16
+ public init ( url: Foundation . URL ) {
17
+ self . url = url
18
+ }
19
+ }
Original file line number Diff line number Diff line change @@ -13,15 +13,7 @@ import Foundation
13
13
public struct RegistryConfiguration : Hashable {
14
14
public typealias Scope = String
15
15
16
- public struct Registry : Hashable {
17
- public var url : Foundation . URL
18
-
19
- public init ( url: Foundation . URL ) {
20
- self . url = url
21
- }
22
- }
23
-
24
- public enum Version : Int {
16
+ public enum Version : Int , Codable {
25
17
case v1 = 1
26
18
}
27
19
@@ -48,6 +40,10 @@ public struct RegistryConfiguration: Hashable {
48
40
self . scopedRegistries [ scope] = registry
49
41
}
50
42
}
43
+
44
+ public func registry( for scope: Scope ) -> Registry ? {
45
+ return scopedRegistries [ scope] ?? defaultRegistry
46
+ }
51
47
}
52
48
53
49
// MARK: - Codable
@@ -108,6 +104,3 @@ extension RegistryConfiguration: Codable {
108
104
}
109
105
}
110
106
}
111
-
112
- extension RegistryConfiguration . Version : Codable { }
113
- extension RegistryConfiguration . Registry : Codable { }
You can’t perform that action at this time.
0 commit comments