Skip to content

Commit 634406d

Browse files
Moved Protocol Declarations Out Of PluginList Files (#910)
* Moved Protocol Declarations Out Of PluginList Files * Addressing comments * Added needed imports * Added Snapshots For Moved Plugin List Declarations (#911) * Added Snapshots For Moved Plugin List Declarations * Regened Snapshots * fixed tests
1 parent 356d134 commit 634406d

22 files changed

+187
-169
lines changed

Sources/NodesGenerator/Resources/Stencils/PluginList.stencil

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,6 @@ import {{ import }}
66
{% endfor %}
77
{% endif %}
88

9-
{% if is_periphery_comment_enabled %}
10-
// periphery:ignore
11-
{% endif %}
12-
/// @mockable
13-
@MainActor
14-
internal protocol {{ plugin_list_name }}Flow: {{ view_controllable_flow_type }} {}
15-
16-
{% if is_periphery_comment_enabled %}
17-
// periphery:ignore
18-
{% endif %}
19-
/// @mockable
20-
@MainActor
21-
internal protocol {{ plugin_list_name }}Listener: AnyObject {}
22-
23-
{% if is_periphery_comment_enabled %}
24-
// periphery:ignore
25-
{% endif %}
26-
/// @mockable
27-
@MainActor
28-
internal protocol {{ plugin_list_name }}Builder: AnyObject {
29-
func build(
30-
withListener listener: {{ plugin_list_name }}Listener
31-
) -> {{ plugin_list_name }}Flow
32-
}
33-
349
// MARK: - Dependency
3510

3611
/// Declares the dependencies required by the component. A code-generated conforming object is made available to the

Sources/NodesGenerator/Resources/Stencils/PluginListInterface.stencil

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ import {{ import }}
1010
This file contains the protocols and types of the plugin list interface requiring public ACL for use in another module.
1111
*/
1212

13+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
14+
{% if is_periphery_comment_enabled %}
15+
// periphery:ignore
16+
{% endif %}
17+
/// @mockable
18+
@MainActor
19+
internal protocol {{ plugin_list_name }}Listener: AnyObject {}
20+
21+
{% if is_periphery_comment_enabled %}
22+
// periphery:ignore
23+
{% endif %}
24+
/// @mockable
25+
@MainActor
26+
internal protocol {{ plugin_list_name }}Flow: {{ view_controllable_flow_type }} {}
27+
28+
{% if is_periphery_comment_enabled %}
29+
// periphery:ignore
30+
{% endif %}
31+
/// @mockable
32+
@MainActor
33+
internal protocol {{ plugin_list_name }}Builder: AnyObject {
34+
func build(
35+
withListener listener: {{ plugin_list_name }}Listener
36+
) -> {{ plugin_list_name }}Flow
37+
}
38+
1339
/// Declares the type of key used to identify plugins within the collection.
1440
/// - NOTE: May be any ``Hashable`` type such as ``String`` or an enumeration.
1541
internal typealias {{ plugin_list_name }}PluginListKeyType = String

Sources/NodesGenerator/StencilTemplate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
304304
.union(config.pluginListImports)
305305
case .pluginListInterface:
306306
config.baseImports
307+
.union(["Nodes"])
307308
case .pluginListTests:
308309
config.baseTestImports
309310
.union(["NodesTesting"])

Tests/NodesGeneratorTests/StencilTemplateTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ final class StencilTemplateTests: XCTestCase, TestFactories {
368368
]
369369
case .pluginListInterface:
370370
expect(imports) == [
371-
"<baseImport>"
371+
"<baseImport>",
372+
"Nodes"
372373
]
373374
case .pluginListTests:
374375
expect(imports) == [
@@ -494,7 +495,8 @@ final class StencilTemplateTests: XCTestCase, TestFactories {
494495
]
495496
case .pluginListInterface:
496497
expect(imports) == [
497-
"<baseImport>"
498+
"<baseImport>",
499+
"Nodes"
498500
]
499501
case .pluginListTests:
500502
expect(imports) == [

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginList-mockCount-0.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
//<fileHeader>
22

3-
/// @mockable
4-
@MainActor
5-
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
6-
7-
/// @mockable
8-
@MainActor
9-
internal protocol <pluginListName>Listener: AnyObject {}
10-
11-
/// @mockable
12-
@MainActor
13-
internal protocol <pluginListName>Builder: AnyObject {
14-
func build(
15-
withListener listener: <pluginListName>Listener
16-
) -> <pluginListName>Flow
17-
}
18-
193
// MARK: - Dependency
204

215
/// Declares the dependencies required by the component. A code-generated conforming object is made available to the

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginList-mockCount-1.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@
22

33
import <pluginListImport>
44

5-
// periphery:ignore
6-
/// @mockable
7-
@MainActor
8-
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
9-
10-
// periphery:ignore
11-
/// @mockable
12-
@MainActor
13-
internal protocol <pluginListName>Listener: AnyObject {}
14-
15-
// periphery:ignore
16-
/// @mockable
17-
@MainActor
18-
internal protocol <pluginListName>Builder: AnyObject {
19-
func build(
20-
withListener listener: <pluginListName>Listener
21-
) -> <pluginListName>Flow
22-
}
23-
245
// MARK: - Dependency
256

267
/// Declares the dependencies required by the component. A code-generated conforming object is made available to the

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginList-mockCount-2.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,6 @@
33
import <pluginListImport1>
44
import <pluginListImport2>
55

6-
// periphery:ignore
7-
/// @mockable
8-
@MainActor
9-
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
10-
11-
// periphery:ignore
12-
/// @mockable
13-
@MainActor
14-
internal protocol <pluginListName>Listener: AnyObject {}
15-
16-
// periphery:ignore
17-
/// @mockable
18-
@MainActor
19-
internal protocol <pluginListName>Builder: AnyObject {
20-
func build(
21-
withListener listener: <pluginListName>Listener
22-
) -> <pluginListName>Flow
23-
}
24-
256
// MARK: - Dependency
267

278
/// Declares the dependencies required by the component. A code-generated conforming object is made available to the

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginListInterface-mockCount-0.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
This file contains the protocols and types of the plugin list interface requiring public ACL for use in another module.
55
*/
66

7+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
8+
/// @mockable
9+
@MainActor
10+
internal protocol <pluginListName>Listener: AnyObject {}
11+
12+
/// @mockable
13+
@MainActor
14+
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
15+
16+
/// @mockable
17+
@MainActor
18+
internal protocol <pluginListName>Builder: AnyObject {
19+
func build(
20+
withListener listener: <pluginListName>Listener
21+
) -> <pluginListName>Flow
22+
}
23+
724
/// Declares the type of key used to identify plugins within the collection.
825
/// - NOTE: May be any ``Hashable`` type such as ``String`` or an enumeration.
926
internal typealias <pluginListName>PluginListKeyType = String

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginListInterface-mockCount-1.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ import <pluginListInterfaceImport>
66
This file contains the protocols and types of the plugin list interface requiring public ACL for use in another module.
77
*/
88

9+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
10+
// periphery:ignore
11+
/// @mockable
12+
@MainActor
13+
internal protocol <pluginListName>Listener: AnyObject {}
14+
15+
// periphery:ignore
16+
/// @mockable
17+
@MainActor
18+
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
19+
20+
// periphery:ignore
21+
/// @mockable
22+
@MainActor
23+
internal protocol <pluginListName>Builder: AnyObject {
24+
func build(
25+
withListener listener: <pluginListName>Listener
26+
) -> <pluginListName>Flow
27+
}
28+
929
/// Declares the type of key used to identify plugins within the collection.
1030
/// - NOTE: May be any ``Hashable`` type such as ``String`` or an enumeration.
1131
internal typealias <pluginListName>PluginListKeyType = String

Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderPluginList.PluginListInterface-mockCount-2.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ import <pluginListInterfaceImport2>
77
This file contains the protocols and types of the plugin list interface requiring public ACL for use in another module.
88
*/
99

10+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
11+
// periphery:ignore
12+
/// @mockable
13+
@MainActor
14+
internal protocol <pluginListName>Listener: AnyObject {}
15+
16+
// periphery:ignore
17+
/// @mockable
18+
@MainActor
19+
internal protocol <pluginListName>Flow: <viewControllableFlowType> {}
20+
21+
// periphery:ignore
22+
/// @mockable
23+
@MainActor
24+
internal protocol <pluginListName>Builder: AnyObject {
25+
func build(
26+
withListener listener: <pluginListName>Listener
27+
) -> <pluginListName>Flow
28+
}
29+
1030
/// Declares the type of key used to identify plugins within the collection.
1131
/// - NOTE: May be any ``Hashable`` type such as ``String`` or an enumeration.
1232
internal typealias <pluginListName>PluginListKeyType = String

0 commit comments

Comments
 (0)