From fcec223a3e6a49a896faa2d4c452fec292427820 Mon Sep 17 00:00:00 2001 From: phongvhd93 Date: Mon, 4 Dec 2023 22:44:09 +0700 Subject: [PATCH] [#349] Improve the duplicated codes --- Tuist/Interfaces/SwiftUI/Project/Podfile | 1 - Tuist/Interfaces/UIKit/Project/Podfile | 2 -- Tuist/ProjectDescriptionHelpers/Module.swift | 2 +- .../Scheme+Initializing.swift | 14 ++++++++------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Tuist/Interfaces/SwiftUI/Project/Podfile b/Tuist/Interfaces/SwiftUI/Project/Podfile index a2fc0e78..e39e56c6 100644 --- a/Tuist/Interfaces/SwiftUI/Project/Podfile +++ b/Tuist/Interfaces/SwiftUI/Project/Podfile @@ -61,7 +61,6 @@ target 'Data' do end target 'Domain' do - # Pods for Domain target 'DomainTests' do testing_pods end diff --git a/Tuist/Interfaces/UIKit/Project/Podfile b/Tuist/Interfaces/UIKit/Project/Podfile index d81009c3..bb31ac75 100644 --- a/Tuist/Interfaces/UIKit/Project/Podfile +++ b/Tuist/Interfaces/UIKit/Project/Podfile @@ -51,7 +51,6 @@ end target 'Data' do data_dependencies - target 'DataTests' do data_dependencies testing_pods @@ -59,7 +58,6 @@ target 'Data' do end target 'Domain' do - # Pods for Domain target 'DomainTests' do testing_pods end diff --git a/Tuist/ProjectDescriptionHelpers/Module.swift b/Tuist/ProjectDescriptionHelpers/Module.swift index 1d9d6e71..28a6a00d 100644 --- a/Tuist/ProjectDescriptionHelpers/Module.swift +++ b/Tuist/ProjectDescriptionHelpers/Module.swift @@ -35,7 +35,7 @@ public enum Module: CaseIterable { } public var sources: ProjectDescription.SourceFilesList { - return ["\(frameworkPath)/\(Constant.sourcesPath)/**"] + ["\(frameworkPath)/\(Constant.sourcesPath)/**"] } public var resources: ProjectDescription.ResourceFileElements { diff --git a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift index 33440e42..cda644fd 100644 --- a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift @@ -5,9 +5,7 @@ extension Scheme { public static func productionScheme(name: String) -> Scheme { let debugConfigName = BuildConfiguration.debugProduction.name let releaseConfigName = BuildConfiguration.releaseProduction.name - - var testModules = Module.allCases.map { TestableTarget("\($0.name)\(Constant.testsPath)") } - testModules.append(contentsOf: ["\(name)Tests", "\(name)KIFUITests"]) + let testModules = testSchemes(name) return Scheme( name: name, @@ -24,9 +22,7 @@ extension Scheme { public static func stagingScheme(name: String) -> Scheme { let debugConfigName = BuildConfiguration.debugStaging.name let releaseConfigName = BuildConfiguration.releaseStaging.name - - var testModules = Module.allCases.map { TestableTarget("\($0.name)\(Constant.testsPath)") } - testModules.append(contentsOf: ["\(name)Tests", "\(name)KIFUITests"]) + let testModules = testSchemes(name) return Scheme( name: "\(name) Staging", @@ -47,4 +43,10 @@ extension Scheme { hidden: true ) } + + private static func testSchemes(_ name: String) -> [TestableTarget] { + var modules = Module.allCases.map { TestableTarget("\($0.name)\(Constant.testsPath)") } + modules.append(contentsOf: ["\(name)Tests", "\(name)KIFUITests"]) + return modules + } }