From abd0b47e4f8dd33861f76dad16f0c9fb4da82c04 Mon Sep 17 00:00:00 2001 From: uuuunseo Date: Tue, 20 Aug 2024 15:23:42 +0900 Subject: [PATCH 1/2] :tada: :: Project setting --- .gitignore | 70 ++++ .mise.toml | 2 + Makefile | 32 ++ Plugin/ConfigurationPlugin/Plugin.swift | 3 + .../Configuration+Ext.swift | 15 + .../Path+XCConfig.swift | 10 + .../ProjectDeployTarget.swift | 12 + Plugin/DependencyPlugin/Plugin.swift | 3 + .../Dependency+SPM.swift | 11 + .../ModulePaths.swift | 74 +++++ .../PathExtension.swift | 43 +++ .../TargetDependency+ModularTarget.swift | 54 +++ Plugin/EnvironmentPlugin/Plugin.swift | 3 + .../ProjectEnvironment.swift | 18 + Plugin/TemplatePlugin/Plugin.swift | 3 + .../Templates/Example/Example.swift | 22 ++ .../Example/ExampleResources.stencil | 25 ++ .../Templates/Example/ExampleSources.stencil | 19 ++ .../Templates/Interface/Interface.stencil | 1 + .../Templates/Interface/Interface.swift | 18 + .../Templates/Module/Module.swift | 24 ++ .../Templates/Module/Project.stencil | 8 + .../Templates/Module/Sources.stencil | 1 + .../Templates/Sources/Sources.stencil | 1 + .../Templates/Sources/Sources.swift | 18 + .../Templates/Testing/Testing.stencil | 1 + .../Templates/Testing/Testing.swift | 18 + .../Templates/Tests/Tests.stencil | 11 + .../Templates/Tests/Tests.swift | 18 + .../Templates/UITests/UITests.stencil | 11 + .../Templates/UITests/UITests.swift | 18 + Projects/App/Project.swift | 114 +++++++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 98 ++++++ .../Resources/Assets.xcassets/Contents.json | 6 + Projects/App/iOS-Widget/Sources/Sources.swift | 1 + Projects/App/iOS-Widget/Support/Info.plist | 62 ++++ .../Support/ondoseeWidget.entitlements | 12 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 98 ++++++ .../Resources/Assets.xcassets/Contents.json | 6 + .../App/iOS/Resources/LaunchScreen.storyboard | 25 ++ .../Sources/Application/OndoseeIOSApp.swift | 10 + Projects/App/iOS/Support/Info.plist | 62 ++++ Projects/App/iOS/Support/ondosee.entitlements | 0 .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 98 ++++++ .../Resources/Assets.xcassets/Contents.json | 6 + Projects/App/watchOS/Sources/Sources.swift | 1 + Projects/App/watchOS/Support/Info.plist | 62 ++++ .../Core/Networking/Interface/Interface.swift | 1 + Projects/Core/Networking/Project.swift | 49 +++ .../Core/Networking/Sources/Sources.swift | 1 + .../Core/Networking/Testing/Testing.swift | 1 + .../Networking/Tests/NetworkingTest.swift | 11 + .../BaseDomain/Interface/Interface.swift | 1 + Projects/Domain/BaseDomain/Project.swift | 25 ++ .../Domain/BaseDomain/Sources/Sources.swift | 1 + Projects/Domain/BaseDomain/Tests/.gitkeep | 0 .../Domain/BaseDomain/Tests/TargetTest.swift | 15 + .../BaseFeature/Interface/Interface.swift | 1 + Projects/Feature/BaseFeature/Project.swift | 18 + .../Feature/BaseFeature/Sources/Sources.swift | 1 + Projects/Feature/BaseFeature/Tests/.gitkeep | 0 .../BaseFeature/Tests/TargetTest.swift | 15 + .../GlobalThirdPartyLibrary/Project.swift | 10 + .../Sources/ThirdPartyLibrary.swift | 1 + .../Example/Resources/LaunchScreen.storyboard | 25 ++ .../Example/Sources/AppDelegate.swift | 18 + .../UserInterface/DesignSystem/Project.swift | 21 ++ .../DesignSystem/Resources/Resources.swift | 1 + .../DesignSystem/Sources/Sources.swift | 1 + README.md | 2 - Scripts/.swiftlint.yml | 27 ++ .../GenerateFeature/Interface/Interface.swift | 1 + Scripts/GenerateFeature/Project.swift | 10 + Scripts/GenerateFeature/Sources/Feature.swift | 1 + Scripts/GenerateFeature/Testing/Testing.swift | 1 + Scripts/GenerateFeature/Tests/.gitkeep | 0 .../GenerateFeature/Tests/TargetTest.swift | 17 + Scripts/GenerateFeature/UITests/.gitkeep | 0 .../GenerateFeature/UITests/TargetTest.swift | 17 + Scripts/GenerateModule.swift | 313 ++++++++++++++++++ .../Example/Resources/LaunchScreen.storyboard | 25 ++ .../Example/Sources/AppDelegate.swift | 20 ++ Scripts/NewDependency.swift | 79 +++++ Scripts/SwiftLintRunScript.sh | 12 + Tuist/Config.swift | 11 + Tuist/Package.swift | 22 ++ .../Action/Action+Templete.swift | 8 + .../GenerateEnvironment.swift | 24 ++ .../Internal/Configurable.swift | 14 + .../Project/Project+Module.swift | 32 ++ .../Project/Project+makeModule.swift | 178 ++++++++++ .../Scheme/Scheme+Template.swift | 37 +++ .../SettingsDictionary/LDFlagsSettings.swift | 11 + .../SourceFiles/SourceFiles+Template.swift | 10 + .../Target/Target+Modular.swift | 193 +++++++++++ .../Target/TargetSpec.swift | 112 +++++++ Tuist/Template/Example/Example.swift | 23 ++ .../Template/Example/ExampleResources.stencil | 26 ++ Tuist/Template/Example/ExampleSources.stencil | 19 ++ Tuist/Template/Interface/Interface.stencil | 1 + Tuist/Template/Interface/Interface.swift | 18 + Tuist/Template/Module/Module.swift | 24 ++ Tuist/Template/Module/Project.stencil | 8 + Tuist/Template/Module/Sources.stencil | 1 + Tuist/Template/Sources/Sources.stencil | 1 + Tuist/Template/Sources/Sources.swift | 19 ++ Tuist/Template/Testing/Testing.stencil | 1 + Tuist/Template/Testing/Testing.swift | 18 + Tuist/Template/Tests/Tests.stencil | 11 + Tuist/Template/Tests/Tests.swift | 18 + Tuist/Template/UITests/UITests.stencil | 11 + Tuist/Template/UITests/UITests.swift | 18 + Workspace.swift | 9 + XCConfig/App/DEV.xcconfig | 1 + XCConfig/App/PROD.xcconfig | 1 + XCConfig/App/STAGE.xcconfig | 1 + XCConfig/Networking/DEV.xcconfig | 1 + XCConfig/Networking/PROD.xcconfig | 1 + XCConfig/Networking/STAGE.xcconfig | 1 + XCConfig/Shared.xcconfig | 5 + 123 files changed, 2890 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 .mise.toml create mode 100644 Makefile create mode 100644 Plugin/ConfigurationPlugin/Plugin.swift create mode 100644 Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Configuration+Ext.swift create mode 100644 Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Path+XCConfig.swift create mode 100644 Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/ProjectDeployTarget.swift create mode 100644 Plugin/DependencyPlugin/Plugin.swift create mode 100644 Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift create mode 100644 Plugin/DependencyPlugin/ProjectDescriptionHelpers/ModulePaths.swift create mode 100644 Plugin/DependencyPlugin/ProjectDescriptionHelpers/PathExtension.swift create mode 100644 Plugin/DependencyPlugin/ProjectDescriptionHelpers/TargetDependency+ModularTarget.swift create mode 100644 Plugin/EnvironmentPlugin/Plugin.swift create mode 100644 Plugin/EnvironmentPlugin/ProjectDescriptionHelpers/ProjectEnvironment.swift create mode 100644 Plugin/TemplatePlugin/Plugin.swift create mode 100644 Plugin/TemplatePlugin/Templates/Example/Example.swift create mode 100644 Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Interface/Interface.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Interface/Interface.swift create mode 100644 Plugin/TemplatePlugin/Templates/Module/Module.swift create mode 100644 Plugin/TemplatePlugin/Templates/Module/Project.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Module/Sources.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Sources/Sources.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Sources/Sources.swift create mode 100644 Plugin/TemplatePlugin/Templates/Testing/Testing.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Testing/Testing.swift create mode 100644 Plugin/TemplatePlugin/Templates/Tests/Tests.stencil create mode 100644 Plugin/TemplatePlugin/Templates/Tests/Tests.swift create mode 100644 Plugin/TemplatePlugin/Templates/UITests/UITests.stencil create mode 100644 Plugin/TemplatePlugin/Templates/UITests/UITests.swift create mode 100644 Projects/App/Project.swift create mode 100644 Projects/App/iOS-Widget/Resources/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Projects/App/iOS-Widget/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Projects/App/iOS-Widget/Resources/Assets.xcassets/Contents.json create mode 100644 Projects/App/iOS-Widget/Sources/Sources.swift create mode 100644 Projects/App/iOS-Widget/Support/Info.plist create mode 100644 Projects/App/iOS-Widget/Support/ondoseeWidget.entitlements create mode 100644 Projects/App/iOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Projects/App/iOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Projects/App/iOS/Resources/Assets.xcassets/Contents.json create mode 100644 Projects/App/iOS/Resources/LaunchScreen.storyboard create mode 100644 Projects/App/iOS/Sources/Application/OndoseeIOSApp.swift create mode 100644 Projects/App/iOS/Support/Info.plist create mode 100644 Projects/App/iOS/Support/ondosee.entitlements create mode 100644 Projects/App/watchOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Projects/App/watchOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Projects/App/watchOS/Resources/Assets.xcassets/Contents.json create mode 100644 Projects/App/watchOS/Sources/Sources.swift create mode 100644 Projects/App/watchOS/Support/Info.plist create mode 100644 Projects/Core/Networking/Interface/Interface.swift create mode 100644 Projects/Core/Networking/Project.swift create mode 100644 Projects/Core/Networking/Sources/Sources.swift create mode 100644 Projects/Core/Networking/Testing/Testing.swift create mode 100644 Projects/Core/Networking/Tests/NetworkingTest.swift create mode 100644 Projects/Domain/BaseDomain/Interface/Interface.swift create mode 100644 Projects/Domain/BaseDomain/Project.swift create mode 100644 Projects/Domain/BaseDomain/Sources/Sources.swift create mode 100644 Projects/Domain/BaseDomain/Tests/.gitkeep create mode 100644 Projects/Domain/BaseDomain/Tests/TargetTest.swift create mode 100644 Projects/Feature/BaseFeature/Interface/Interface.swift create mode 100644 Projects/Feature/BaseFeature/Project.swift create mode 100644 Projects/Feature/BaseFeature/Sources/Sources.swift create mode 100644 Projects/Feature/BaseFeature/Tests/.gitkeep create mode 100644 Projects/Feature/BaseFeature/Tests/TargetTest.swift create mode 100644 Projects/Shared/GlobalThirdPartyLibrary/Project.swift create mode 100644 Projects/Shared/GlobalThirdPartyLibrary/Sources/ThirdPartyLibrary.swift create mode 100644 Projects/UserInterface/DesignSystem/Example/Resources/LaunchScreen.storyboard create mode 100644 Projects/UserInterface/DesignSystem/Example/Sources/AppDelegate.swift create mode 100644 Projects/UserInterface/DesignSystem/Project.swift create mode 100644 Projects/UserInterface/DesignSystem/Resources/Resources.swift create mode 100644 Projects/UserInterface/DesignSystem/Sources/Sources.swift delete mode 100644 README.md create mode 100644 Scripts/.swiftlint.yml create mode 100644 Scripts/GenerateFeature/Interface/Interface.swift create mode 100644 Scripts/GenerateFeature/Project.swift create mode 100644 Scripts/GenerateFeature/Sources/Feature.swift create mode 100644 Scripts/GenerateFeature/Testing/Testing.swift create mode 100644 Scripts/GenerateFeature/Tests/.gitkeep create mode 100644 Scripts/GenerateFeature/Tests/TargetTest.swift create mode 100644 Scripts/GenerateFeature/UITests/.gitkeep create mode 100644 Scripts/GenerateFeature/UITests/TargetTest.swift create mode 100644 Scripts/GenerateModule.swift create mode 100644 Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard create mode 100644 Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift create mode 100644 Scripts/NewDependency.swift create mode 100644 Scripts/SwiftLintRunScript.sh create mode 100644 Tuist/Config.swift create mode 100644 Tuist/Package.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Action/Action+Templete.swift create mode 100644 Tuist/ProjectDescriptionHelpers/GenerateEnvironment.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Internal/Configurable.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Project/Project+Module.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Project/Project+makeModule.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Scheme/Scheme+Template.swift create mode 100644 Tuist/ProjectDescriptionHelpers/SettingsDictionary/LDFlagsSettings.swift create mode 100644 Tuist/ProjectDescriptionHelpers/SourceFiles/SourceFiles+Template.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Target/Target+Modular.swift create mode 100644 Tuist/ProjectDescriptionHelpers/Target/TargetSpec.swift create mode 100644 Tuist/Template/Example/Example.swift create mode 100644 Tuist/Template/Example/ExampleResources.stencil create mode 100644 Tuist/Template/Example/ExampleSources.stencil create mode 100644 Tuist/Template/Interface/Interface.stencil create mode 100644 Tuist/Template/Interface/Interface.swift create mode 100644 Tuist/Template/Module/Module.swift create mode 100644 Tuist/Template/Module/Project.stencil create mode 100644 Tuist/Template/Module/Sources.stencil create mode 100644 Tuist/Template/Sources/Sources.stencil create mode 100644 Tuist/Template/Sources/Sources.swift create mode 100644 Tuist/Template/Testing/Testing.stencil create mode 100644 Tuist/Template/Testing/Testing.swift create mode 100644 Tuist/Template/Tests/Tests.stencil create mode 100644 Tuist/Template/Tests/Tests.swift create mode 100644 Tuist/Template/UITests/UITests.stencil create mode 100644 Tuist/Template/UITests/UITests.swift create mode 100644 Workspace.swift create mode 100644 XCConfig/App/DEV.xcconfig create mode 100644 XCConfig/App/PROD.xcconfig create mode 100644 XCConfig/App/STAGE.xcconfig create mode 100644 XCConfig/Networking/DEV.xcconfig create mode 100644 XCConfig/Networking/PROD.xcconfig create mode 100644 XCConfig/Networking/STAGE.xcconfig create mode 100644 XCConfig/Shared.xcconfig diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24b244f --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Projects ### +*.xcodeproj +*.xcworkspace + +### Tuist derived files ### +graph.dot +Derived/ + +### Tuist managed dependencies ### +Tuist/.build \ No newline at end of file diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..52824af --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +tuist = "4.23.0" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c050c3f --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +generate: + tuist install + tuist generate + +ci_generate: + tuist install + TUIST_ENV=CI tuist generate + +cd_generate: + tuist install + TUIST_ENV=CD tuist generate + +clean: + rm -rf **/*.xcodeproj + rm -rf *.xcworkspace + +reset: + tuist clean + rm -rf **/*.xcodeproj + rm -rf *.xcworkspace + +module: + swift Scripts/GenerateModule.swift + +dependency: + swift Scripts/NewDependency.swift + +init: + swift Scripts/InitEnvironment.swift + +signing: + swift Scripts/CodeSigning.swift diff --git a/Plugin/ConfigurationPlugin/Plugin.swift b/Plugin/ConfigurationPlugin/Plugin.swift new file mode 100644 index 0000000..e42bddc --- /dev/null +++ b/Plugin/ConfigurationPlugin/Plugin.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let configurationPlugin = Plugin(name: "ConfigurationPlugin") diff --git a/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Configuration+Ext.swift b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Configuration+Ext.swift new file mode 100644 index 0000000..c3586c4 --- /dev/null +++ b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Configuration+Ext.swift @@ -0,0 +1,15 @@ +import ProjectDescription + +public extension ConfigurationName { + static var dev: ConfigurationName { configuration(ProjectDeployTarget.dev.rawValue) } + static var stage: ConfigurationName { configuration(ProjectDeployTarget.stage.rawValue) } + static var prod: ConfigurationName { configuration(ProjectDeployTarget.prod.rawValue) } +} + +public extension Array where Element == Configuration { + static let `default`: [Configuration] = [ + .debug(name: .dev, xcconfig: .shared), + .debug(name: .stage, xcconfig: .shared), + .release(name: .prod, xcconfig: .shared) + ] +} diff --git a/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Path+XCConfig.swift b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Path+XCConfig.swift new file mode 100644 index 0000000..3b16088 --- /dev/null +++ b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/Path+XCConfig.swift @@ -0,0 +1,10 @@ +import ProjectDescription + +public extension ProjectDescription.Path { + static func relativeToXCConfig(type: ProjectDeployTarget, name: String) -> Self { + return .relativeToRoot("XCConfig/\(name)/\(type.rawValue).xcconfig") + } + static var shared: Self { + return .relativeToRoot("XCConfig/Shared.xcconfig") + } +} diff --git a/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/ProjectDeployTarget.swift b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/ProjectDeployTarget.swift new file mode 100644 index 0000000..4aae8a5 --- /dev/null +++ b/Plugin/ConfigurationPlugin/ProjectDescriptionHelpers/ProjectDeployTarget.swift @@ -0,0 +1,12 @@ +import Foundation +import ProjectDescription + +public enum ProjectDeployTarget: String { + case dev = "DEV" + case stage = "STAGE" + case prod = "PROD" + + public var configurationName: ConfigurationName { + ConfigurationName.configuration(self.rawValue) + } +} diff --git a/Plugin/DependencyPlugin/Plugin.swift b/Plugin/DependencyPlugin/Plugin.swift new file mode 100644 index 0000000..16e44d2 --- /dev/null +++ b/Plugin/DependencyPlugin/Plugin.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let dependencyPlugin = Plugin(name: "DependencyPlugin") diff --git a/Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift new file mode 100644 index 0000000..50c39b2 --- /dev/null +++ b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift @@ -0,0 +1,11 @@ +import ProjectDescription + +public extension TargetDependency { + struct SPM {} +} + +public extension TargetDependency.SPM { +} + +public extension Package { +} diff --git a/Plugin/DependencyPlugin/ProjectDescriptionHelpers/ModulePaths.swift b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/ModulePaths.swift new file mode 100644 index 0000000..de41181 --- /dev/null +++ b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/ModulePaths.swift @@ -0,0 +1,74 @@ +import Foundation + +public enum ModulePaths { + case feature(Feature) + case domain(Domain) + case core(Core) + case shared(Shared) + case userInterface(UserInterface) +} + +extension ModulePaths: ModularTargetPathConvertable { + public func targetName(type: ModularTargetType) -> String { + switch self { + case let .feature(module as any ModularTargetPathConvertable), + let .domain(module as any ModularTargetPathConvertable), + let .core(module as any ModularTargetPathConvertable), + let .shared(module as any ModularTargetPathConvertable), + let .userInterface(module as any ModularTargetPathConvertable): + return module.targetName(type: type) + } + } +} + +public extension ModulePaths { + enum Feature: String, ModularTargetPathConvertable { + case BaseFeature + } +} + +public extension ModulePaths { + enum Domain: String, ModularTargetPathConvertable { + case BaseDomain + } +} + +public extension ModulePaths { + enum Core: String, ModularTargetPathConvertable { + case Networking + } +} + +public extension ModulePaths { + enum Shared: String, ModularTargetPathConvertable { + case GlobalThirdPartyLibrary + } +} + +public extension ModulePaths { + enum UserInterface: String, ModularTargetPathConvertable { + case DesignSystem + } +} + +public enum ModularTargetType: String { + case interface = "Interface" + case sources = "" + case testing = "Testing" + case unitTest = "Tests" + case example = "Example" +} + +public protocol ModularTargetPathConvertable { + func targetName(type: ModularTargetType) -> String +} + +public extension ModularTargetPathConvertable where Self: RawRepresentable { + func targetName(type: ModularTargetType) -> String { + "\(self.rawValue)\(type.rawValue)" + } +} + +// MARK: - For DI +extension ModulePaths.Feature: CaseIterable {} +extension ModulePaths.Domain: CaseIterable {} diff --git a/Plugin/DependencyPlugin/ProjectDescriptionHelpers/PathExtension.swift b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/PathExtension.swift new file mode 100644 index 0000000..57c114a --- /dev/null +++ b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/PathExtension.swift @@ -0,0 +1,43 @@ +import ProjectDescription + +public extension ProjectDescription.Path { + static func relativeToSections(_ path: String) -> Self { + return .relativeToRoot("Projects/\(path)") + } + static func relativeToFeature(_ path: String) -> Self { + return .relativeToRoot("Projects/Feature/\(path)") + } + static func relativeToDomain(_ path: String) -> Self { + return .relativeToRoot("Projects/Domain/\(path)") + } + static func relativeToCore(_ path: String) -> Self { + return .relativeToRoot("Projects/Core/\(path)") + } + static func relativeToShared(_ path: String) -> Self { + return .relativeToRoot("Projects/Shared/\(path)") + } + static func relativeToUserInterface(_ path: String) -> Self { + return .relativeToRoot("Projects/UserInterface/\(path)") + } + static var app: Self { + return .relativeToRoot("Projects/App") + } +} + +public extension TargetDependency { + static func feature(name: String) -> Self { + return .project(target: name, path: .relativeToFeature(name)) + } + static func domain(name: String) -> Self { + return .project(target: name, path: .relativeToDomain(name)) + } + static func core(name: String) -> Self { + return .project(target: name, path: .relativeToCore(name)) + } + static func shated(name: String) -> Self { + return .project(target: name, path: .relativeToShared(name)) + } + static func userInterface(name: String) -> Self { + return .project(target: name, path: .relativeToUserInterface(name)) + } +} diff --git a/Plugin/DependencyPlugin/ProjectDescriptionHelpers/TargetDependency+ModularTarget.swift b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/TargetDependency+ModularTarget.swift new file mode 100644 index 0000000..065f447 --- /dev/null +++ b/Plugin/DependencyPlugin/ProjectDescriptionHelpers/TargetDependency+ModularTarget.swift @@ -0,0 +1,54 @@ +import Foundation +import ProjectDescription + +public extension TargetDependency { + static func feature( + target: ModulePaths.Feature, + type: ModularTargetType = .sources + ) -> TargetDependency { + .project( + target: target.targetName(type: type), + path: .relativeToFeature(target.rawValue) + ) + } + + static func domain( + target: ModulePaths.Domain, + type: ModularTargetType = .sources + ) -> TargetDependency { + .project( + target: target.targetName(type: type), + path: .relativeToDomain(target.rawValue) + ) + } + + static func core( + target: ModulePaths.Core, + type: ModularTargetType = .sources + ) -> TargetDependency { + .project( + target: target.targetName(type: type), + path: .relativeToCore(target.rawValue) + ) + } + + static func shared( + target: ModulePaths.Shared, + type: ModularTargetType = .sources + ) -> TargetDependency { + .project( + target: target.targetName(type: type), + path: .relativeToShared(target.rawValue) + ) + } + + static func userInterface( + target: ModulePaths.UserInterface, + type: ModularTargetType = .sources + ) -> TargetDependency { + .project( + target: target.targetName(type: type), + path: .relativeToUserInterface(target.rawValue) + ) + } +} diff --git a/Plugin/EnvironmentPlugin/Plugin.swift b/Plugin/EnvironmentPlugin/Plugin.swift new file mode 100644 index 0000000..cbbdd33 --- /dev/null +++ b/Plugin/EnvironmentPlugin/Plugin.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let environmentPlugin = Plugin(name: "EnvironmentPlugin") diff --git a/Plugin/EnvironmentPlugin/ProjectDescriptionHelpers/ProjectEnvironment.swift b/Plugin/EnvironmentPlugin/ProjectDescriptionHelpers/ProjectEnvironment.swift new file mode 100644 index 0000000..6252b1f --- /dev/null +++ b/Plugin/EnvironmentPlugin/ProjectDescriptionHelpers/ProjectEnvironment.swift @@ -0,0 +1,18 @@ +import Foundation +import ProjectDescription + +public struct ProjectEnvironment { + public let name: String + public let organizationName: String + public let destinations: Destinations + public let deploymentTargets: DeploymentTargets + public let baseSetting: SettingsDictionary +} + +public let env = ProjectEnvironment( + name: "ondosee", + organizationName: "com", + destinations: [.iPhone, .appleWatch], + deploymentTargets: .multiplatform(iOS: "16.0", watchOS: "9.0"), + baseSetting: [:] +) diff --git a/Plugin/TemplatePlugin/Plugin.swift b/Plugin/TemplatePlugin/Plugin.swift new file mode 100644 index 0000000..61a20da --- /dev/null +++ b/Plugin/TemplatePlugin/Plugin.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let templatePlugin = Plugin(name: "TemplatePlugin") diff --git a/Plugin/TemplatePlugin/Templates/Example/Example.swift b/Plugin/TemplatePlugin/Templates/Example/Example.swift new file mode 100644 index 0000000..7126a2f --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Example/Example.swift @@ -0,0 +1,22 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's example target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Sources/AppDelegate.swift", + templatePath: "ExampleSources.stencil" + ), + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Resources/LaunchScreen.storyboard", + templatePath: "ExampleResources.stencil" + ) + ] +) diff --git a/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil b/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil b/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil new file mode 100644 index 0000000..ef2bae0 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil @@ -0,0 +1,19 @@ +import UIKit + +@main +final class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let viewController = UIViewController() + viewController.view.backgroundColor = .yellow + window?.rootViewController = viewController + window?.makeKeyAndVisible() + + return true + } +} diff --git a/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil b/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Interface/Interface.swift b/Plugin/TemplatePlugin/Templates/Interface/Interface.swift new file mode 100644 index 0000000..3e518fa --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Interface/Interface.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's interface target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Interface/Interface.swift", + templatePath: "Interface.stencil" + ) + ] +) diff --git a/Plugin/TemplatePlugin/Templates/Module/Module.swift b/Plugin/TemplatePlugin/Templates/Module/Module.swift new file mode 100644 index 0000000..285b33a --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Module/Module.swift @@ -0,0 +1,24 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") +private let targetAttribute = Template.Attribute.required("target") + +private let template = Template( + description: "A template for a new module", + attributes: [ + layerAttribute, + nameAttribute, + targetAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Source.swift", + templatePath: "Sources.stencil" + ), + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Project.swift", + templatePath: "Project.stencil" + ) + ] +) diff --git a/Plugin/TemplatePlugin/Templates/Module/Project.stencil b/Plugin/TemplatePlugin/Templates/Module/Project.stencil new file mode 100644 index 0000000..9089b37 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Module/Project.stencil @@ -0,0 +1,8 @@ +import DependencyPlugin +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.{{ layer }}.{{ name }}.rawValue, + targets: {{ target }} +) diff --git a/Plugin/TemplatePlugin/Templates/Module/Sources.stencil b/Plugin/TemplatePlugin/Templates/Module/Sources.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Module/Sources.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil b/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Sources/Sources.swift b/Plugin/TemplatePlugin/Templates/Sources/Sources.swift new file mode 100644 index 0000000..dcb8bf2 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Sources/Sources.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's sources target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Sources.swift", + templatePath: "Sources.stencil" + ) + ] +) diff --git a/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil b/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Testing/Testing.swift b/Plugin/TemplatePlugin/Templates/Testing/Testing.swift new file mode 100644 index 0000000..e945d0a --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Testing/Testing.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's testing target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Testing/Testing.swift", + templatePath: "Testing.stencil" + ) + ] +) diff --git a/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil b/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil new file mode 100644 index 0000000..a6a1c65 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil @@ -0,0 +1,11 @@ +import XCTest + +final class {{ name }}Tests: XCTestCase { + override func setUpWithError() throws {} + + override func tearDownWithError() throws {} + + func testExample() { + XCTAssertEqual(1, 1) + } +} diff --git a/Plugin/TemplatePlugin/Templates/Tests/Tests.swift b/Plugin/TemplatePlugin/Templates/Tests/Tests.swift new file mode 100644 index 0000000..09d79c9 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/Tests/Tests.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's unit test target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Tests/\(nameAttribute)Test.swift", + templatePath: "Tests.stencil" + ), + ] +) diff --git a/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil b/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil new file mode 100644 index 0000000..2a0cbf0 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil @@ -0,0 +1,11 @@ +import XCTest + +final class {{ name }}Tests: XCTestCase { + override func setUpWithError() throws {} + + override func tearDownWithError() throws {} + + func testExample() throws { + XCTAssertEqual("A", "A") + } +} diff --git a/Plugin/TemplatePlugin/Templates/UITests/UITests.swift b/Plugin/TemplatePlugin/Templates/UITests/UITests.swift new file mode 100644 index 0000000..716ef24 --- /dev/null +++ b/Plugin/TemplatePlugin/Templates/UITests/UITests.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's ui test target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/UITests/\(nameAttribute)UITests.swift", + templatePath: "UITests.stencil" + ), + ] +) diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift new file mode 100644 index 0000000..7fb8ffa --- /dev/null +++ b/Projects/App/Project.swift @@ -0,0 +1,114 @@ +import ConfigurationPlugin +import DependencyPlugin +import EnvironmentPlugin +import Foundation +import ProjectDescription +import ProjectDescriptionHelpers + +let configurations: [Configuration] = .default + +let settings: Settings = .settings( + base: env.baseSetting, + configurations: configurations, + defaultSettings: .recommended +) + +let scripts: [TargetScript] = generateEnvironment.scripts + +let targets: [Target] = [ + .target( + name: env.name, + destinations: env.destinations, + product: .app, + bundleId: "\(env.organizationName).\(env.name)", + deploymentTargets: .iOS("16.0"), + infoPlist: .file(path: "iOS/Support/Info.plist"), + sources: ["iOS/Sources/**"], + resources: ["iOS/Resources/**"], + entitlements: .file(path: "iOS/Support/ondosee.entitlements"), + scripts: scripts, + dependencies: ModulePaths.Feature.allCases.map { TargetDependency.feature(target: $0) } + + ModulePaths.Domain.allCases.map { TargetDependency.domain(target: $0) } + + [ + .core(target: .Networking), + .target(name: "\(env.name)Widget"), + .target(name: "\(env.name)WatchApp") + ], + settings: .settings( + base: env.baseSetting + ) + ), + .target( + name: "\(env.name)Widget", + destinations: [.iPhone], + product: .appExtension, + bundleId: "\(env.organizationName).\(env.name).ondoseeWidget", + deploymentTargets: .iOS("16.0"), + infoPlist: .file(path: "iOS-Widget/Support/Info.plist"), + sources: ["iOS-Widget/Sources/**"], + resources: ["iOS-Widget/Resources/**"], + entitlements: .file(path: "iOS-Widget/Support/ondoseeWidget.entitlements"), + scripts: scripts, + dependencies: [ + .userInterface(target: .DesignSystem) + ], + settings: .settings( + base: env.baseSetting + ) + ), + .target( + name: "\(env.name)WatchApp", + destinations: [.appleWatch], + product: .app, + bundleId: "\(env.organizationName).\(env.name).watchkitapp", + deploymentTargets: .watchOS("9.0"), + infoPlist: .file(path: "watchOS/Support/Info.plist"), + sources: ["watchOS/Sources/**"], + resources: ["watchOS/Resources/**"], + scripts: scripts, + dependencies: [ + .userInterface(target: .DesignSystem) + ], + settings: .settings( + base: env.baseSetting + ) + ) +] + +let schemes: [Scheme] = [ + .scheme( + name: "\(env.name)-DEV", + shared: true, + buildAction: .buildAction(targets: ["\(env.name)"]), + runAction: .runAction(configuration: .dev), + archiveAction: .archiveAction(configuration: .dev), + profileAction: .profileAction(configuration: .dev), + analyzeAction: .analyzeAction(configuration: .dev) + ), + .scheme( + name: "\(env.name)-STAGE", + shared: true, + buildAction: .buildAction(targets: ["\(env.name)"]), + runAction: .runAction(configuration: .stage), + archiveAction: .archiveAction(configuration: .stage), + profileAction: .profileAction(configuration: .stage), + analyzeAction: .analyzeAction(configuration: .stage) + ), + .scheme( + name: "\(env.name)-PROD", + shared: true, + buildAction: .buildAction(targets: ["\(env.name)"]), + runAction: .runAction(configuration: .prod), + archiveAction: .archiveAction(configuration: .prod), + profileAction: .profileAction(configuration: .prod), + analyzeAction: .analyzeAction(configuration: .prod) + ) +] + +let project = Project( + name: env.name, + organizationName: env.organizationName, + settings: settings, + targets: targets, + schemes: schemes +) diff --git a/Projects/App/iOS-Widget/Resources/Assets.xcassets/AccentColor.colorset/Contents.json b/Projects/App/iOS-Widget/Resources/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Projects/App/iOS-Widget/Resources/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS-Widget/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Projects/App/iOS-Widget/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/Projects/App/iOS-Widget/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS-Widget/Resources/Assets.xcassets/Contents.json b/Projects/App/iOS-Widget/Resources/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Projects/App/iOS-Widget/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS-Widget/Sources/Sources.swift b/Projects/App/iOS-Widget/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/App/iOS-Widget/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/App/iOS-Widget/Support/Info.plist b/Projects/App/iOS-Widget/Support/Info.plist new file mode 100644 index 0000000..2688b32 --- /dev/null +++ b/Projects/App/iOS-Widget/Support/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Projects/App/iOS-Widget/Support/ondoseeWidget.entitlements b/Projects/App/iOS-Widget/Support/ondoseeWidget.entitlements new file mode 100644 index 0000000..59ab01e --- /dev/null +++ b/Projects/App/iOS-Widget/Support/ondoseeWidget.entitlements @@ -0,0 +1,12 @@ + + + + + + diff --git a/Projects/App/iOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json b/Projects/App/iOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Projects/App/iOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Projects/App/iOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/Projects/App/iOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS/Resources/Assets.xcassets/Contents.json b/Projects/App/iOS/Resources/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Projects/App/iOS/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/iOS/Resources/LaunchScreen.storyboard b/Projects/App/iOS/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Projects/App/iOS/Resources/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/App/iOS/Sources/Application/OndoseeIOSApp.swift b/Projects/App/iOS/Sources/Application/OndoseeIOSApp.swift new file mode 100644 index 0000000..7bbedc5 --- /dev/null +++ b/Projects/App/iOS/Sources/Application/OndoseeIOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct OndoseeIOSApp: App { + var body: some Scene { + WindowGroup { + EmptyView() + } + } +} diff --git a/Projects/App/iOS/Support/Info.plist b/Projects/App/iOS/Support/Info.plist new file mode 100644 index 0000000..2688b32 --- /dev/null +++ b/Projects/App/iOS/Support/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Projects/App/iOS/Support/ondosee.entitlements b/Projects/App/iOS/Support/ondosee.entitlements new file mode 100644 index 0000000..e69de29 diff --git a/Projects/App/watchOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json b/Projects/App/watchOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Projects/App/watchOS/Resources/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/watchOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Projects/App/watchOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/Projects/App/watchOS/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/watchOS/Resources/Assets.xcassets/Contents.json b/Projects/App/watchOS/Resources/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Projects/App/watchOS/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/App/watchOS/Sources/Sources.swift b/Projects/App/watchOS/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/App/watchOS/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/App/watchOS/Support/Info.plist b/Projects/App/watchOS/Support/Info.plist new file mode 100644 index 0000000..2688b32 --- /dev/null +++ b/Projects/App/watchOS/Support/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Projects/Core/Networking/Interface/Interface.swift b/Projects/Core/Networking/Interface/Interface.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Core/Networking/Interface/Interface.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Core/Networking/Project.swift b/Projects/Core/Networking/Project.swift new file mode 100644 index 0000000..14d6ec3 --- /dev/null +++ b/Projects/Core/Networking/Project.swift @@ -0,0 +1,49 @@ +import ConfigurationPlugin +import DependencyPlugin +import EnvironmentPlugin +import Foundation +import ProjectDescription +import ProjectDescriptionHelpers + +let name = ModulePaths.Core.Networking.rawValue + +let configurations: [Configuration] = generateEnvironment == .ci ? + .default : + [ + .debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: name)), + .debug(name: .stage, xcconfig: .relativeToXCConfig(type: .stage, name: name)), + .release(name: .prod, xcconfig: .relativeToXCConfig(type: .prod, name: name)) + ] + +let project = Project.module( + name: name, + targets: [ + .interface( + module: .core(.Networking), + spec: .init( + infoPlist: .extendingDefault( + with: [:] + ), + dependencies: [], + settings: .settings( + base: env.baseSetting + .merging(.allLoadLDFlages), + configurations: configurations, + defaultSettings: .recommended + ) + ) + ), + .implements( + module: .core(.Networking), + dependencies: [ + + ] + ), + .testing(module: .core(.Networking), dependencies: [ + .core(target: .Networking, type: .interface) + ]), + .tests(module: .core(.Networking), dependencies: [ + .core(target: .Networking) + ]) + ] +) diff --git a/Projects/Core/Networking/Sources/Sources.swift b/Projects/Core/Networking/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Core/Networking/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Core/Networking/Testing/Testing.swift b/Projects/Core/Networking/Testing/Testing.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Core/Networking/Testing/Testing.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Core/Networking/Tests/NetworkingTest.swift b/Projects/Core/Networking/Tests/NetworkingTest.swift new file mode 100644 index 0000000..4160e6c --- /dev/null +++ b/Projects/Core/Networking/Tests/NetworkingTest.swift @@ -0,0 +1,11 @@ +import XCTest + +final class NetworkingTests: XCTestCase { + override func setUpWithError() throws {} + + override func tearDownWithError() throws {} + + func testExample() { + XCTAssertEqual(1, 1) + } +} diff --git a/Projects/Domain/BaseDomain/Interface/Interface.swift b/Projects/Domain/BaseDomain/Interface/Interface.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Domain/BaseDomain/Interface/Interface.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Domain/BaseDomain/Project.swift b/Projects/Domain/BaseDomain/Project.swift new file mode 100644 index 0000000..ba46b59 --- /dev/null +++ b/Projects/Domain/BaseDomain/Project.swift @@ -0,0 +1,25 @@ +import ConfigurationPlugin +import DependencyPlugin +import EnvironmentPlugin +import Foundation +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.Domain.BaseDomain.rawValue, + targets: [ + .interface(module: .domain(.BaseDomain), dependencies: [ + ]), + .implements( + module: .domain(.BaseDomain), + dependencies: [ + .domain(target: .BaseDomain, type: .interface), + .core(target: .Networking, type: .interface), + .shared(target: .GlobalThirdPartyLibrary) + ] + ), + .tests(module: .domain(.BaseDomain), dependencies: [ + .domain(target: .BaseDomain) + ]) + ] +) diff --git a/Projects/Domain/BaseDomain/Sources/Sources.swift b/Projects/Domain/BaseDomain/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Domain/BaseDomain/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Domain/BaseDomain/Tests/.gitkeep b/Projects/Domain/BaseDomain/Tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Projects/Domain/BaseDomain/Tests/TargetTest.swift b/Projects/Domain/BaseDomain/Tests/TargetTest.swift new file mode 100644 index 0000000..147c29d --- /dev/null +++ b/Projects/Domain/BaseDomain/Tests/TargetTest.swift @@ -0,0 +1,15 @@ +import XCTest + +class TargetTests: XCTestCase { + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + XCTAssertEqual("A", "A") + } +} diff --git a/Projects/Feature/BaseFeature/Interface/Interface.swift b/Projects/Feature/BaseFeature/Interface/Interface.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Feature/BaseFeature/Interface/Interface.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Feature/BaseFeature/Project.swift b/Projects/Feature/BaseFeature/Project.swift new file mode 100644 index 0000000..99f05ab --- /dev/null +++ b/Projects/Feature/BaseFeature/Project.swift @@ -0,0 +1,18 @@ +import DependencyPlugin +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.Feature.BaseFeature.rawValue, + targets: [ + .interface(module: .feature(.BaseFeature), dependencies: [ + + ]), + .implements(module: .feature(.BaseFeature), product: .framework, dependencies: [ + .feature(target: .BaseFeature, type: .interface) + ]), + .tests(module: .feature(.BaseFeature), dependencies: [ + .feature(target: .BaseFeature) + ]) + ] +) diff --git a/Projects/Feature/BaseFeature/Sources/Sources.swift b/Projects/Feature/BaseFeature/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/Feature/BaseFeature/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/Feature/BaseFeature/Tests/.gitkeep b/Projects/Feature/BaseFeature/Tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Projects/Feature/BaseFeature/Tests/TargetTest.swift b/Projects/Feature/BaseFeature/Tests/TargetTest.swift new file mode 100644 index 0000000..147c29d --- /dev/null +++ b/Projects/Feature/BaseFeature/Tests/TargetTest.swift @@ -0,0 +1,15 @@ +import XCTest + +class TargetTests: XCTestCase { + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + XCTAssertEqual("A", "A") + } +} diff --git a/Projects/Shared/GlobalThirdPartyLibrary/Project.swift b/Projects/Shared/GlobalThirdPartyLibrary/Project.swift new file mode 100644 index 0000000..b77240d --- /dev/null +++ b/Projects/Shared/GlobalThirdPartyLibrary/Project.swift @@ -0,0 +1,10 @@ +import DependencyPlugin +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.Shared.GlobalThirdPartyLibrary.rawValue, + targets: [ + .implements(module: .shared(.GlobalThirdPartyLibrary), product: .framework, dependencies: []) + ] +) diff --git a/Projects/Shared/GlobalThirdPartyLibrary/Sources/ThirdPartyLibrary.swift b/Projects/Shared/GlobalThirdPartyLibrary/Sources/ThirdPartyLibrary.swift new file mode 100644 index 0000000..7d846fc --- /dev/null +++ b/Projects/Shared/GlobalThirdPartyLibrary/Sources/ThirdPartyLibrary.swift @@ -0,0 +1 @@ +// this is for tuist diff --git a/Projects/UserInterface/DesignSystem/Example/Resources/LaunchScreen.storyboard b/Projects/UserInterface/DesignSystem/Example/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Projects/UserInterface/DesignSystem/Example/Resources/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/UserInterface/DesignSystem/Example/Sources/AppDelegate.swift b/Projects/UserInterface/DesignSystem/Example/Sources/AppDelegate.swift new file mode 100644 index 0000000..ad9cb02 --- /dev/null +++ b/Projects/UserInterface/DesignSystem/Example/Sources/AppDelegate.swift @@ -0,0 +1,18 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let viewController = DesignSystemDemoViewController(nibName: nil, bundle: nil) + window?.rootViewController = viewController + window?.makeKeyAndVisible() + + return true + } +} diff --git a/Projects/UserInterface/DesignSystem/Project.swift b/Projects/UserInterface/DesignSystem/Project.swift new file mode 100644 index 0000000..1a44017 --- /dev/null +++ b/Projects/UserInterface/DesignSystem/Project.swift @@ -0,0 +1,21 @@ +import DependencyPlugin +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.UserInterface.DesignSystem.rawValue, + targets: [ + .implements( + module: .userInterface(.DesignSystem), + product: .framework, + spec: .init( + resources: ["Resources/**"], + dependencies: [] + ) + ), + .example(module: .userInterface(.DesignSystem), dependencies: [ + .userInterface(target: .DesignSystem) + ]) + ], + resourceSynthesizers: .default +) diff --git a/Projects/UserInterface/DesignSystem/Resources/Resources.swift b/Projects/UserInterface/DesignSystem/Resources/Resources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/UserInterface/DesignSystem/Resources/Resources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Projects/UserInterface/DesignSystem/Sources/Sources.swift b/Projects/UserInterface/DesignSystem/Sources/Sources.swift new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Projects/UserInterface/DesignSystem/Sources/Sources.swift @@ -0,0 +1 @@ +// This is For Tuist diff --git a/README.md b/README.md deleted file mode 100644 index 748514a..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ondosee-iOS -🌦️ ON°C iOS Repository diff --git a/Scripts/.swiftlint.yml b/Scripts/.swiftlint.yml new file mode 100644 index 0000000..b437648 --- /dev/null +++ b/Scripts/.swiftlint.yml @@ -0,0 +1,27 @@ +excluded: + - fastlane + - Dependencies + - Carthage + +disabled_rules: + - void_function_in_ternary + +identifier_name: + min_length: 1 + max_length: 60 + allowed_symbols: [_] + +large_tuple: + warning: 3 + error: 4 + +line_length: + warning: 120 + error: 120 + ignores_urls: true + ignores_comments: true + +type_name: + min_length: 2 + max_length: 60 + allowed_symbols: [_] diff --git a/Scripts/GenerateFeature/Interface/Interface.swift b/Scripts/GenerateFeature/Interface/Interface.swift new file mode 100644 index 0000000..8d35d5c --- /dev/null +++ b/Scripts/GenerateFeature/Interface/Interface.swift @@ -0,0 +1 @@ +// This is for the feature diff --git a/Scripts/GenerateFeature/Project.swift b/Scripts/GenerateFeature/Project.swift new file mode 100644 index 0000000..ed80e04 --- /dev/null +++ b/Scripts/GenerateFeature/Project.swift @@ -0,0 +1,10 @@ +//import ProjectDescription +//import ProjectDescriptionHelpers +// +//let project = Project.staticFramework( +// name: "Feature", +// dependencies: [ +// .Project.Features.Feature +// ] +//) + diff --git a/Scripts/GenerateFeature/Sources/Feature.swift b/Scripts/GenerateFeature/Sources/Feature.swift new file mode 100644 index 0000000..8d35d5c --- /dev/null +++ b/Scripts/GenerateFeature/Sources/Feature.swift @@ -0,0 +1 @@ +// This is for the feature diff --git a/Scripts/GenerateFeature/Testing/Testing.swift b/Scripts/GenerateFeature/Testing/Testing.swift new file mode 100644 index 0000000..8d35d5c --- /dev/null +++ b/Scripts/GenerateFeature/Testing/Testing.swift @@ -0,0 +1 @@ +// This is for the feature diff --git a/Scripts/GenerateFeature/Tests/.gitkeep b/Scripts/GenerateFeature/Tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Scripts/GenerateFeature/Tests/TargetTest.swift b/Scripts/GenerateFeature/Tests/TargetTest.swift new file mode 100644 index 0000000..b1cf794 --- /dev/null +++ b/Scripts/GenerateFeature/Tests/TargetTest.swift @@ -0,0 +1,17 @@ +import XCTest + +class TargetTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + XCTAssertEqual("A", "A") + } + +} diff --git a/Scripts/GenerateFeature/UITests/.gitkeep b/Scripts/GenerateFeature/UITests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Scripts/GenerateFeature/UITests/TargetTest.swift b/Scripts/GenerateFeature/UITests/TargetTest.swift new file mode 100644 index 0000000..b1cf794 --- /dev/null +++ b/Scripts/GenerateFeature/UITests/TargetTest.swift @@ -0,0 +1,17 @@ +import XCTest + +class TargetTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + XCTAssertEqual("A", "A") + } + +} diff --git a/Scripts/GenerateModule.swift b/Scripts/GenerateModule.swift new file mode 100644 index 0000000..61de0aa --- /dev/null +++ b/Scripts/GenerateModule.swift @@ -0,0 +1,313 @@ +#!/usr/bin/swift +import Foundation + +func handleSIGINT(_ signal: Int32) { + exit(0) +} + +signal(SIGINT, handleSIGINT) + +enum LayerType: String { + case feature = "Feature" + case domain = "Domain" + case core = "Core" + case shared = "Shared" + case userInterface = "UserInterface" +} + +enum MicroTargetType: String { + case interface = "Interface" + case sources = "" + case testing = "Testing" + case unitTest = "Tests" + case uiTest = "UITests" + case example = "Example" +} + +struct ModuleInfo { + let moduleName: String + let hasInterface: Bool + let hasTesting: Bool + let hasUnitTests: Bool + let hasUITests: Bool + let hasExample: Bool +} + +let fileManager = FileManager.default +let currentPath = "./" +let bash = Bash() + +func registerModuleDependency() { + registerModulePaths() + makeProjectDirectory() + registerXCConfig() + + let layerPrefix = layer.rawValue.lowercased() + let moduleEnum = ".\(layerPrefix)(.\(moduleName))" + var targetString = "[\n" + if hasInterface { + makeScaffold(target: .interface) + targetString += "\(tab(2)).interface(module: \(moduleEnum)),\n" + } + targetString += "\(tab(2)).implements(module: \(moduleEnum)" + if hasInterface { + targetString += ", dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName), type: .interface)\n\(tab(2))])" + } else { + targetString += ")" + } + if hasTesting { + makeScaffold(target: .testing) + let interfaceDependency = ".\(layerPrefix)(target: .\(moduleName), type: .interface)" + targetString += ",\n\(tab(2)).testing(module: \(moduleEnum), dependencies: [\n\(tab(3))\(interfaceDependency)\n\(tab(2))])" + } + if hasUnitTests { + makeScaffold(target: .unitTest) + targetString += ",\n\(tab(2)).tests(module: \(moduleEnum), dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName))\n\(tab(2))])" + } + if hasUITests { + makeScaffold(target: .uiTest) + // TODO: - ui test 타겟 설정 로직 추가 + } + if hasExample { + makeScaffold(target: .example) + targetString += ",\n\(tab(2)).example(module: \(moduleEnum), dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName))\n\(tab(2))])" + } + targetString += "\n\(tab(1))]" + makeProjectSwift(targetString: targetString) + makeSourceScaffold() +} + +func tab(_ count: Int) -> String { + var tabString = "" + for _ in 0.. ModuleInfo { + print("Enter module name", terminator: " : ") + let moduleInput = readLine() + guard let moduleNameUnwrapping = moduleInput, !moduleNameUnwrapping.isEmpty else { + print("Module name is empty") + exit(1) + } + let moduleName = moduleNameUnwrapping + print("Module name: \(moduleName)\n") + + print("This module has a 'Interface' Target? (y\\n, default = n)", terminator: " : ") + let hasInterface = readLine()?.lowercased() == "y" + + print("This module has a 'Testing' Target? (y\\n, default = n)", terminator: " : ") + let hasTesting = readLine()?.lowercased() == "y" + + print("This module has a 'UnitTests' Target? (y\\n, default = n)", terminator: " : ") + let hasUnitTests = readLine()?.lowercased() == "y" + + print("This module has a 'UITests' Target? (y\\n, default = n)", terminator: " : ") + let hasUITests = readLine()?.lowercased() == "y" + + print("This module has a 'Example' Target? (y\\n, default = n)", terminator: " : ") + let hasExample = readLine()?.lowercased() == "y" + + return ModuleInfo( + moduleName: moduleName, + hasInterface: hasInterface, + hasTesting: hasTesting, + hasUnitTests: hasUnitTests, + hasUITests: hasUITests, + hasExample: hasExample + ) +} + +func checkModuleInfo() -> Bool { + print("") + print("------------------------------------------------------------------------------------------------------------------------") + print("Is this the correct module information you are generating? (y\\n, default = y)") + print("Layer: \(layer.rawValue)") + print("Module name: \(moduleName)") + print("interface: \(hasInterface), testing: \(hasTesting), unitTests: \(hasUnitTests), uiTests: \(hasUITests), example: \(hasExample)") + print("------------------------------------------------------------------------------------------------------------------------") + + guard var checkInput = readLine() else { + exit(1) + } + + if checkInput.isEmpty { + checkInput = "y" + } + + let isCorrect = checkInput.lowercased() == "y" + return !isCorrect +} + +// MARK: - Starting point + +print("Enter layer name\n(Feature | Domain | Core | Shared | UserInterface)", terminator: " : ") +let layerInput = readLine() +guard + let layerInput, + !layerInput.isEmpty, + let layerUnwrapping = LayerType(rawValue: layerInput) +else { + print("Layer is empty or invalid") + exit(1) +} +let layer = layerUnwrapping +print("Layer: \(layer.rawValue)\n") + +var moduleName: String = "" +var hasInterface: Bool = false +var hasTesting: Bool = false +var hasUnitTests: Bool = false +var hasUITests: Bool = false +var hasExample: Bool = false + +repeat { + let moduleInfo = makeModuleInfo() + moduleName = moduleInfo.moduleName + hasInterface = moduleInfo.hasInterface + hasTesting = moduleInfo.hasTesting + hasUnitTests = moduleInfo.hasUnitTests + hasUITests = moduleInfo.hasUITests + hasExample = moduleInfo.hasExample +} +while checkModuleInfo() + +registerModuleDependency() + +print("✅ Module is created successfully!") + +// MARK: - Bash +protocol CommandExecuting { + func run(commandName: String, arguments: [String]) throws -> String +} + +enum BashError: Error { + case commandNotFound(name: String) +} + +struct Bash: CommandExecuting { + func run(commandName: String, arguments: [String] = []) throws -> String { + return try run(resolve(commandName), with: arguments) + } + + private func resolve(_ command: String) throws -> String { + guard var bashCommand = try? run("/bin/bash", with: ["-l", "-c", "which \(command)"]) else { + throw BashError.commandNotFound(name: command) + } + bashCommand = bashCommand.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines) + return bashCommand + } + + private func run(_ command: String, with arguments: [String] = []) throws -> String { + let process = Process() + process.launchPath = command + process.arguments = arguments + let outputPipe = Pipe() + process.standardOutput = outputPipe + process.launch() + let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile() + let output = String(decoding: outputData, as: UTF8.self) + return output + } +} diff --git a/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard b/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift b/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift new file mode 100644 index 0000000..d30d117 --- /dev/null +++ b/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift @@ -0,0 +1,20 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let viewController = UIViewController() + viewController.view.backgroundColor = .yellow + window?.rootViewController = viewController + window?.makeKeyAndVisible() + + return true + } +} diff --git a/Scripts/NewDependency.swift b/Scripts/NewDependency.swift new file mode 100644 index 0000000..f096855 --- /dev/null +++ b/Scripts/NewDependency.swift @@ -0,0 +1,79 @@ +#!/usr/bin/swift +import Foundation + +func handleSIGINT(_ signal: Int32) { + exit(0) +} + +signal(SIGINT, handleSIGINT) + + let currentPath = "./" + + func updateFileContent( + filePath: String, + finding findingString: String, + inserting insertString: String + ) { + let fileURL = URL(fileURLWithPath: filePath) + guard let readHandle = try? FileHandle(forReadingFrom: fileURL) else { + fatalError("❌ Failed to find \(filePath)") + } + guard let readData = try? readHandle.readToEnd() else { + fatalError("❌ Failed to find \(filePath)") + } + try? readHandle.close() + + guard var fileString = String(data: readData, encoding: .utf8) else { fatalError() } + fileString.insert(contentsOf: insertString, at: fileString.range(of: findingString)?.upperBound ?? fileString.endIndex) + + guard let writeHandle = try? FileHandle(forWritingTo: fileURL) else { + fatalError("❌ Failed to find \(filePath)") + } + writeHandle.seek(toFileOffset: 0) + try? writeHandle.write(contentsOf: Data(fileString.utf8)) + try? writeHandle.close() + } + + func registerDependenciesSwift(url: String, version: String) { + let filePath = currentPath + "Package.swift" + let findingString = " dependencies: [\n" + let inserting = " .package(url: \"\(url)\", from: \"\(version)\"),\n" + updateFileContent(filePath: filePath, finding: findingString, inserting: inserting) + } + + func registerDependencySPM(name: String, package: String) { + let filePath = currentPath + "Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift" + let findingString = "public extension TargetDependency.SPM {\n" + let inserting = " static let \(name) = TargetDependency.external(name: \"\(package)\")\n" + updateFileContent(filePath: filePath, finding: findingString, inserting: inserting) + } + + func registerDependency(name: String, package: String, url: String, version: String) { + registerDependenciesSwift(url: url, version: version) + registerDependencySPM(name: name, package: package) + } + + print("Enter dependency name", terminator: " : ") + guard let dependencyName = readLine() else { + fatalError("Dependency name is nil") + } + + print("Enter package name", terminator: " : ") + guard let packageName = readLine() else { + fatalError("Package name is nil") + } + + print("Enter dependency github URL", terminator: " : ") + guard let dependencyURL = readLine() else { + fatalError("Dependency URL is nil") + } + + print("Enter dependency version", terminator: " : ") + guard let dependencyVersion = readLine() else { + fatalError("Dependency version is nil") + } + + registerDependency(name: dependencyName, package: packageName, url: dependencyURL, version: dependencyVersion) + + print("") + print("✅ New Dependency is registered successfully!") diff --git a/Scripts/SwiftLintRunScript.sh b/Scripts/SwiftLintRunScript.sh new file mode 100644 index 0000000..be41a69 --- /dev/null +++ b/Scripts/SwiftLintRunScript.sh @@ -0,0 +1,12 @@ +if test -d "/opt/homebrew/bin/"; then + PATH="/opt/homebrew/bin/:${PATH}" +fi + +export PATH +YML="$(dirname "$0")/.swiftlint.yml" + +if which swiftlint > /dev/null; then + swiftlint --config "${YML}" +else + echo "warning: SwiftLint not installed, please run 'brew install swiftlint'" +fi diff --git a/Tuist/Config.swift b/Tuist/Config.swift new file mode 100644 index 0000000..0b5c58b --- /dev/null +++ b/Tuist/Config.swift @@ -0,0 +1,11 @@ +import ProjectDescription + +let config = Config( + plugins: [ + .local(path: .relativeToRoot("Plugin/ConfigurationPlugin")), + .local(path: .relativeToRoot("Plugin/DependencyPlugin")), + .local(path: .relativeToRoot("Plugin/EnvironmentPlugin")), + .local(path: .relativeToRoot("Plugin/TemplatePlugin")) + ], + generationOptions: .options() +) diff --git a/Tuist/Package.swift b/Tuist/Package.swift new file mode 100644 index 0000000..7a37df9 --- /dev/null +++ b/Tuist/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version: 5.9 +import PackageDescription + +#if TUIST + import ProjectDescription + + let packageSettings = PackageSettings( + // Customize the product types for specific package product + // Default is .staticFramework + // productTypes: ["Alamofire": .framework,] + productTypes: [:] + ) +#endif + +let package = Package( + name: "OndoseeIOS", + dependencies: [ + // Add your own dependencies here: + // .package(url: "https://github.com/Alamofire/Alamofire", from: "5.0.0"), + // You can read more about dependencies here: https://docs.tuist.io/documentation/tuist/dependencies + ] +) diff --git a/Tuist/ProjectDescriptionHelpers/Action/Action+Templete.swift b/Tuist/ProjectDescriptionHelpers/Action/Action+Templete.swift new file mode 100644 index 0000000..50385bf --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Action/Action+Templete.swift @@ -0,0 +1,8 @@ +import ProjectDescription + +public extension TargetScript { + static let swiftLint = TargetScript.pre( + path: Path.relativeToRoot("Scripts/SwiftLintRunScript.sh"), + name: "SwiftLint" + ) +} diff --git a/Tuist/ProjectDescriptionHelpers/GenerateEnvironment.swift b/Tuist/ProjectDescriptionHelpers/GenerateEnvironment.swift new file mode 100644 index 0000000..834afa1 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/GenerateEnvironment.swift @@ -0,0 +1,24 @@ +import ConfigurationPlugin +import Foundation +import ProjectDescription + +public enum GenerateEnvironment: String { + case ci = "CI" + case cd = "CD" + case dev = "DEV" +} + +let environment = ProcessInfo.processInfo.environment["TUIST_ENV"] ?? "" +public let generateEnvironment = GenerateEnvironment(rawValue: environment) ?? .dev + +public extension GenerateEnvironment { + var scripts: [TargetScript] { + switch self { + case .ci, .cd: + return [] + + case .dev: + return [.swiftLint] + } + } +} diff --git a/Tuist/ProjectDescriptionHelpers/Internal/Configurable.swift b/Tuist/ProjectDescriptionHelpers/Internal/Configurable.swift new file mode 100644 index 0000000..9721888 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Internal/Configurable.swift @@ -0,0 +1,14 @@ +import ProjectDescription + +protocol Configurable { + func with(_ block: (inout Self) throws -> Void) rethrows -> Self +} + +extension Configurable { + @inlinable + func with(_ block: (inout Self) throws -> Void) rethrows -> Self { + var copy = self + try block(©) + return copy + } +} diff --git a/Tuist/ProjectDescriptionHelpers/Project/Project+Module.swift b/Tuist/ProjectDescriptionHelpers/Project/Project+Module.swift new file mode 100644 index 0000000..47aa8ab --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Project/Project+Module.swift @@ -0,0 +1,32 @@ +import ConfigurationPlugin +import EnvironmentPlugin +import Foundation +import ProjectDescription + +public extension Project { + static func module( + name: String, + options: Options = .options(), + packages: [Package] = [], + settings: Settings = .settings(configurations: .default), + targets: [Target], + fileHeaderTemplate: FileHeaderTemplate? = nil, + additionalFiles: [FileElement] = [], + resourceSynthesizers: [ResourceSynthesizer] = .default + ) -> Project { + return Project( + name: name, + organizationName: env.organizationName, + options: options, + packages: packages, + settings: settings, + targets: targets, + schemes: targets.contains { $0.product == .app } ? + [.makeScheme(target: .dev, name: name), .makeScheme(target: .dev, name: name)] : + [.makeScheme(target: .dev, name: name)], + fileHeaderTemplate: fileHeaderTemplate, + additionalFiles: additionalFiles, + resourceSynthesizers: resourceSynthesizers + ) + } +} diff --git a/Tuist/ProjectDescriptionHelpers/Project/Project+makeModule.swift b/Tuist/ProjectDescriptionHelpers/Project/Project+makeModule.swift new file mode 100644 index 0000000..ad64a4c --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Project/Project+makeModule.swift @@ -0,0 +1,178 @@ +import ConfigurationPlugin +import DependencyPlugin +import EnvironmentPlugin +import Foundation +import ProjectDescription + +public enum ModularTarget { + case interface + case testing + case unitTest + case uiTest + case example +} + +public extension Project { + static func makeModule( + name: String, + destinations: Destinations = env.destinations, + product: Product, + targets: Set, + packages: [Package] = [], + externalDependencies: [TargetDependency] = [], + internalDependencies: [TargetDependency] = [], + interfaceDependencies: [TargetDependency] = [], + testingDependencies: [TargetDependency] = [], + unitTestDependencies: [TargetDependency] = [], + uiTestDependencies: [TargetDependency] = [], + exampleDependencies: [TargetDependency] = [], + sources: SourceFilesList = .sources, + resources: ResourceFileElements? = nil, + settings: SettingsDictionary = [:], + additionalPlistRows: [String: ProjectDescription.Plist.Value] = [:], + additionalFiles: [FileElement] = [], + configurations: [Configuration] = [] + ) -> Project { + let scripts: [TargetScript] = generateEnvironment.scripts + let ldFlagsSettings: SettingsDictionary = product == .framework ? + ["OTHER_LDFLAGS": .string("$(inherited) --all_load")] : + ["OTHER_LDFLAGS": .string("$(inherited")] + + var configurations = configurations + if configurations.isEmpty { + configurations = [ + .debug(name: .dev, xcconfig: .shared), + .debug(name: .stage, xcconfig: .shared), + .release(name: .prod, xcconfig: .shared) + ] + } + + let settings: Settings = .settings( + base: env.baseSetting + .merging(settings), + configurations: configurations, + defaultSettings: .recommended + ) + var allTargets: [Target] = [] + var dependencies = internalDependencies + externalDependencies + + // MARK: Interface + if targets.contains(.interface) { + dependencies.append(.target(name: "\(name)Interface")) + allTargets.append( + Target.target( + name: "\(name)Interface", + destinations: destinations, + product: .framework, + bundleId: "\(env.organizationName).\(name)Interface", + deploymentTargets: env.deploymentTargets, + infoPlist: .default, + sources: .interface, + scripts: scripts, + dependencies: internalDependencies, + additionalFiles: additionalFiles + ) + ) + } + + // MARK: Sources + allTargets.append( + Target.target( + name: name, + destinations: destinations, + product: product, + bundleId: "\(env.organizationName).\(name)", + deploymentTargets: env.deploymentTargets, + infoPlist: .extendingDefault(with: additionalPlistRows), + sources: sources, + resources: resources, + scripts: scripts, + dependencies: dependencies + ) + ) + + // MARK: Testing + if targets.contains(.testing) && targets.contains(.interface) { + allTargets.append( + Target.target( + name: name, + destinations: destinations, + product: .framework, + bundleId: "\(env.organizationName).\(name)Testing", + deploymentTargets: env.deploymentTargets, + infoPlist: .default, + sources: .testing, + scripts: scripts, + dependencies: [ + .target(name: "\(name)Interface") + ] + testingDependencies + ) + ) + } + + var testTargetDependencies = [ + targets.contains(.example) ? + TargetDependency.target(name: "\(name)ExampleApp") : + TargetDependency.target(name: name) + ] + if targets.contains(.testing) { + testTargetDependencies.append(.target(name: "\(name)Testing")) + } + + // MARK: UI Test + if targets.contains(.uiTest) { + allTargets.append( + Target.target( + name: "\(name)UITests", + destinations: destinations, + product: .uiTests, + bundleId: "\(env.organizationName).\(name)UITests", + deploymentTargets: env.deploymentTargets, + infoPlist: .default, + scripts: scripts, + dependencies: testTargetDependencies + uiTestDependencies + ) + ) + } + + // MARK: Example App + if targets.contains(.example) { + var exampleDependencies = exampleDependencies + exampleDependencies.append(.target(name: name)) + if targets.contains(.testing) { + exampleDependencies.append(.target(name: "\(name)Testing")) + } + allTargets.append( + Target.target( + name: "\(name)ExampleApp", + destinations: destinations, + product: .app, + bundleId: "\(env.organizationName).\(name)ExampleApp", + deploymentTargets: env.deploymentTargets, + infoPlist: .extendingDefault(with: [ + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen", + "ENABLE_TESTS": .boolean(true), + ]), + sources: .exampleSource, + resources: ["Example/Resources/**"], + scripts: scripts, + dependencies: exampleDependencies + ) + ) + } + + let schemes: [Scheme] = targets.contains(.example) ? + [.makeScheme(target: .dev, name: name), .makeExampleScheme(target: .dev, name: name)] : + [.makeScheme(target: .dev, name: name)] + + return Project( + name: name, + organizationName: env.organizationName, + packages: packages, + settings: settings, + targets: allTargets, + schemes: schemes + ) + } +} diff --git a/Tuist/ProjectDescriptionHelpers/Scheme/Scheme+Template.swift b/Tuist/ProjectDescriptionHelpers/Scheme/Scheme+Template.swift new file mode 100644 index 0000000..9347770 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Scheme/Scheme+Template.swift @@ -0,0 +1,37 @@ +import ProjectDescription + +extension Scheme { + static func makeScheme(target: ConfigurationName, name: String) -> Scheme { + return Scheme.scheme( + name: name, + shared: true, + buildAction: .buildAction(targets: ["\(name)"]), + testAction: .targets( + ["\(name)Tests"], + configuration: target, + options: .options(coverage: true, codeCoverageTargets: ["\(name)"]) + ), + runAction: .runAction(configuration: target), + archiveAction: .archiveAction(configuration: target), + profileAction: .profileAction(configuration: target), + analyzeAction: .analyzeAction(configuration: target) + ) + } + + static func makeExampleScheme(target: ConfigurationName, name: String) -> Scheme { + return Scheme.scheme( + name: name, + shared: true, + buildAction: .buildAction(targets: ["\(name)Example"]), + testAction: .targets( + ["\(name)Tests"], + configuration: target, + options: .options(coverage: true, codeCoverageTargets: ["\(name)Example"]) + ), + runAction: .runAction(configuration: target), + archiveAction: .archiveAction(configuration: target), + profileAction: .profileAction(configuration: target), + analyzeAction: .analyzeAction(configuration: target) + ) + } +} diff --git a/Tuist/ProjectDescriptionHelpers/SettingsDictionary/LDFlagsSettings.swift b/Tuist/ProjectDescriptionHelpers/SettingsDictionary/LDFlagsSettings.swift new file mode 100644 index 0000000..a3edbf1 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/SettingsDictionary/LDFlagsSettings.swift @@ -0,0 +1,11 @@ +import ProjectDescription + +public extension SettingsDictionary { + static let ldFlages: SettingsDictionary = [ + "OTHER_LDFLAGS": .string("$(inherited") + ] + + static let allLoadLDFlages: SettingsDictionary = [ + "OTHER_LDFLAGS": .string("$(inherited) -all_load") + ] +} diff --git a/Tuist/ProjectDescriptionHelpers/SourceFiles/SourceFiles+Template.swift b/Tuist/ProjectDescriptionHelpers/SourceFiles/SourceFiles+Template.swift new file mode 100644 index 0000000..1450307 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/SourceFiles/SourceFiles+Template.swift @@ -0,0 +1,10 @@ +import ProjectDescription + +public extension SourceFilesList { + static let exampleSource: SourceFilesList = "Example/Sources/**" + static let interface: SourceFilesList = "Interface/**" + static let sources: SourceFilesList = "Sources/**" + static let testing: SourceFilesList = "Testing/**" + static let unitTests: SourceFilesList = "Tests/**" + static let uiTests: SourceFilesList = "UITests/**" +} diff --git a/Tuist/ProjectDescriptionHelpers/Target/Target+Modular.swift b/Tuist/ProjectDescriptionHelpers/Target/Target+Modular.swift new file mode 100644 index 0000000..7d93828 --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Target/Target+Modular.swift @@ -0,0 +1,193 @@ +import ConfigurationPlugin +import DependencyPlugin +import EnvironmentPlugin +import ProjectDescription + +// MARK: Interface +public extension Target { + static func interface(module: ModulePaths, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .interface + } + .toTarget(with: module.targetName(type: .interface), product: .framework) + } + + static func interface(module: ModulePaths, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .interface, dependencies: dependencies) + .toTarget(with: module.targetName(type: .interface), product: .framework) + } + + static func interface(name: String, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .interface + } + .toTarget(with: "\(name)Interface", product: .framework) + } + + static func interface(name: String, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .interface, dependencies: dependencies) + .toTarget(with: "\(name)Interface", product: .framework) + } +} + +// MARK: - Implements +public extension Target { + static func implements( + module: ModulePaths, + product: Product = .staticLibrary, + spec: TargetSpec + ) -> Target { + spec.with { + $0.sources = .sources + } + .toTarget(with: module.targetName(type: .sources), product: product) + } + + static func implements( + module: ModulePaths, + product: Product = .staticLibrary, + dependencies: [TargetDependency] = [] + ) -> Target { + TargetSpec(sources: .sources, dependencies: dependencies) + .toTarget(with: module.targetName(type: .sources), product: product) + } + + static func implements( + name: String, + product: Product = .staticLibrary, + spec: TargetSpec + ) -> Target { + spec.with { + $0.sources = .sources + } + .toTarget(with: name, product: product) + } + + static func implements( + name: String, + product: Product = .staticLibrary, + dependencies: [TargetDependency] = [] + ) -> Target { + TargetSpec(sources: .sources, dependencies: dependencies) + .toTarget(with: name, product: product) + } +} + +// MARK: - Testing +public extension Target { + static func testing(module: ModulePaths, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .testing + } + .toTarget(with: module.targetName(type: .testing), product: .framework) + } + + static func testing(module: ModulePaths, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .testing, dependencies: dependencies) + .toTarget(with: module.targetName(type: .testing), product: .framework) + } + + static func testing(name: String, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .testing + } + .toTarget(with: "\(name)Testing", product: .framework) + } + + static func testing(name: String, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .testing, dependencies: dependencies) + .toTarget(with: "\(name)Testing", product: .framework) + } +} + +// MARK: - Tests +public extension Target { + static func tests(module: ModulePaths, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .unitTests + } + .toTarget(with: module.targetName(type: .unitTest), product: .unitTests) + } + + static func tests(module: ModulePaths, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .unitTests, dependencies: dependencies) + .toTarget(with: module.targetName(type: .unitTest), product: .unitTests) + } + + static func tests(name: String, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .unitTests + } + .toTarget(with: "\(name)Tests", product: .unitTests) + } + + static func tests(name: String, dependencies: [TargetDependency] = []) -> Target { + TargetSpec(sources: .unitTests, dependencies: dependencies) + .toTarget(with: "\(name)Tests", product: .unitTests) + } +} + +// MARK: - Example +public extension Target { + static func example(module: ModulePaths, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .exampleSource + $0.settings = .settings( + base: spec.settings?.base ?? [:], + configurations: .default, + defaultSettings: spec.settings?.defaultSettings ?? .recommended + ) + $0.dependencies = spec.dependencies + $0.infoPlist = spec.infoPlist ?? .extendingDefault(with: [ + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen", + "ENABLE_TESTS": .boolean(true), + ]) + } + .toTarget(with: module.targetName(type: .example), product: .app) + } + + static func example(module: ModulePaths, dependencies: [TargetDependency] = []) -> Target { + TargetSpec( + infoPlist: .extendingDefault(with: [ + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen", + "ENABLE_TESTS": .boolean(true), + ]), + sources: .exampleSource, + dependencies: dependencies + ) + .toTarget(with: module.targetName(type: .example), product: .app) + } + + static func example(name: String, spec: TargetSpec) -> Target { + spec.with { + $0.sources = .exampleSource + $0.settings = .settings( + base: spec.settings?.base ?? [:], + configurations: .default, + defaultSettings: spec.settings?.defaultSettings ?? .recommended + ) + $0.dependencies = spec.dependencies + $0.infoPlist = spec.infoPlist ?? .extendingDefault(with: [ + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen", + "ENABLE_TESTS": .boolean(true), + ]) + } + .toTarget(with: "\(name)Example", product: .app) + } + + static func example(name: String, dependencies: [TargetDependency] = []) -> Target { + TargetSpec( + infoPlist: .extendingDefault(with: [ + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen", + "ENABLE_TESTS": .boolean(true), + ]), + sources: .exampleSource, + dependencies: dependencies + ) + .toTarget(with: "\(name)Example", product: .app) + } +} diff --git a/Tuist/ProjectDescriptionHelpers/Target/TargetSpec.swift b/Tuist/ProjectDescriptionHelpers/Target/TargetSpec.swift new file mode 100644 index 0000000..f92e16e --- /dev/null +++ b/Tuist/ProjectDescriptionHelpers/Target/TargetSpec.swift @@ -0,0 +1,112 @@ +import ConfigurationPlugin +import EnvironmentPlugin +import ProjectDescription + +public struct TargetSpec: Configurable { + public var name: String + public var destinations: Destinations + public var product: Product + public var productName: String? + public var bundleId: String? + public var deploymentTargets: DeploymentTargets? + public var infoPlist: InfoPlist? + public var sources: SourceFilesList? + public var resources: ResourceFileElements? + public var copyFiles: [CopyFilesAction]? + public var headers: Headers? + public var entitlements: Entitlements? + public var scripts: [TargetScript] + public var dependencies: [TargetDependency] + public var settings: Settings? + public var coreDataModels: [CoreDataModel] + public var environmentVariables: [String: EnvironmentVariable] + public var launchArguments: [LaunchArgument] + public var additionalFiles: [FileElement] + public var buildRules: [BuildRule] + public var mergedBinaryType: MergedBinaryType + public var mergeable: Bool + + public init( + name: String = "", + destinations: Destinations = env.destinations, + product: Product = .staticLibrary, + productName: String? = nil, + bundleId: String? = nil, + deploymentTargets: DeploymentTargets? = env.deploymentTargets, + infoPlist: InfoPlist = .default, + sources: SourceFilesList? = .sources, + resources: ResourceFileElements? = nil, + copyFiles: [CopyFilesAction]? = nil, + headers: Headers? = nil, + entitlements: Entitlements? = nil, + scripts: [TargetScript] = generateEnvironment.scripts, + dependencies: [TargetDependency] = [], + settings: Settings? = nil, + coreDataModels: [CoreDataModel] = [], + environmentVariables: [String: EnvironmentVariable] = [:], + launchArguments: [LaunchArgument] = [], + additionalFiles: [FileElement] = [], + buildRules: [BuildRule] = [], + mergedBinaryType: MergedBinaryType = .disabled, + mergeable: Bool = false + ) { + self.name = name + self.destinations = destinations + self.product = product + self.productName = productName + self.bundleId = bundleId + self.deploymentTargets = deploymentTargets + self.infoPlist = infoPlist + self.sources = sources + self.resources = resources + self.copyFiles = copyFiles + self.headers = headers + self.entitlements = entitlements + self.scripts = scripts + self.dependencies = dependencies + self.settings = settings + self.coreDataModels = coreDataModels + self.environmentVariables = environmentVariables + self.launchArguments = launchArguments + self.additionalFiles = additionalFiles + self.buildRules = buildRules + self.mergedBinaryType = mergedBinaryType + self.mergeable = mergeable + } + + func toTarget() -> Target { + self.toTarget(with: self.name) + } + + func toTarget(with name: String, product: Product? = nil) -> Target { + Target.target( + name: name, + destinations: destinations, + product: product ?? self.product, + productName: productName, + bundleId: bundleId ?? "\(env.organizationName).\(name)", + deploymentTargets: deploymentTargets, + infoPlist: infoPlist, + sources: sources, + resources: resources, + copyFiles: copyFiles, + headers: headers, + entitlements: entitlements, + scripts: scripts, + dependencies: dependencies, + settings: settings ?? .settings( + base: env.baseSetting + .merging((product ?? self.product) == .framework ? .allLoadLDFlages : .ldFlages), + configurations: .default, + defaultSettings: .recommended + ), + coreDataModels: coreDataModels, + environmentVariables: environmentVariables, + launchArguments: launchArguments, + additionalFiles: additionalFiles, + buildRules: buildRules, + mergedBinaryType: mergedBinaryType, + mergeable: mergeable + ) + } +} diff --git a/Tuist/Template/Example/Example.swift b/Tuist/Template/Example/Example.swift new file mode 100644 index 0000000..48eed36 --- /dev/null +++ b/Tuist/Template/Example/Example.swift @@ -0,0 +1,23 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's example target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Sources/AppDelegate.swift", + templatePath: "ExampleSources.stencil" + ), + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Resources/LaunchScreen.storyboard", + templatePath: "ExampleResources.stencil" + ) + ] +) + diff --git a/Tuist/Template/Example/ExampleResources.stencil b/Tuist/Template/Example/ExampleResources.stencil new file mode 100644 index 0000000..de95d56 --- /dev/null +++ b/Tuist/Template/Example/ExampleResources.stencil @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tuist/Template/Example/ExampleSources.stencil b/Tuist/Template/Example/ExampleSources.stencil new file mode 100644 index 0000000..ef2bae0 --- /dev/null +++ b/Tuist/Template/Example/ExampleSources.stencil @@ -0,0 +1,19 @@ +import UIKit + +@main +final class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let viewController = UIViewController() + viewController.view.backgroundColor = .yellow + window?.rootViewController = viewController + window?.makeKeyAndVisible() + + return true + } +} diff --git a/Tuist/Template/Interface/Interface.stencil b/Tuist/Template/Interface/Interface.stencil new file mode 100644 index 0000000..9f44cbf --- /dev/null +++ b/Tuist/Template/Interface/Interface.stencil @@ -0,0 +1 @@ +// This is For Tuist diff --git a/Tuist/Template/Interface/Interface.swift b/Tuist/Template/Interface/Interface.swift new file mode 100644 index 0000000..3e518fa --- /dev/null +++ b/Tuist/Template/Interface/Interface.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's interface target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Interface/Interface.swift", + templatePath: "Interface.stencil" + ) + ] +) diff --git a/Tuist/Template/Module/Module.swift b/Tuist/Template/Module/Module.swift new file mode 100644 index 0000000..285b33a --- /dev/null +++ b/Tuist/Template/Module/Module.swift @@ -0,0 +1,24 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") +private let targetAttribute = Template.Attribute.required("target") + +private let template = Template( + description: "A template for a new module", + attributes: [ + layerAttribute, + nameAttribute, + targetAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Source.swift", + templatePath: "Sources.stencil" + ), + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Project.swift", + templatePath: "Project.stencil" + ) + ] +) diff --git a/Tuist/Template/Module/Project.stencil b/Tuist/Template/Module/Project.stencil new file mode 100644 index 0000000..9089b37 --- /dev/null +++ b/Tuist/Template/Module/Project.stencil @@ -0,0 +1,8 @@ +import DependencyPlugin +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project.module( + name: ModulePaths.{{ layer }}.{{ name }}.rawValue, + targets: {{ target }} +) diff --git a/Tuist/Template/Module/Sources.stencil b/Tuist/Template/Module/Sources.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Tuist/Template/Module/Sources.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Tuist/Template/Sources/Sources.stencil b/Tuist/Template/Sources/Sources.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Tuist/Template/Sources/Sources.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Tuist/Template/Sources/Sources.swift b/Tuist/Template/Sources/Sources.swift new file mode 100644 index 0000000..989374a --- /dev/null +++ b/Tuist/Template/Sources/Sources.swift @@ -0,0 +1,19 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's sources target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Sources.swift", + templatePath: "Sources.stencil" + ) + ] +) + diff --git a/Tuist/Template/Testing/Testing.stencil b/Tuist/Template/Testing/Testing.stencil new file mode 100644 index 0000000..b1853ce --- /dev/null +++ b/Tuist/Template/Testing/Testing.stencil @@ -0,0 +1 @@ +// This is for Tuist diff --git a/Tuist/Template/Testing/Testing.swift b/Tuist/Template/Testing/Testing.swift new file mode 100644 index 0000000..e945d0a --- /dev/null +++ b/Tuist/Template/Testing/Testing.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's testing target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Testing/Testing.swift", + templatePath: "Testing.stencil" + ) + ] +) diff --git a/Tuist/Template/Tests/Tests.stencil b/Tuist/Template/Tests/Tests.stencil new file mode 100644 index 0000000..a6a1c65 --- /dev/null +++ b/Tuist/Template/Tests/Tests.stencil @@ -0,0 +1,11 @@ +import XCTest + +final class {{ name }}Tests: XCTestCase { + override func setUpWithError() throws {} + + override func tearDownWithError() throws {} + + func testExample() { + XCTAssertEqual(1, 1) + } +} diff --git a/Tuist/Template/Tests/Tests.swift b/Tuist/Template/Tests/Tests.swift new file mode 100644 index 0000000..09d79c9 --- /dev/null +++ b/Tuist/Template/Tests/Tests.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's unit test target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/Tests/\(nameAttribute)Test.swift", + templatePath: "Tests.stencil" + ), + ] +) diff --git a/Tuist/Template/UITests/UITests.stencil b/Tuist/Template/UITests/UITests.stencil new file mode 100644 index 0000000..2a0cbf0 --- /dev/null +++ b/Tuist/Template/UITests/UITests.stencil @@ -0,0 +1,11 @@ +import XCTest + +final class {{ name }}Tests: XCTestCase { + override func setUpWithError() throws {} + + override func tearDownWithError() throws {} + + func testExample() throws { + XCTAssertEqual("A", "A") + } +} diff --git a/Tuist/Template/UITests/UITests.swift b/Tuist/Template/UITests/UITests.swift new file mode 100644 index 0000000..716ef24 --- /dev/null +++ b/Tuist/Template/UITests/UITests.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +private let layerAttribute = Template.Attribute.required("layer") +private let nameAttribute = Template.Attribute.required("name") + +private let template = Template( + description: "A template for a new module's ui test target", + attributes: [ + layerAttribute, + nameAttribute + ], + items: [ + .file( + path: "Projects/\(layerAttribute)/\(nameAttribute)/UITests/\(nameAttribute)UITests.swift", + templatePath: "UITests.stencil" + ), + ] +) diff --git a/Workspace.swift b/Workspace.swift new file mode 100644 index 0000000..9e367d2 --- /dev/null +++ b/Workspace.swift @@ -0,0 +1,9 @@ +import ProjectDescription +import EnvironmentPlugin + +let workspace = Workspace( + name: env.name, + projects: [ + "Projects/App" + ] +) diff --git a/XCConfig/App/DEV.xcconfig b/XCConfig/App/DEV.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/App/DEV.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/App/PROD.xcconfig b/XCConfig/App/PROD.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/App/PROD.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/App/STAGE.xcconfig b/XCConfig/App/STAGE.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/App/STAGE.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/Networking/DEV.xcconfig b/XCConfig/Networking/DEV.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/Networking/DEV.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/Networking/PROD.xcconfig b/XCConfig/Networking/PROD.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/Networking/PROD.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/Networking/STAGE.xcconfig b/XCConfig/Networking/STAGE.xcconfig new file mode 100644 index 0000000..9a6ff93 --- /dev/null +++ b/XCConfig/Networking/STAGE.xcconfig @@ -0,0 +1 @@ +#include "../Shared.xcconfig" \ No newline at end of file diff --git a/XCConfig/Shared.xcconfig b/XCConfig/Shared.xcconfig new file mode 100644 index 0000000..45986ab --- /dev/null +++ b/XCConfig/Shared.xcconfig @@ -0,0 +1,5 @@ +OTHER_SWIFT_FLAGS[config=DEV][sdk=*] = $(inherited) -DDEV +OTHER_SWIFT_FLAGS[config=STAGE][sdk=*] = $(inherited) -DSTAGE +OTHER_SWIFT_FLAGS[config=PROD][sdk=*] = $(inherited) -DPROD + +ENABLE_BITCODE = NO From 919ac31a4ed1576f6deb430f7f013fc0bda1593e Mon Sep 17 00:00:00 2001 From: uuuunseo Date: Tue, 20 Aug 2024 15:25:44 +0900 Subject: [PATCH 2/2] :fire: :: Remove Template Files --- Makefile | 12 - Plugin/TemplatePlugin/Plugin.swift | 3 - .../Templates/Example/Example.swift | 22 -- .../Example/ExampleResources.stencil | 25 -- .../Templates/Example/ExampleSources.stencil | 19 -- .../Templates/Interface/Interface.stencil | 1 - .../Templates/Interface/Interface.swift | 18 - .../Templates/Module/Module.swift | 24 -- .../Templates/Module/Project.stencil | 8 - .../Templates/Module/Sources.stencil | 1 - .../Templates/Sources/Sources.stencil | 1 - .../Templates/Sources/Sources.swift | 18 - .../Templates/Testing/Testing.stencil | 1 - .../Templates/Testing/Testing.swift | 18 - .../Templates/Tests/Tests.stencil | 11 - .../Templates/Tests/Tests.swift | 18 - .../Templates/UITests/UITests.stencil | 11 - .../Templates/UITests/UITests.swift | 18 - .../GenerateFeature/Interface/Interface.swift | 1 - Scripts/GenerateFeature/Project.swift | 10 - Scripts/GenerateFeature/Sources/Feature.swift | 1 - Scripts/GenerateFeature/Testing/Testing.swift | 1 - Scripts/GenerateFeature/Tests/.gitkeep | 0 .../GenerateFeature/Tests/TargetTest.swift | 17 - Scripts/GenerateFeature/UITests/.gitkeep | 0 .../GenerateFeature/UITests/TargetTest.swift | 17 - Scripts/GenerateModule.swift | 313 ------------------ .../Example/Resources/LaunchScreen.storyboard | 25 -- .../Example/Sources/AppDelegate.swift | 20 -- Scripts/NewDependency.swift | 79 ----- Tuist/Template/Example/Example.swift | 23 -- .../Template/Example/ExampleResources.stencil | 26 -- Tuist/Template/Example/ExampleSources.stencil | 19 -- Tuist/Template/Interface/Interface.stencil | 1 - Tuist/Template/Interface/Interface.swift | 18 - Tuist/Template/Module/Module.swift | 24 -- Tuist/Template/Module/Project.stencil | 8 - Tuist/Template/Module/Sources.stencil | 1 - Tuist/Template/Sources/Sources.stencil | 1 - Tuist/Template/Sources/Sources.swift | 19 -- Tuist/Template/Testing/Testing.stencil | 1 - Tuist/Template/Testing/Testing.swift | 18 - Tuist/Template/Tests/Tests.stencil | 11 - Tuist/Template/Tests/Tests.swift | 18 - Tuist/Template/UITests/UITests.stencil | 11 - Tuist/Template/UITests/UITests.swift | 18 - 46 files changed, 930 deletions(-) delete mode 100644 Plugin/TemplatePlugin/Plugin.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Example/Example.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Interface/Interface.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Interface/Interface.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Module/Module.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Module/Project.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Module/Sources.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Sources/Sources.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Sources/Sources.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Testing/Testing.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Testing/Testing.swift delete mode 100644 Plugin/TemplatePlugin/Templates/Tests/Tests.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/Tests/Tests.swift delete mode 100644 Plugin/TemplatePlugin/Templates/UITests/UITests.stencil delete mode 100644 Plugin/TemplatePlugin/Templates/UITests/UITests.swift delete mode 100644 Scripts/GenerateFeature/Interface/Interface.swift delete mode 100644 Scripts/GenerateFeature/Project.swift delete mode 100644 Scripts/GenerateFeature/Sources/Feature.swift delete mode 100644 Scripts/GenerateFeature/Testing/Testing.swift delete mode 100644 Scripts/GenerateFeature/Tests/.gitkeep delete mode 100644 Scripts/GenerateFeature/Tests/TargetTest.swift delete mode 100644 Scripts/GenerateFeature/UITests/.gitkeep delete mode 100644 Scripts/GenerateFeature/UITests/TargetTest.swift delete mode 100644 Scripts/GenerateModule.swift delete mode 100644 Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard delete mode 100644 Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift delete mode 100644 Scripts/NewDependency.swift delete mode 100644 Tuist/Template/Example/Example.swift delete mode 100644 Tuist/Template/Example/ExampleResources.stencil delete mode 100644 Tuist/Template/Example/ExampleSources.stencil delete mode 100644 Tuist/Template/Interface/Interface.stencil delete mode 100644 Tuist/Template/Interface/Interface.swift delete mode 100644 Tuist/Template/Module/Module.swift delete mode 100644 Tuist/Template/Module/Project.stencil delete mode 100644 Tuist/Template/Module/Sources.stencil delete mode 100644 Tuist/Template/Sources/Sources.stencil delete mode 100644 Tuist/Template/Sources/Sources.swift delete mode 100644 Tuist/Template/Testing/Testing.stencil delete mode 100644 Tuist/Template/Testing/Testing.swift delete mode 100644 Tuist/Template/Tests/Tests.stencil delete mode 100644 Tuist/Template/Tests/Tests.swift delete mode 100644 Tuist/Template/UITests/UITests.stencil delete mode 100644 Tuist/Template/UITests/UITests.swift diff --git a/Makefile b/Makefile index c050c3f..1d68553 100644 --- a/Makefile +++ b/Makefile @@ -18,15 +18,3 @@ reset: tuist clean rm -rf **/*.xcodeproj rm -rf *.xcworkspace - -module: - swift Scripts/GenerateModule.swift - -dependency: - swift Scripts/NewDependency.swift - -init: - swift Scripts/InitEnvironment.swift - -signing: - swift Scripts/CodeSigning.swift diff --git a/Plugin/TemplatePlugin/Plugin.swift b/Plugin/TemplatePlugin/Plugin.swift deleted file mode 100644 index 61a20da..0000000 --- a/Plugin/TemplatePlugin/Plugin.swift +++ /dev/null @@ -1,3 +0,0 @@ -import ProjectDescription - -let templatePlugin = Plugin(name: "TemplatePlugin") diff --git a/Plugin/TemplatePlugin/Templates/Example/Example.swift b/Plugin/TemplatePlugin/Templates/Example/Example.swift deleted file mode 100644 index 7126a2f..0000000 --- a/Plugin/TemplatePlugin/Templates/Example/Example.swift +++ /dev/null @@ -1,22 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's example target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Sources/AppDelegate.swift", - templatePath: "ExampleSources.stencil" - ), - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Resources/LaunchScreen.storyboard", - templatePath: "ExampleResources.stencil" - ) - ] -) diff --git a/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil b/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil deleted file mode 100644 index 865e932..0000000 --- a/Plugin/TemplatePlugin/Templates/Example/ExampleResources.stencil +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil b/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil deleted file mode 100644 index ef2bae0..0000000 --- a/Plugin/TemplatePlugin/Templates/Example/ExampleSources.stencil +++ /dev/null @@ -1,19 +0,0 @@ -import UIKit - -@main -final class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil - ) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .yellow - window?.rootViewController = viewController - window?.makeKeyAndVisible() - - return true - } -} diff --git a/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil b/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Plugin/TemplatePlugin/Templates/Interface/Interface.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Interface/Interface.swift b/Plugin/TemplatePlugin/Templates/Interface/Interface.swift deleted file mode 100644 index 3e518fa..0000000 --- a/Plugin/TemplatePlugin/Templates/Interface/Interface.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's interface target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Interface/Interface.swift", - templatePath: "Interface.stencil" - ) - ] -) diff --git a/Plugin/TemplatePlugin/Templates/Module/Module.swift b/Plugin/TemplatePlugin/Templates/Module/Module.swift deleted file mode 100644 index 285b33a..0000000 --- a/Plugin/TemplatePlugin/Templates/Module/Module.swift +++ /dev/null @@ -1,24 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") -private let targetAttribute = Template.Attribute.required("target") - -private let template = Template( - description: "A template for a new module", - attributes: [ - layerAttribute, - nameAttribute, - targetAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Source.swift", - templatePath: "Sources.stencil" - ), - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Project.swift", - templatePath: "Project.stencil" - ) - ] -) diff --git a/Plugin/TemplatePlugin/Templates/Module/Project.stencil b/Plugin/TemplatePlugin/Templates/Module/Project.stencil deleted file mode 100644 index 9089b37..0000000 --- a/Plugin/TemplatePlugin/Templates/Module/Project.stencil +++ /dev/null @@ -1,8 +0,0 @@ -import DependencyPlugin -import ProjectDescription -import ProjectDescriptionHelpers - -let project = Project.module( - name: ModulePaths.{{ layer }}.{{ name }}.rawValue, - targets: {{ target }} -) diff --git a/Plugin/TemplatePlugin/Templates/Module/Sources.stencil b/Plugin/TemplatePlugin/Templates/Module/Sources.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Plugin/TemplatePlugin/Templates/Module/Sources.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil b/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Plugin/TemplatePlugin/Templates/Sources/Sources.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Sources/Sources.swift b/Plugin/TemplatePlugin/Templates/Sources/Sources.swift deleted file mode 100644 index dcb8bf2..0000000 --- a/Plugin/TemplatePlugin/Templates/Sources/Sources.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's sources target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Sources.swift", - templatePath: "Sources.stencil" - ) - ] -) diff --git a/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil b/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Plugin/TemplatePlugin/Templates/Testing/Testing.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Plugin/TemplatePlugin/Templates/Testing/Testing.swift b/Plugin/TemplatePlugin/Templates/Testing/Testing.swift deleted file mode 100644 index e945d0a..0000000 --- a/Plugin/TemplatePlugin/Templates/Testing/Testing.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's testing target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Testing/Testing.swift", - templatePath: "Testing.stencil" - ) - ] -) diff --git a/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil b/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil deleted file mode 100644 index a6a1c65..0000000 --- a/Plugin/TemplatePlugin/Templates/Tests/Tests.stencil +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest - -final class {{ name }}Tests: XCTestCase { - override func setUpWithError() throws {} - - override func tearDownWithError() throws {} - - func testExample() { - XCTAssertEqual(1, 1) - } -} diff --git a/Plugin/TemplatePlugin/Templates/Tests/Tests.swift b/Plugin/TemplatePlugin/Templates/Tests/Tests.swift deleted file mode 100644 index 09d79c9..0000000 --- a/Plugin/TemplatePlugin/Templates/Tests/Tests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's unit test target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Tests/\(nameAttribute)Test.swift", - templatePath: "Tests.stencil" - ), - ] -) diff --git a/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil b/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil deleted file mode 100644 index 2a0cbf0..0000000 --- a/Plugin/TemplatePlugin/Templates/UITests/UITests.stencil +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest - -final class {{ name }}Tests: XCTestCase { - override func setUpWithError() throws {} - - override func tearDownWithError() throws {} - - func testExample() throws { - XCTAssertEqual("A", "A") - } -} diff --git a/Plugin/TemplatePlugin/Templates/UITests/UITests.swift b/Plugin/TemplatePlugin/Templates/UITests/UITests.swift deleted file mode 100644 index 716ef24..0000000 --- a/Plugin/TemplatePlugin/Templates/UITests/UITests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's ui test target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/UITests/\(nameAttribute)UITests.swift", - templatePath: "UITests.stencil" - ), - ] -) diff --git a/Scripts/GenerateFeature/Interface/Interface.swift b/Scripts/GenerateFeature/Interface/Interface.swift deleted file mode 100644 index 8d35d5c..0000000 --- a/Scripts/GenerateFeature/Interface/Interface.swift +++ /dev/null @@ -1 +0,0 @@ -// This is for the feature diff --git a/Scripts/GenerateFeature/Project.swift b/Scripts/GenerateFeature/Project.swift deleted file mode 100644 index ed80e04..0000000 --- a/Scripts/GenerateFeature/Project.swift +++ /dev/null @@ -1,10 +0,0 @@ -//import ProjectDescription -//import ProjectDescriptionHelpers -// -//let project = Project.staticFramework( -// name: "Feature", -// dependencies: [ -// .Project.Features.Feature -// ] -//) - diff --git a/Scripts/GenerateFeature/Sources/Feature.swift b/Scripts/GenerateFeature/Sources/Feature.swift deleted file mode 100644 index 8d35d5c..0000000 --- a/Scripts/GenerateFeature/Sources/Feature.swift +++ /dev/null @@ -1 +0,0 @@ -// This is for the feature diff --git a/Scripts/GenerateFeature/Testing/Testing.swift b/Scripts/GenerateFeature/Testing/Testing.swift deleted file mode 100644 index 8d35d5c..0000000 --- a/Scripts/GenerateFeature/Testing/Testing.swift +++ /dev/null @@ -1 +0,0 @@ -// This is for the feature diff --git a/Scripts/GenerateFeature/Tests/.gitkeep b/Scripts/GenerateFeature/Tests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Scripts/GenerateFeature/Tests/TargetTest.swift b/Scripts/GenerateFeature/Tests/TargetTest.swift deleted file mode 100644 index b1cf794..0000000 --- a/Scripts/GenerateFeature/Tests/TargetTest.swift +++ /dev/null @@ -1,17 +0,0 @@ -import XCTest - -class TargetTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - XCTAssertEqual("A", "A") - } - -} diff --git a/Scripts/GenerateFeature/UITests/.gitkeep b/Scripts/GenerateFeature/UITests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Scripts/GenerateFeature/UITests/TargetTest.swift b/Scripts/GenerateFeature/UITests/TargetTest.swift deleted file mode 100644 index b1cf794..0000000 --- a/Scripts/GenerateFeature/UITests/TargetTest.swift +++ /dev/null @@ -1,17 +0,0 @@ -import XCTest - -class TargetTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - XCTAssertEqual("A", "A") - } - -} diff --git a/Scripts/GenerateModule.swift b/Scripts/GenerateModule.swift deleted file mode 100644 index 61de0aa..0000000 --- a/Scripts/GenerateModule.swift +++ /dev/null @@ -1,313 +0,0 @@ -#!/usr/bin/swift -import Foundation - -func handleSIGINT(_ signal: Int32) { - exit(0) -} - -signal(SIGINT, handleSIGINT) - -enum LayerType: String { - case feature = "Feature" - case domain = "Domain" - case core = "Core" - case shared = "Shared" - case userInterface = "UserInterface" -} - -enum MicroTargetType: String { - case interface = "Interface" - case sources = "" - case testing = "Testing" - case unitTest = "Tests" - case uiTest = "UITests" - case example = "Example" -} - -struct ModuleInfo { - let moduleName: String - let hasInterface: Bool - let hasTesting: Bool - let hasUnitTests: Bool - let hasUITests: Bool - let hasExample: Bool -} - -let fileManager = FileManager.default -let currentPath = "./" -let bash = Bash() - -func registerModuleDependency() { - registerModulePaths() - makeProjectDirectory() - registerXCConfig() - - let layerPrefix = layer.rawValue.lowercased() - let moduleEnum = ".\(layerPrefix)(.\(moduleName))" - var targetString = "[\n" - if hasInterface { - makeScaffold(target: .interface) - targetString += "\(tab(2)).interface(module: \(moduleEnum)),\n" - } - targetString += "\(tab(2)).implements(module: \(moduleEnum)" - if hasInterface { - targetString += ", dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName), type: .interface)\n\(tab(2))])" - } else { - targetString += ")" - } - if hasTesting { - makeScaffold(target: .testing) - let interfaceDependency = ".\(layerPrefix)(target: .\(moduleName), type: .interface)" - targetString += ",\n\(tab(2)).testing(module: \(moduleEnum), dependencies: [\n\(tab(3))\(interfaceDependency)\n\(tab(2))])" - } - if hasUnitTests { - makeScaffold(target: .unitTest) - targetString += ",\n\(tab(2)).tests(module: \(moduleEnum), dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName))\n\(tab(2))])" - } - if hasUITests { - makeScaffold(target: .uiTest) - // TODO: - ui test 타겟 설정 로직 추가 - } - if hasExample { - makeScaffold(target: .example) - targetString += ",\n\(tab(2)).example(module: \(moduleEnum), dependencies: [\n\(tab(3)).\(layerPrefix)(target: .\(moduleName))\n\(tab(2))])" - } - targetString += "\n\(tab(1))]" - makeProjectSwift(targetString: targetString) - makeSourceScaffold() -} - -func tab(_ count: Int) -> String { - var tabString = "" - for _ in 0.. ModuleInfo { - print("Enter module name", terminator: " : ") - let moduleInput = readLine() - guard let moduleNameUnwrapping = moduleInput, !moduleNameUnwrapping.isEmpty else { - print("Module name is empty") - exit(1) - } - let moduleName = moduleNameUnwrapping - print("Module name: \(moduleName)\n") - - print("This module has a 'Interface' Target? (y\\n, default = n)", terminator: " : ") - let hasInterface = readLine()?.lowercased() == "y" - - print("This module has a 'Testing' Target? (y\\n, default = n)", terminator: " : ") - let hasTesting = readLine()?.lowercased() == "y" - - print("This module has a 'UnitTests' Target? (y\\n, default = n)", terminator: " : ") - let hasUnitTests = readLine()?.lowercased() == "y" - - print("This module has a 'UITests' Target? (y\\n, default = n)", terminator: " : ") - let hasUITests = readLine()?.lowercased() == "y" - - print("This module has a 'Example' Target? (y\\n, default = n)", terminator: " : ") - let hasExample = readLine()?.lowercased() == "y" - - return ModuleInfo( - moduleName: moduleName, - hasInterface: hasInterface, - hasTesting: hasTesting, - hasUnitTests: hasUnitTests, - hasUITests: hasUITests, - hasExample: hasExample - ) -} - -func checkModuleInfo() -> Bool { - print("") - print("------------------------------------------------------------------------------------------------------------------------") - print("Is this the correct module information you are generating? (y\\n, default = y)") - print("Layer: \(layer.rawValue)") - print("Module name: \(moduleName)") - print("interface: \(hasInterface), testing: \(hasTesting), unitTests: \(hasUnitTests), uiTests: \(hasUITests), example: \(hasExample)") - print("------------------------------------------------------------------------------------------------------------------------") - - guard var checkInput = readLine() else { - exit(1) - } - - if checkInput.isEmpty { - checkInput = "y" - } - - let isCorrect = checkInput.lowercased() == "y" - return !isCorrect -} - -// MARK: - Starting point - -print("Enter layer name\n(Feature | Domain | Core | Shared | UserInterface)", terminator: " : ") -let layerInput = readLine() -guard - let layerInput, - !layerInput.isEmpty, - let layerUnwrapping = LayerType(rawValue: layerInput) -else { - print("Layer is empty or invalid") - exit(1) -} -let layer = layerUnwrapping -print("Layer: \(layer.rawValue)\n") - -var moduleName: String = "" -var hasInterface: Bool = false -var hasTesting: Bool = false -var hasUnitTests: Bool = false -var hasUITests: Bool = false -var hasExample: Bool = false - -repeat { - let moduleInfo = makeModuleInfo() - moduleName = moduleInfo.moduleName - hasInterface = moduleInfo.hasInterface - hasTesting = moduleInfo.hasTesting - hasUnitTests = moduleInfo.hasUnitTests - hasUITests = moduleInfo.hasUITests - hasExample = moduleInfo.hasExample -} -while checkModuleInfo() - -registerModuleDependency() - -print("✅ Module is created successfully!") - -// MARK: - Bash -protocol CommandExecuting { - func run(commandName: String, arguments: [String]) throws -> String -} - -enum BashError: Error { - case commandNotFound(name: String) -} - -struct Bash: CommandExecuting { - func run(commandName: String, arguments: [String] = []) throws -> String { - return try run(resolve(commandName), with: arguments) - } - - private func resolve(_ command: String) throws -> String { - guard var bashCommand = try? run("/bin/bash", with: ["-l", "-c", "which \(command)"]) else { - throw BashError.commandNotFound(name: command) - } - bashCommand = bashCommand.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines) - return bashCommand - } - - private func run(_ command: String, with arguments: [String] = []) throws -> String { - let process = Process() - process.launchPath = command - process.arguments = arguments - let outputPipe = Pipe() - process.standardOutput = outputPipe - process.launch() - let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile() - let output = String(decoding: outputData, as: UTF8.self) - return output - } -} diff --git a/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard b/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard deleted file mode 100644 index 865e932..0000000 --- a/Scripts/GenerateModuleExampleSource/Example/Resources/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift b/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift deleted file mode 100644 index d30d117..0000000 --- a/Scripts/GenerateModuleExampleSource/Example/Sources/AppDelegate.swift +++ /dev/null @@ -1,20 +0,0 @@ -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil - ) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .yellow - window?.rootViewController = viewController - window?.makeKeyAndVisible() - - return true - } -} diff --git a/Scripts/NewDependency.swift b/Scripts/NewDependency.swift deleted file mode 100644 index f096855..0000000 --- a/Scripts/NewDependency.swift +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/swift -import Foundation - -func handleSIGINT(_ signal: Int32) { - exit(0) -} - -signal(SIGINT, handleSIGINT) - - let currentPath = "./" - - func updateFileContent( - filePath: String, - finding findingString: String, - inserting insertString: String - ) { - let fileURL = URL(fileURLWithPath: filePath) - guard let readHandle = try? FileHandle(forReadingFrom: fileURL) else { - fatalError("❌ Failed to find \(filePath)") - } - guard let readData = try? readHandle.readToEnd() else { - fatalError("❌ Failed to find \(filePath)") - } - try? readHandle.close() - - guard var fileString = String(data: readData, encoding: .utf8) else { fatalError() } - fileString.insert(contentsOf: insertString, at: fileString.range(of: findingString)?.upperBound ?? fileString.endIndex) - - guard let writeHandle = try? FileHandle(forWritingTo: fileURL) else { - fatalError("❌ Failed to find \(filePath)") - } - writeHandle.seek(toFileOffset: 0) - try? writeHandle.write(contentsOf: Data(fileString.utf8)) - try? writeHandle.close() - } - - func registerDependenciesSwift(url: String, version: String) { - let filePath = currentPath + "Package.swift" - let findingString = " dependencies: [\n" - let inserting = " .package(url: \"\(url)\", from: \"\(version)\"),\n" - updateFileContent(filePath: filePath, finding: findingString, inserting: inserting) - } - - func registerDependencySPM(name: String, package: String) { - let filePath = currentPath + "Plugin/DependencyPlugin/ProjectDescriptionHelpers/Dependency+SPM.swift" - let findingString = "public extension TargetDependency.SPM {\n" - let inserting = " static let \(name) = TargetDependency.external(name: \"\(package)\")\n" - updateFileContent(filePath: filePath, finding: findingString, inserting: inserting) - } - - func registerDependency(name: String, package: String, url: String, version: String) { - registerDependenciesSwift(url: url, version: version) - registerDependencySPM(name: name, package: package) - } - - print("Enter dependency name", terminator: " : ") - guard let dependencyName = readLine() else { - fatalError("Dependency name is nil") - } - - print("Enter package name", terminator: " : ") - guard let packageName = readLine() else { - fatalError("Package name is nil") - } - - print("Enter dependency github URL", terminator: " : ") - guard let dependencyURL = readLine() else { - fatalError("Dependency URL is nil") - } - - print("Enter dependency version", terminator: " : ") - guard let dependencyVersion = readLine() else { - fatalError("Dependency version is nil") - } - - registerDependency(name: dependencyName, package: packageName, url: dependencyURL, version: dependencyVersion) - - print("") - print("✅ New Dependency is registered successfully!") diff --git a/Tuist/Template/Example/Example.swift b/Tuist/Template/Example/Example.swift deleted file mode 100644 index 48eed36..0000000 --- a/Tuist/Template/Example/Example.swift +++ /dev/null @@ -1,23 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's example target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Sources/AppDelegate.swift", - templatePath: "ExampleSources.stencil" - ), - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Example/Resources/LaunchScreen.storyboard", - templatePath: "ExampleResources.stencil" - ) - ] -) - diff --git a/Tuist/Template/Example/ExampleResources.stencil b/Tuist/Template/Example/ExampleResources.stencil deleted file mode 100644 index de95d56..0000000 --- a/Tuist/Template/Example/ExampleResources.stencil +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tuist/Template/Example/ExampleSources.stencil b/Tuist/Template/Example/ExampleSources.stencil deleted file mode 100644 index ef2bae0..0000000 --- a/Tuist/Template/Example/ExampleSources.stencil +++ /dev/null @@ -1,19 +0,0 @@ -import UIKit - -@main -final class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil - ) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .yellow - window?.rootViewController = viewController - window?.makeKeyAndVisible() - - return true - } -} diff --git a/Tuist/Template/Interface/Interface.stencil b/Tuist/Template/Interface/Interface.stencil deleted file mode 100644 index 9f44cbf..0000000 --- a/Tuist/Template/Interface/Interface.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is For Tuist diff --git a/Tuist/Template/Interface/Interface.swift b/Tuist/Template/Interface/Interface.swift deleted file mode 100644 index 3e518fa..0000000 --- a/Tuist/Template/Interface/Interface.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's interface target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Interface/Interface.swift", - templatePath: "Interface.stencil" - ) - ] -) diff --git a/Tuist/Template/Module/Module.swift b/Tuist/Template/Module/Module.swift deleted file mode 100644 index 285b33a..0000000 --- a/Tuist/Template/Module/Module.swift +++ /dev/null @@ -1,24 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") -private let targetAttribute = Template.Attribute.required("target") - -private let template = Template( - description: "A template for a new module", - attributes: [ - layerAttribute, - nameAttribute, - targetAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Source.swift", - templatePath: "Sources.stencil" - ), - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Project.swift", - templatePath: "Project.stencil" - ) - ] -) diff --git a/Tuist/Template/Module/Project.stencil b/Tuist/Template/Module/Project.stencil deleted file mode 100644 index 9089b37..0000000 --- a/Tuist/Template/Module/Project.stencil +++ /dev/null @@ -1,8 +0,0 @@ -import DependencyPlugin -import ProjectDescription -import ProjectDescriptionHelpers - -let project = Project.module( - name: ModulePaths.{{ layer }}.{{ name }}.rawValue, - targets: {{ target }} -) diff --git a/Tuist/Template/Module/Sources.stencil b/Tuist/Template/Module/Sources.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Tuist/Template/Module/Sources.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Tuist/Template/Sources/Sources.stencil b/Tuist/Template/Sources/Sources.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Tuist/Template/Sources/Sources.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Tuist/Template/Sources/Sources.swift b/Tuist/Template/Sources/Sources.swift deleted file mode 100644 index 989374a..0000000 --- a/Tuist/Template/Sources/Sources.swift +++ /dev/null @@ -1,19 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's sources target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Sources/Sources.swift", - templatePath: "Sources.stencil" - ) - ] -) - diff --git a/Tuist/Template/Testing/Testing.stencil b/Tuist/Template/Testing/Testing.stencil deleted file mode 100644 index b1853ce..0000000 --- a/Tuist/Template/Testing/Testing.stencil +++ /dev/null @@ -1 +0,0 @@ -// This is for Tuist diff --git a/Tuist/Template/Testing/Testing.swift b/Tuist/Template/Testing/Testing.swift deleted file mode 100644 index e945d0a..0000000 --- a/Tuist/Template/Testing/Testing.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's testing target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Testing/Testing.swift", - templatePath: "Testing.stencil" - ) - ] -) diff --git a/Tuist/Template/Tests/Tests.stencil b/Tuist/Template/Tests/Tests.stencil deleted file mode 100644 index a6a1c65..0000000 --- a/Tuist/Template/Tests/Tests.stencil +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest - -final class {{ name }}Tests: XCTestCase { - override func setUpWithError() throws {} - - override func tearDownWithError() throws {} - - func testExample() { - XCTAssertEqual(1, 1) - } -} diff --git a/Tuist/Template/Tests/Tests.swift b/Tuist/Template/Tests/Tests.swift deleted file mode 100644 index 09d79c9..0000000 --- a/Tuist/Template/Tests/Tests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's unit test target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/Tests/\(nameAttribute)Test.swift", - templatePath: "Tests.stencil" - ), - ] -) diff --git a/Tuist/Template/UITests/UITests.stencil b/Tuist/Template/UITests/UITests.stencil deleted file mode 100644 index 2a0cbf0..0000000 --- a/Tuist/Template/UITests/UITests.stencil +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest - -final class {{ name }}Tests: XCTestCase { - override func setUpWithError() throws {} - - override func tearDownWithError() throws {} - - func testExample() throws { - XCTAssertEqual("A", "A") - } -} diff --git a/Tuist/Template/UITests/UITests.swift b/Tuist/Template/UITests/UITests.swift deleted file mode 100644 index 716ef24..0000000 --- a/Tuist/Template/UITests/UITests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ProjectDescription - -private let layerAttribute = Template.Attribute.required("layer") -private let nameAttribute = Template.Attribute.required("name") - -private let template = Template( - description: "A template for a new module's ui test target", - attributes: [ - layerAttribute, - nameAttribute - ], - items: [ - .file( - path: "Projects/\(layerAttribute)/\(nameAttribute)/UITests/\(nameAttribute)UITests.swift", - templatePath: "UITests.stencil" - ), - ] -)