From 0e7cf90d23ef9283c2014ed0eb36875fa7ceedc6 Mon Sep 17 00:00:00 2001 From: Seppe Snoeck <106682934+seppesnoeck@users.noreply.github.co> Date: Tue, 21 Feb 2023 13:55:53 +0100 Subject: [PATCH 1/5] Remove nodeName from Worker --- .../Resources/Templates/Worker.stencil | 3 --- .../Templates/Contexts/WorkerContext.swift | 4 ---- .../Templates/WorkerTemplate.swift | 4 ---- Tests/XcodeTemplateGeneratorLibraryTests/TestFactories.swift | 1 - 4 files changed, 12 deletions(-) diff --git a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil index e5db2a867..53cbfec87 100644 --- a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil +++ b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil @@ -17,9 +17,6 @@ internal final class {{ worker_name }}WorkerImp: AbstractWorker {{ cancellable_type }} > { - /// The Analytics instance. - private let analytics: {{ node_name }}Analytics - /// The initializer. /// - Parameter analytics: The Analytics instance internal init(analytics: {{ node_name }}Analytics) { diff --git a/Sources/XcodeTemplateGeneratorLibrary/Templates/Contexts/WorkerContext.swift b/Sources/XcodeTemplateGeneratorLibrary/Templates/Contexts/WorkerContext.swift index b6a4da010..7c2943d29 100644 --- a/Sources/XcodeTemplateGeneratorLibrary/Templates/Contexts/WorkerContext.swift +++ b/Sources/XcodeTemplateGeneratorLibrary/Templates/Contexts/WorkerContext.swift @@ -8,7 +8,6 @@ public struct WorkerContext: Context { private let fileHeader: String - private let nodeName: String private let workerName: String private let workerImports: [String] private let cancellableType: String @@ -16,7 +15,6 @@ public struct WorkerContext: Context { internal var dictionary: [String: Any] { [ "file_header": fileHeader, - "node_name": nodeName, "worker_name": workerName, "worker_imports": workerImports, "cancellable_type": cancellableType @@ -25,13 +23,11 @@ public struct WorkerContext: Context { public init( fileHeader: String, - nodeName: String, workerName: String, workerImports: Set, cancellableType: String ) { self.fileHeader = fileHeader - self.nodeName = nodeName self.workerName = workerName self.workerImports = workerImports.sortedImports() self.cancellableType = cancellableType diff --git a/Sources/XcodeTemplateGeneratorLibrary/Templates/WorkerTemplate.swift b/Sources/XcodeTemplateGeneratorLibrary/Templates/WorkerTemplate.swift index f944d1f8b..f4a5351ea 100644 --- a/Sources/XcodeTemplateGeneratorLibrary/Templates/WorkerTemplate.swift +++ b/Sources/XcodeTemplateGeneratorLibrary/Templates/WorkerTemplate.swift @@ -19,9 +19,6 @@ internal struct WorkerTemplate: XcodeTemplate { Option(identifier: "productName", name: "Worker name:", description: "The name of the Worker") - Option(identifier: "nodeName", - name: "Node name:", - description: "The name of the Node") } internal init(config: Config) { @@ -29,7 +26,6 @@ internal struct WorkerTemplate: XcodeTemplate { stencils = [worker] context = WorkerContext( fileHeader: config.fileHeader, - nodeName: config.variable("nodeName"), workerName: config.variable("productName"), workerImports: worker.imports(config: config), cancellableType: config.cancellableType diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/TestFactories.swift b/Tests/XcodeTemplateGeneratorLibraryTests/TestFactories.swift index ee818ef2e..5f27be096 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/TestFactories.swift +++ b/Tests/XcodeTemplateGeneratorLibraryTests/TestFactories.swift @@ -146,7 +146,6 @@ extension TestFactories { func givenWorkerContext() -> WorkerContext { WorkerContext( fileHeader: "", - nodeName: "", workerName: "", workerImports: [""], cancellableType: "" From 5316984b71433ce3eec8b218dd5949ced22326a8 Mon Sep 17 00:00:00 2001 From: Seppe Snoeck <106682934+seppesnoeck@users.noreply.github.co> Date: Tue, 21 Feb 2023 13:56:05 +0100 Subject: [PATCH 2/5] Regen snapshots --- .../ContextsTests/testWorkerContext.1.txt | 5 +---- .../StencilRendererTests/testRenderWorker.1.txt | 5 +---- .../TemplatesTests/testWorkerTemplate.1.txt | 11 +---------- ...tifier-Worker-xctemplate-TemplateInfo-plist.txt | 14 -------------- ...r-xctemplate-___FILEBASENAME___Worker-swift.txt | 5 +---- ...ntents-Worker-xctemplate-TemplateInfo-plist.txt | 14 -------------- ...r-xctemplate-___FILEBASENAME___Worker-swift.txt | 5 +---- 7 files changed, 5 insertions(+), 54 deletions(-) diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/ContextsTests/testWorkerContext.1.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/ContextsTests/testWorkerContext.1.txt index a998a2ee2..7582bc74c 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/ContextsTests/testWorkerContext.1.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/ContextsTests/testWorkerContext.1.txt @@ -1,13 +1,10 @@ -▿ 5 key/value pairs +▿ 4 key/value pairs ▿ (2 elements) - key: "cancellable_type" - value: "" ▿ (2 elements) - key: "file_header" - value: "" - ▿ (2 elements) - - key: "node_name" - - value: "" ▿ (2 elements) - key: "worker_imports" ▿ value: 1 element diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt index 5b0b088e2..091db3b42 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt @@ -17,12 +17,9 @@ internal final class WorkerImp: AbstractWorker > { - /// The Analytics instance. - private let analytics: Analytics - /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: Analytics) { + internal init(analytics: Analytics) { self.analytics = analytics } diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/TemplatesTests/testWorkerTemplate.1.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/TemplatesTests/testWorkerTemplate.1.txt index d555af635..71bd53db7 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/TemplatesTests/testWorkerTemplate.1.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/TemplatesTests/testWorkerTemplate.1.txt @@ -2,7 +2,6 @@ ▿ context: WorkerContext - cancellableType: "" - fileHeader: "" - - nodeName: "___VARIABLE_nodeName___" ▿ workerImports: 3 elements - "" - "" @@ -15,7 +14,7 @@ - description: "The source file implementing a Worker." - kind: "Xcode.IDEFoundation.TextSubstitutionFileTemplateKind" - mainTemplateFile: "___FILEBASENAME___.swift" - ▿ options: 2 elements + ▿ options: 1 element ▿ Option - default: Optional.none - description: "The name of the Worker" @@ -24,14 +23,6 @@ - notPersisted: true - required: true - type: "text" - ▿ Option - - default: Optional.none - - description: "The name of the Node" - - identifier: "nodeName" - - name: "Node name:" - - notPersisted: true - - required: true - - type: "text" - platforms: 0 elements - sortOrder: 9 - summary: "The source file implementing a Worker" diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-TemplateInfo-plist.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-TemplateInfo-plist.txt index 8c19c87be..e0303d6af 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-TemplateInfo-plist.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-TemplateInfo-plist.txt @@ -28,20 +28,6 @@ Type text - - Description - The name of the Node - Identifier - nodeName - Name - Node name: - NotPersisted - - Required - - Type - text - Platforms diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index dd9a2bd4d..eb2784c89 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -18,12 +18,9 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker AnyCancellable > { - /// The Analytics instance. - private let analytics: ___VARIABLE_nodeName___Analytics - /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: ___VARIABLE_nodeName___Analytics) { + internal init(analytics: Analytics) { self.analytics = analytics } diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-TemplateInfo-plist.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-TemplateInfo-plist.txt index 8c19c87be..e0303d6af 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-TemplateInfo-plist.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-TemplateInfo-plist.txt @@ -28,20 +28,6 @@ Type text - - Description - The name of the Node - Identifier - nodeName - Name - Node name: - NotPersisted - - Required - - Type - text - Platforms diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index dd9a2bd4d..eb2784c89 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -18,12 +18,9 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker AnyCancellable > { - /// The Analytics instance. - private let analytics: ___VARIABLE_nodeName___Analytics - /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: ___VARIABLE_nodeName___Analytics) { + internal init(analytics: Analytics) { self.analytics = analytics } From 500366b6290e888ce39b4fa961ce83f0d5a0e3c2 Mon Sep 17 00:00:00 2001 From: Seppe Snoeck <106682934+seppesnoeck@users.noreply.github.com> Date: Tue, 21 Feb 2023 19:56:35 +0100 Subject: [PATCH 3/5] Remove node_name from Worker.stencil init Co-authored-by: Christopher Fuller --- .../Resources/Templates/Worker.stencil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil index 53cbfec87..916a0ae83 100644 --- a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil +++ b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil @@ -19,7 +19,7 @@ internal final class {{ worker_name }}WorkerImp: AbstractWorker /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: {{ node_name }}Analytics) { + internal init() { self.analytics = analytics } From 3178d829bc74e36d8db38cc5b8bcc9d053b7356a Mon Sep 17 00:00:00 2001 From: Seppe Snoeck <106682934+seppesnoeck@users.noreply.github.co> Date: Tue, 21 Feb 2023 20:00:48 +0100 Subject: [PATCH 4/5] Regen tests --- .../__Snapshots__/StencilRendererTests/testRenderWorker.1.txt | 2 +- ...ntifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt | 2 +- ...ontents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt index 091db3b42..fc92b928d 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt @@ -19,7 +19,7 @@ internal final class WorkerImp: AbstractWorker /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: Analytics) { + internal init() { self.analytics = analytics } diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index eb2784c89..0da4b5769 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -20,7 +20,7 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: Analytics) { + internal init() { self.analytics = analytics } diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index eb2784c89..0da4b5769 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -20,7 +20,7 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker /// The initializer. /// - Parameter analytics: The Analytics instance - internal init(analytics: Analytics) { + internal init() { self.analytics = analytics } From d7cce134c6368d9986d8bf4362fc26b453decdfa Mon Sep 17 00:00:00 2001 From: Seppe Snoeck <106682934+seppesnoeck@users.noreply.github.co> Date: Wed, 22 Feb 2023 14:14:31 +0100 Subject: [PATCH 5/5] Remove param comment and var initialization --- .../Resources/Templates/Worker.stencil | 5 +---- .../StencilRendererTests/testRenderWorker.1.txt | 5 +---- ...fier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt | 5 +---- ...ents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil index 916a0ae83..8528ec099 100644 --- a/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil +++ b/Sources/XcodeTemplateGeneratorLibrary/Resources/Templates/Worker.stencil @@ -18,10 +18,7 @@ internal final class {{ worker_name }}WorkerImp: AbstractWorker > { /// The initializer. - /// - Parameter analytics: The Analytics instance - internal init() { - self.analytics = analytics - } + internal init() {} /// Implement logic to execute when the Worker is started. override internal func didStart() {} diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt index fc92b928d..c1ce1ce6a 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/StencilRendererTests/testRenderWorker.1.txt @@ -18,10 +18,7 @@ internal final class WorkerImp: AbstractWorker > { /// The initializer. - /// - Parameter analytics: The Analytics instance - internal init() { - self.analytics = analytics - } + internal init() {} /// Implement logic to execute when the Worker is started. override internal func didStart() {} diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index 0da4b5769..0df3d812f 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithIdentifier.Contents-Developer-Xcode-Templates-File-Templates-Nodes-Architecture-Framework-identifier-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -19,10 +19,7 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker > { /// The initializer. - /// - Parameter analytics: The Analytics instance - internal init() { - self.analytics = analytics - } + internal init() {} /// Implement logic to execute when the Worker is started. override internal func didStart() {} diff --git a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt index 0da4b5769..0df3d812f 100644 --- a/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt +++ b/Tests/XcodeTemplateGeneratorLibraryTests/__Snapshots__/XcodeTemplatesTests/testGenerateWithURL.Contents-Worker-xctemplate-___FILEBASENAME___Worker-swift.txt @@ -19,10 +19,7 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker > { /// The initializer. - /// - Parameter analytics: The Analytics instance - internal init() { - self.analytics = analytics - } + internal init() {} /// Implement logic to execute when the Worker is started. override internal func didStart() {}