From 3959b6cd393f9fc036ab44f0968889c744094931 Mon Sep 17 00:00:00 2001 From: Daniele Formichelli Date: Sat, 12 Feb 2022 19:09:57 +0100 Subject: [PATCH] Refactor/move options (#4131) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: rename `-Project` scheme to `-Workspace` * docs: update changelog * feat: rename BuildGraphInspecting.projectSchemes * feat: add support for configuring code coverage and testing options at the project level * refactor: move workspace scheme generation options to workspace manifest * fix: fix fixture * chore: formatting * chore: formatting * docs: documentation * chore: remove empty Config * feat: change automatic schemes generation to byName * fix: remove schemes from Tuist project description helpers * fix: fix test * fix: fix test * fix: test * fix: fix cache-frameworks acceptance test * fix: acceptance * fix: fix acceptance test * refactor: use struct for Project.Options * docs: add changelog entry * refactor: use static func instead of init for Project.Options * fix: disable automatic Xcode schemes for project editor * refactor: move Workspace.GenerationOptions to separate file * chore: formatting * fix: fix meta tuist * fix: fix tuist meta * fix: fix project manifest dump test * fix: fix project manifest dump test * fix: generate missing workspace intermediate folder if needed * fix: fix lockfiles * fix: fix fixtures * chore: format * fix: fix test compilation error * refactor: make enableXcodeSchemes a Bool? * fix: fix ios_app_with_custom_workspace fixture * docs: update docs * refactor: more Workspace.GenerationOptions to separate file * fix: fix tests * chore: formattings * refactor: change Config.generationOptions to be a struct * fix: fix fixtures * fix: fix compilation error * fix: compilation error * docs: changelog * docs: fix docs * fix: test compilation error * fix: fix generate-3 fixture * fix: fix test * fix: fix tuist dump config test * fix: fix test * docs: fix doc Co-authored-by: Marek Fořt * chore: fix warnings * refactor: move xcodeProjectName from Config.options to Project.options * Revert "refactor: move xcodeProjectName from Config.options to Project.options" This reverts commit 067bb7a48ea66caecb3144b36140ff47c79f4a56. * refactor: move disableShowEnvironmentVarsInScriptPhases from Config.options to Project.options * feat: move lastXcodeUpgradeCheck to Workspace.options * refactor: remove xcodeProjectName, organizationName, and developmentRegion from Config.generationOptions * docs: changelog * refactor: remove Config where not needed * chore: invalidate GitHub action .build cache * Revert "chore: invalidate GitHub action .build cache" This reverts commit 91d3b78c2bfab24cfd6558b9973b8408c4a61dfe. * Revert "chore: fix warnings" This reverts commit 3021a7ba2f532750d727dd394d4b9d08128cf454. * fix: compilation error * fix: fix fixtures * fix: fix broken tests * chore: remove unused templateMacros * feat: add back `developmentRegion` and `xcodeProjectName` * chore: format * chore: format * Use forcedCacheDirectory even without Config.swift * fix: fix tests * fix: fix fixture Co-authored-by: Marek Fořt --- CHANGELOG.md | 17 ++-- .../ConfigGenerationOptions.swift | 30 +------ .../ProjectDescription/ProjectOptions.swift | 19 +++- .../WorkspaceGenerationOptions.swift | 10 ++- .../SchemeDescriptorsGenerator.swift | 2 +- .../LastUpgradeVersionWorkspaceMapper.swift | 13 ++- ...ctionDisableShowEnvVarsProjectMapper.swift | 22 +++++ .../TargetActionEnvironmentMapper.swift | 23 ----- Sources/TuistGraph/Models/Config.swift | 7 +- .../Models/ConfigGenerationOptions.swift | 28 +----- Sources/TuistGraph/Models/Project.swift | 4 +- .../TuistGraph/Models/ProjectOptions.swift | 5 ++ Sources/TuistGraph/Models/Workspace.swift | 17 ++-- .../Models/WorkspaceGenerationOptions.swift | 10 ++- .../Models/Config+TestData.swift | 14 +-- .../Models/Project+TestData.swift | 14 +-- .../Models/ProjectOptions+TestData.swift | 2 + .../Models/Workspace+TestData.swift | 23 +++-- .../TuistKit/Generator/GeneratorFactory.swift | 25 ++---- .../Factories/ProjectMapperFactory.swift | 22 ++--- .../Factories/WorkspaceMapperFactory.swift | 30 +++---- .../ProjectEditor/ProjectEditorMapper.swift | 5 +- Sources/TuistKit/Services/BuildService.swift | 8 +- .../Cache/CachePrintHashesService.swift | 2 +- Sources/TuistKit/Services/RunService.swift | 9 +- .../ProjectDevelopmentRegionMapper.swift | 29 ------ .../ProjectNameAndOrganizationMapper.swift | 39 -------- .../Config+ManifestMapper.swift | 7 +- .../Project+ManifestMapper.swift | 6 +- .../ProjectOption+ManifestMapper.swift | 1 + ...paceGenerationOptions+ManifestMapper.swift | 3 +- .../ProjectDescriptionTests/ConfigTests.swift | 7 +- .../Utilities/TargetRunnerTests.swift | 4 +- .../SchemeDescriptorsGeneratorTests.swift | 2 +- .../WorkspaceDescriptorGeneratorTests.swift | 6 +- ...paceSettingsDescriptorGeneratorTests.swift | 4 +- ...dWorkspaceSchemeWorkspaceMapperTests.swift | 43 +++------ .../Linter/GraphLinterTests.swift | 18 ++-- ...stUpgradeVersionWorkspaceMapperTests.swift | 15 ++-- ...isableShowEnvVarsProjectMapperTests.swift} | 14 ++- .../WorkspaceGenerationOptionsTests.swift | 5 +- .../Models/WorkspaceTests.swift | 12 --- ...ltipleConfigurationsIntegrationTests.swift | 2 +- .../DumpServiceIntegrationTests.swift | 2 +- .../Mocks/MockGeneratorFactory.swift | 6 +- .../Factories/ProjectMapperFactoryTests.swift | 83 +++-------------- .../WorkspaceMapperFactoryTests.swift | 60 ++++--------- .../Services/RunServiceTests.swift | 4 +- .../Loaders/ConfigLoaderTests.swift | 8 +- .../ProjectDevelopmentRegionMapperTests.swift | 38 -------- ...rojectNameAndOrganizationMapperTests.swift | 55 ------------ .../Project+ManifestMapperTests.swift | 89 +++++++++++++++++++ ...nerationOptions+ManifestWrapperTests.swift | 45 ++++++++-- projects/docs/docs/manifests/config.md | 5 -- projects/docs/docs/manifests/project.md | 5 +- projects/docs/docs/manifests/workspace.md | 9 +- projects/tuist/features/generate-1.feature | 8 -- projects/tuist/fixtures/README.md | 8 -- .../App/AppDelegate.swift | 19 ---- .../Config.swift | 7 -- .../Info.plist | 43 --------- .../Project.swift | 21 ----- .../.gitignore | 63 ------------- .../App/AppDelegate.swift | 19 ---- .../Config.swift | 5 -- .../Info.plist | 43 --------- .../Project.swift | 21 ----- .../fixtures/ios_app_large/Tuist/Config.swift | 5 -- .../App With Space/Project.swift | 1 + .../App/Project.swift | 1 + .../ios_app_with_env_suppressed/Config.swift | 5 -- .../Tuist/Config.swift | 5 -- .../Tuist/Config.swift | 6 -- 73 files changed, 380 insertions(+), 887 deletions(-) create mode 100644 Sources/TuistGenerator/Mappers/TargetActionDisableShowEnvVarsProjectMapper.swift delete mode 100644 Sources/TuistGenerator/Mappers/TargetActionEnvironmentMapper.swift delete mode 100644 Sources/TuistLoader/Mappers/ProjectDevelopmentRegionMapper.swift delete mode 100644 Sources/TuistLoader/Mappers/ProjectNameAndOrganizationMapper.swift rename Tests/TuistGeneratorTests/ProjectMappers/{ConfigShowEnvironmentMapperTests.swift => TargetActionDisableShowEnvVarsProjectMapperTests.swift} (82%) delete mode 100644 Tests/TuistLoaderTests/Mappers/ProjectDevelopmentRegionMapperTests.swift delete mode 100644 Tests/TuistLoaderTests/Mappers/ProjectNameAndOrganizationMapperTests.swift create mode 100644 Tests/TuistLoaderTests/Models+ManifestMappers/Project+ManifestMapperTests.swift delete mode 100644 projects/tuist/fixtures/app_with_development_region_config/App/AppDelegate.swift delete mode 100644 projects/tuist/fixtures/app_with_development_region_config/Config.swift delete mode 100644 projects/tuist/fixtures/app_with_development_region_config/Info.plist delete mode 100644 projects/tuist/fixtures/app_with_development_region_config/Project.swift delete mode 100644 projects/tuist/fixtures/app_with_organization_name_config/.gitignore delete mode 100644 projects/tuist/fixtures/app_with_organization_name_config/App/AppDelegate.swift delete mode 100644 projects/tuist/fixtures/app_with_organization_name_config/Config.swift delete mode 100644 projects/tuist/fixtures/app_with_organization_name_config/Info.plist delete mode 100644 projects/tuist/fixtures/app_with_organization_name_config/Project.swift delete mode 100644 projects/tuist/fixtures/ios_app_large/Tuist/Config.swift delete mode 100644 projects/tuist/fixtures/ios_app_with_env_suppressed/Config.swift delete mode 100644 projects/tuist/fixtures/ios_app_with_frameworks/Tuist/Config.swift delete mode 100644 projects/tuist/fixtures/ios_app_with_headers_in_one_dir/Tuist/Config.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 68d57fdb4..a90d17f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ - **Breaking** Tuist plugins 2.0 [#3492](https://github.com/tuist/tuist/pull/3492) by [@fortmarek](https://github.com/fortmarek) - **Breaking** `tuist generate` automatically opens the generated project. [#3912](https://github.com/tuist/tuist/pull/3912) by [@danyf90](https://github.com/danyf90): - **Motivation:**: Most of the times you want to open the project after generating it. - - **Migration:** If you need to generate the project without openeing it, just pass `--no-open` to `tuist generate`. + - **Migration:** If you need to generate the project without opening it, just pass `--no-open` to `tuist generate`. - **Breaking** add `type` parameter to `TargetDependency.sdk` [#3961](https://github.com/tuist/tuist/pull/3961) by [@danyf90](https://github.com/danyf90) - **Migration:** Add the `type` parameter where defining `sdk` target dependencies and remove both the extension and the `lib` prefix from the name - **Breaking** move `disableBundleAccessors` and `disableSynthesizedResourceAccessors` from `Config.swift` to `Project.ProjectOption` [#3963](https://github.com/tuist/tuist/pull/3963) by [@danyf90](https://github.com/danyf90). @@ -34,6 +34,14 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ - **Motivation**: A struct better represents the semantic of the type - **Breaking** refactor `Config.generationOptions` to be a `struct` instead of an `enum` [#4109](https://github.com/tuist/tuist/pull/4109) by [@danyf90](https://github.com/danyf90) - **Motivation**: A struct better represents the semantic of the type +- **Breaking** remove `xcodeProjectName`, `organizationName`, and `developmentRegion` from `Config.GenerationOptions` [#4131](https://github.com/tuist/tuist/pull/4131) by [@danyf90](https://github.com/danyf90) + - **Migration**: Configure them in `Project` instead or define helpers to share the value across projects +- **Breaking** move `Config.GenerationOptions.disableShowEnvironmentVarsInScriptPhases` to `Project.Options` [#4131](https://github.com/tuist/tuist/pull/4131) by [@danyf90](https://github.com/danyf90) + - **Motivation**: It is related to the project generation + - **Migration**: Configure it in `Project.Options` instead +- **Breaking** move `Config.GenerationOptions.lastXcodeUpgradeCheck` to `Workspace.GenerationOptions` [#4131](https://github.com/tuist/tuist/pull/4131) by [@danyf90](https://github.com/danyf90) + - **Motivation**: It is related to the workspace generation + - **Migration**: Configure it in `Worksapace.GenerrationOptions` instead - Add support for configuring code coverage and testing options at the project level [#4090](https://github.com/tuist/tuist/pull/4090) by [@danyf90](https://github.com/danyf90) - Add more detailed messaging for errors during manifest loading [#4076](https://github.com/tuist/tuist/pull/4076) by [@luispadron](https://github.com/luispadron) - Deprecate legacy SPM support via Project.packages [#4112](https://github.com/tuist/tuist/pull/4112) by [@danyf90](https://github.com/danyf90) @@ -57,6 +65,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ - Fix `tuist graph --skip-external-dependencies` for `Dependencies.swift` dependencies [#4115](https://github.com/tuist/tuist/pull/4115) by [@danyf90](https://github.com/danyf90) & [#4124](https://github.com/tuist/tuist/pull/4124) by [@laxmorek](https://github.com/laxmorek) - Fix `envversion` command not printing the tuist env version [#4126](https://github.com/tuist/tuist/pull/4126) by [@takinwande](https://github.com/takinwande) - Fix warning when importing `ProjectDescription` during `tuist edit`. It was caused by `.swiftsourceinfo` files being added to the release artifact [#4132](https://github.com/tuist/tuist/pull/4132) by [@luispadron](https://github.com/luispadron) +- Remove default MacCatalyst support when framework deployment target is set to iOS and/or iPad [#4134](https://github.com/tuist/tuist/pull/4134) by [@TheInkedEngineer](https://github.com/TheInkedEngineer) ### Added @@ -74,9 +83,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ ### Changed -- Use GitHub tags (via `git ls-remote`) to determine the latest Tuist version when installing/updating Tuist [#3985](https://github.com/tuist/tuist/pull/3985) by [@ezraberch](https://github.com/ezraberch) - -- Remove default MacCatalyst support when framework deployment target is set to iOS and/or iPad [#4134](https://github.com/tuist/tuist/pull/4134) by [@TheInkedEngineer](https://github.com/TheInkedEngineer) +- Use GitHub tags (via `git ls-remote`) to determine the latest Tuist version when installing/updating Tuist [#3985](https://github.com/tuist/tuist/pull/3985) by [@ezraberch](https://github.com/ezraberch) ### Added @@ -1603,7 +1610,7 @@ let baseSettings = SettingsDictionary() - **Breaking** Allow specifying a deployment target within project manifests [#541](https://github.com/tuist/tuist/pull/541) [@mollyIV](https://github.com/mollyIV). - Add support for sticker pack extension & app extension products [#489](https://github.com/tuist/tuist/pull/489) by @Rag0n - Utility to locate the root directory of a project [#622](https://github.com/tuist/tuist/pull/622) by [@pepibumur](https://github.com/pepibumur). -- Adds `codeCoverageTargets` to `TestAction` to make XCode gather coverage info only for that targets [#619](https://github.com/tuist/tuist/pull/619) by @abbasmousavi +- Adds `codeCoverageTargets` to `TestAction` to make Xcode gather coverage info only for that targets [#619](https://github.com/tuist/tuist/pull/619) by @abbasmousavi - Enable the library evololution for the ProjectDescription framework [#625](https://github.com/tuist/tuist/pull/625) by [@pepibumur](https://github.com/pepibumur). - Add support for watchOS apps [#623](https://github.com/tuist/tuist/pull/623) by [@kwridan](https://github.com/kwridan) - Add linting for duplicate dependencies [#629](https://github.com/tuist/tuist/pull/629) by @lakpa diff --git a/Sources/ProjectDescription/ConfigGenerationOptions.swift b/Sources/ProjectDescription/ConfigGenerationOptions.swift index 19a390d4c..07c6aca60 100644 --- a/Sources/ProjectDescription/ConfigGenerationOptions.swift +++ b/Sources/ProjectDescription/ConfigGenerationOptions.swift @@ -1,18 +1,6 @@ extension Config { /// Contains options related to the project generation. public struct GenerationOptions: Codable, Equatable { - /// Tuist generates the project with the specific name on disk instead of using the project name. - public let xcodeProjectName: TemplateString? - - /// Tuist generates the project with the specific organization name. - public let organizationName: String? - - /// Tuist generates the project with the specific development region. - public let developmentRegion: String? - - /// Tuist disables echoing the ENV in shell script build phases - public let disableShowEnvironmentVarsInScriptPhases: Bool - /// When passed, Xcode will resolve its Package Manager dependencies using the system-defined /// accounts (for example, git) instead of the Xcode-defined accounts public let resolveDependenciesWithSystemScm: Bool @@ -21,27 +9,13 @@ extension Config { /// in their declarations. public let disablePackageVersionLocking: Bool - /// Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. - /// It is recommended to set the version option to Xcode's version that is used for development of a project, for example `.lastUpgradeCheck(Version(13, 0, 0))` for Xcode 13.0.0. - public let lastXcodeUpgradeCheck: Version? - public static func options( - xcodeProjectName: TemplateString? = nil, - organizationName: String? = nil, - developmentRegion: String? = nil, - disableShowEnvironmentVarsInScriptPhases: Bool = false, resolveDependenciesWithSystemScm: Bool = false, - disablePackageVersionLocking: Bool = false, - lastXcodeUpgradeCheck: Version? = nil + disablePackageVersionLocking: Bool = false ) -> Self { self.init( - xcodeProjectName: xcodeProjectName, - organizationName: organizationName, - developmentRegion: developmentRegion, - disableShowEnvironmentVarsInScriptPhases: disableShowEnvironmentVarsInScriptPhases, resolveDependenciesWithSystemScm: resolveDependenciesWithSystemScm, - disablePackageVersionLocking: disablePackageVersionLocking, - lastXcodeUpgradeCheck: lastXcodeUpgradeCheck + disablePackageVersionLocking: disablePackageVersionLocking ) } } diff --git a/Sources/ProjectDescription/ProjectOptions.swift b/Sources/ProjectDescription/ProjectOptions.swift index d9698123e..947ba47d6 100644 --- a/Sources/ProjectDescription/ProjectOptions.swift +++ b/Sources/ProjectDescription/ProjectOptions.swift @@ -6,26 +6,41 @@ extension Project { /// Defines how to generate automatic schemes public let automaticSchemesOptions: AutomaticSchemesOptions + /// Tuist generates the project with the specific development region. + public let developmentRegion: String? + /// Disables generating Bundle accessors. public let disableBundleAccessors: Bool + /// Tuist disables echoing the ENV in shell script build phases + public let disableShowEnvironmentVarsInScriptPhases: Bool + /// Disable the synthesized resource accessors generation public let disableSynthesizedResourceAccessors: Bool /// Text settings to override user ones for current project public let textSettings: TextSettings + /// Tuist generates the project with the specific name on disk instead of using the project name. + public let xcodeProjectName: String? + public static func options( automaticSchemesOptions: AutomaticSchemesOptions = .enabled(), + developmentRegion: String? = nil, disableBundleAccessors: Bool = false, + disableShowEnvironmentVarsInScriptPhases: Bool = false, disableSynthesizedResourceAccessors: Bool = false, - textSettings: TextSettings = .textSettings() + textSettings: TextSettings = .textSettings(), + xcodeProjectName: String? = nil ) -> Self { self.init( automaticSchemesOptions: automaticSchemesOptions, + developmentRegion: developmentRegion, disableBundleAccessors: disableBundleAccessors, + disableShowEnvironmentVarsInScriptPhases: disableShowEnvironmentVarsInScriptPhases, disableSynthesizedResourceAccessors: disableSynthesizedResourceAccessors, - textSettings: textSettings + textSettings: textSettings, + xcodeProjectName: xcodeProjectName ) } } diff --git a/Sources/ProjectDescription/WorkspaceGenerationOptions.swift b/Sources/ProjectDescription/WorkspaceGenerationOptions.swift index f3adccd3f..f665dab9b 100644 --- a/Sources/ProjectDescription/WorkspaceGenerationOptions.swift +++ b/Sources/ProjectDescription/WorkspaceGenerationOptions.swift @@ -27,13 +27,19 @@ extension Workspace { /// Contains options for autogenerated workspace schemes public let autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes + /// Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. + /// It is recommended to set the version option to Xcode's version that is used for development of a project, for example `.lastXcodeUpgradeCheck(Version(13, 0, 0))` for Xcode 13.0.0. + public let lastXcodeUpgradeCheck: Version? + public static func options( enableAutomaticXcodeSchemes: Bool? = false, - autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes = .enabled() + autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes = .enabled(), + lastXcodeUpgradeCheck: Version? = nil ) -> Self { GenerationOptions( enableAutomaticXcodeSchemes: enableAutomaticXcodeSchemes, - autogeneratedWorkspaceSchemes: autogeneratedWorkspaceSchemes + autogeneratedWorkspaceSchemes: autogeneratedWorkspaceSchemes, + lastXcodeUpgradeCheck: lastXcodeUpgradeCheck ) } } diff --git a/Sources/TuistGenerator/Generator/SchemeDescriptorsGenerator.swift b/Sources/TuistGenerator/Generator/SchemeDescriptorsGenerator.swift index 441673936..38334eb95 100644 --- a/Sources/TuistGenerator/Generator/SchemeDescriptorsGenerator.swift +++ b/Sources/TuistGenerator/Generator/SchemeDescriptorsGenerator.swift @@ -75,7 +75,7 @@ final class SchemeDescriptorsGenerator: SchemeDescriptorsGenerating { path: workspace.xcWorkspacePath.parentDirectory, graphTraverser: graphTraverser, generatedProjects: generatedProjects, - lastUpgradeCheck: workspace.lastUpgradeCheck + lastUpgradeCheck: workspace.generationOptions.lastXcodeUpgradeCheck ) } diff --git a/Sources/TuistGenerator/Mappers/LastUpgradeVersionWorkspaceMapper.swift b/Sources/TuistGenerator/Mappers/LastUpgradeVersionWorkspaceMapper.swift index 318301eed..481bd1d9f 100644 --- a/Sources/TuistGenerator/Mappers/LastUpgradeVersionWorkspaceMapper.swift +++ b/Sources/TuistGenerator/Mappers/LastUpgradeVersionWorkspaceMapper.swift @@ -3,20 +3,19 @@ import TSCUtility import TuistCore public final class LastUpgradeVersionWorkspaceMapper: WorkspaceMapping { - let lastUpgradeVersion: Version - - public init(lastUpgradeVersion: Version) { - self.lastUpgradeVersion = lastUpgradeVersion - } + public init() {} // MARK: - WorkspaceMapping public func map(workspace: WorkspaceWithProjects) throws -> (WorkspaceWithProjects, [SideEffectDescriptor]) { + guard let lastXcodeUpgradeCheck = workspace.workspace.generationOptions.lastXcodeUpgradeCheck else { + return (workspace, []) + } + var projects = workspace.projects - projects.indices.forEach { projects[$0].lastUpgradeCheck = lastUpgradeVersion } + projects.indices.forEach { projects[$0].lastUpgradeCheck = projects[$0].lastUpgradeCheck ?? lastXcodeUpgradeCheck } var workspace = workspace - workspace.workspace.lastUpgradeCheck = lastUpgradeVersion workspace.projects = projects return (workspace, []) diff --git a/Sources/TuistGenerator/Mappers/TargetActionDisableShowEnvVarsProjectMapper.swift b/Sources/TuistGenerator/Mappers/TargetActionDisableShowEnvVarsProjectMapper.swift new file mode 100644 index 000000000..e907b69f7 --- /dev/null +++ b/Sources/TuistGenerator/Mappers/TargetActionDisableShowEnvVarsProjectMapper.swift @@ -0,0 +1,22 @@ +import TuistCore +import TuistGraph + +/// This mapper takes the `Project` `disableShowEnvironmentVarsInScriptPhases` option and pushes it down into all of the `Target`s shell script `TargetAction`s +public final class TargetActionDisableShowEnvVarsProjectMapper: ProjectMapping { + public init() {} + + public func map(project: Project) throws -> (Project, [SideEffectDescriptor]) { + var project = project + project.targets = project.targets.map { target in + var mappedTarget = target + mappedTarget.scripts = mappedTarget.scripts.map { + var script = $0 + script.showEnvVarsInLog = !project.options.disableShowEnvironmentVarsInScriptPhases + return script + } + return mappedTarget + } + + return (project, []) + } +} diff --git a/Sources/TuistGenerator/Mappers/TargetActionEnvironmentMapper.swift b/Sources/TuistGenerator/Mappers/TargetActionEnvironmentMapper.swift deleted file mode 100644 index 2a3eb2d18..000000000 --- a/Sources/TuistGenerator/Mappers/TargetActionEnvironmentMapper.swift +++ /dev/null @@ -1,23 +0,0 @@ -import TuistCore -import TuistGraph - -/// This mapper takes the `Config`level setting `disableShowEnvironmentVarsInScriptPhases` and pushes it down into all of the `Project`'s shell script `TargetAction`s` - -public final class TargetActionEnvironmentMapper: TargetMapping { - let showEnvVarsInLog: Bool - - public init(_ showEnvVarsInLog: Bool) { - self.showEnvVarsInLog = showEnvVarsInLog - } - - public func map(target: Target) throws -> (Target, [SideEffectDescriptor]) { - var target = target - let scripts: [TargetScript] = target.scripts.map { - var script = $0 - script.showEnvVarsInLog = showEnvVarsInLog - return script - } - target.scripts = scripts - return (target, [SideEffectDescriptor]()) - } -} diff --git a/Sources/TuistGraph/Models/Config.swift b/Sources/TuistGraph/Models/Config.swift index c17085937..dcc9236c1 100644 --- a/Sources/TuistGraph/Models/Config.swift +++ b/Sources/TuistGraph/Models/Config.swift @@ -35,13 +35,8 @@ public struct Config: Equatable, Hashable { swiftVersion: nil, plugins: [], generationOptions: .init( - xcodeProjectName: nil, - organizationName: nil, - developmentRegion: nil, - disableShowEnvironmentVarsInScriptPhases: false, resolveDependenciesWithSystemScm: false, - disablePackageVersionLocking: false, - lastXcodeUpgradeCheck: nil + disablePackageVersionLocking: false ), path: nil ) diff --git a/Sources/TuistGraph/Models/ConfigGenerationOptions.swift b/Sources/TuistGraph/Models/ConfigGenerationOptions.swift index 9dd1a3858..ad3074d42 100644 --- a/Sources/TuistGraph/Models/ConfigGenerationOptions.swift +++ b/Sources/TuistGraph/Models/ConfigGenerationOptions.swift @@ -3,18 +3,6 @@ import TSCUtility extension Config { /// Contains options related to the project generation. public struct GenerationOptions: Codable, Hashable { - /// Tuist generates the project with the specific name on disk instead of using the project name. - public let xcodeProjectName: String? - - /// Tuist generates the project with the specific organization name. - public let organizationName: String? - - /// Tuist generates the project with the specific development region. - public let developmentRegion: String? - - /// Tuist disables echoing the ENV in shell script build phases - public let disableShowEnvironmentVarsInScriptPhases: Bool - /// When passed, Xcode will resolve its Package Manager dependencies using the system-defined /// accounts (for example, git) instead of the Xcode-defined accounts public let resolveDependenciesWithSystemScm: Bool @@ -23,26 +11,12 @@ extension Config { /// in their declarations. public let disablePackageVersionLocking: Bool - /// Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. - /// It is recommended to set the version option to Xcode's version that is used for development of a project, for example `.lastUpgradeCheck(Version(13, 0, 0))` for Xcode 13.0.0. - public let lastXcodeUpgradeCheck: Version? - public init( - xcodeProjectName: String?, - organizationName: String?, - developmentRegion: String?, - disableShowEnvironmentVarsInScriptPhases: Bool, resolveDependenciesWithSystemScm: Bool, - disablePackageVersionLocking: Bool, - lastXcodeUpgradeCheck: Version? + disablePackageVersionLocking: Bool ) { - self.xcodeProjectName = xcodeProjectName - self.organizationName = organizationName - self.developmentRegion = developmentRegion - self.disableShowEnvironmentVarsInScriptPhases = disableShowEnvironmentVarsInScriptPhases self.resolveDependenciesWithSystemScm = resolveDependenciesWithSystemScm self.disablePackageVersionLocking = disablePackageVersionLocking - self.lastXcodeUpgradeCheck = lastXcodeUpgradeCheck } } } diff --git a/Sources/TuistGraph/Models/Project.swift b/Sources/TuistGraph/Models/Project.swift index b3cb3f439..b891cf9dc 100644 --- a/Sources/TuistGraph/Models/Project.swift +++ b/Sources/TuistGraph/Models/Project.swift @@ -18,10 +18,10 @@ public struct Project: Hashable, Equatable, CustomStringConvertible, CustomDebug public var name: String /// Organization name. - public var organizationName: String? + public let organizationName: String? /// Development region code e.g. `en`. - public var developmentRegion: String? + public let developmentRegion: String? /// Additional project options. public var options: Options diff --git a/Sources/TuistGraph/Models/ProjectOptions.swift b/Sources/TuistGraph/Models/ProjectOptions.swift index a786ad6b7..3e25842b8 100644 --- a/Sources/TuistGraph/Models/ProjectOptions.swift +++ b/Sources/TuistGraph/Models/ProjectOptions.swift @@ -9,6 +9,9 @@ extension Project { /// Disables generating Bundle accessors. public let disableBundleAccessors: Bool + /// Tuist disables echoing the ENV in shell script build phases + public let disableShowEnvironmentVarsInScriptPhases: Bool + /// Disable the synthesized resource accessors generation public let disableSynthesizedResourceAccessors: Bool @@ -18,11 +21,13 @@ extension Project { public init( automaticSchemesOptions: AutomaticSchemesOptions, disableBundleAccessors: Bool, + disableShowEnvironmentVarsInScriptPhases: Bool, disableSynthesizedResourceAccessors: Bool, textSettings: TextSettings ) { self.automaticSchemesOptions = automaticSchemesOptions self.disableBundleAccessors = disableBundleAccessors + self.disableShowEnvironmentVarsInScriptPhases = disableShowEnvironmentVarsInScriptPhases self.disableSynthesizedResourceAccessors = disableSynthesizedResourceAccessors self.textSettings = textSettings } diff --git a/Sources/TuistGraph/Models/Workspace.swift b/Sources/TuistGraph/Models/Workspace.swift index 462cbfbab..74884504c 100644 --- a/Sources/TuistGraph/Models/Workspace.swift +++ b/Sources/TuistGraph/Models/Workspace.swift @@ -14,7 +14,6 @@ public struct Workspace: Equatable, Codable { public var schemes: [Scheme] public var ideTemplateMacros: IDETemplateMacros? public var additionalFiles: [FileElement] - public var lastUpgradeCheck: Version? public var generationOptions: GenerationOptions // MARK: - Init @@ -27,11 +26,11 @@ public struct Workspace: Equatable, Codable { schemes: [Scheme] = [], generationOptions: GenerationOptions = .init( enableAutomaticXcodeSchemes: false, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) + autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []), + lastXcodeUpgradeCheck: nil ), ideTemplateMacros: IDETemplateMacros? = nil, - additionalFiles: [FileElement] = [], - lastUpgradeCheck: Version? = nil + additionalFiles: [FileElement] = [] ) { self.path = path self.xcWorkspacePath = xcWorkspacePath @@ -41,7 +40,6 @@ public struct Workspace: Equatable, Codable { self.generationOptions = generationOptions self.ideTemplateMacros = ideTemplateMacros self.additionalFiles = additionalFiles - self.lastUpgradeCheck = lastUpgradeCheck } } @@ -61,8 +59,7 @@ extension Workspace { schemes: schemes, generationOptions: generationOptions, ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles + files.map { .file(path: $0) }, - lastUpgradeCheck: lastUpgradeCheck + additionalFiles: additionalFiles + files.map { .file(path: $0) } ) } @@ -75,8 +72,7 @@ extension Workspace { schemes: schemes, generationOptions: generationOptions, ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles, - lastUpgradeCheck: lastUpgradeCheck + additionalFiles: additionalFiles ) } @@ -89,8 +85,7 @@ extension Workspace { schemes: schemes, generationOptions: generationOptions, ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles, - lastUpgradeCheck: lastUpgradeCheck + additionalFiles: additionalFiles ) } diff --git a/Sources/TuistGraph/Models/WorkspaceGenerationOptions.swift b/Sources/TuistGraph/Models/WorkspaceGenerationOptions.swift index b9ff6b621..5cb764319 100644 --- a/Sources/TuistGraph/Models/WorkspaceGenerationOptions.swift +++ b/Sources/TuistGraph/Models/WorkspaceGenerationOptions.swift @@ -1,3 +1,5 @@ +import TSCUtility + extension Workspace { /// Contains options related to the workspace generation. public struct GenerationOptions: Codable, Equatable { @@ -45,12 +47,18 @@ extension Workspace { /// Options for autogenerated workspace schemes public let autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes + /// Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. + /// It is recommended to set the version option to Xcode's version that is used for development of a project, for example `.lastXcodeUpgradeCheck(Version(13, 0, 0))` for Xcode 13.0.0. + public let lastXcodeUpgradeCheck: Version? + public init( enableAutomaticXcodeSchemes: Bool?, - autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes + autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes, + lastXcodeUpgradeCheck: Version? ) { self.enableAutomaticXcodeSchemes = enableAutomaticXcodeSchemes self.autogeneratedWorkspaceSchemes = autogeneratedWorkspaceSchemes + self.lastXcodeUpgradeCheck = lastXcodeUpgradeCheck } } } diff --git a/Sources/TuistGraphTesting/Models/Config+TestData.swift b/Sources/TuistGraphTesting/Models/Config+TestData.swift index 16354cec5..ffb977405 100644 --- a/Sources/TuistGraphTesting/Models/Config+TestData.swift +++ b/Sources/TuistGraphTesting/Models/Config+TestData.swift @@ -27,22 +27,12 @@ extension Config { extension Config.GenerationOptions { public static func test( - xcodeProjectName: String? = nil, - organizationName: String? = nil, - developmentRegion: String? = nil, - disableShowEnvironmentVarsInScriptPhases: Bool = false, resolveDependenciesWithSystemScm: Bool = false, - disablePackageVersionLocking: Bool = false, - lastXcodeUpgradeCheck: Version? = nil + disablePackageVersionLocking: Bool = false ) -> Self { .init( - xcodeProjectName: xcodeProjectName, - organizationName: organizationName, - developmentRegion: developmentRegion, - disableShowEnvironmentVarsInScriptPhases: disableShowEnvironmentVarsInScriptPhases, resolveDependenciesWithSystemScm: resolveDependenciesWithSystemScm, - disablePackageVersionLocking: disablePackageVersionLocking, - lastXcodeUpgradeCheck: lastXcodeUpgradeCheck + disablePackageVersionLocking: disablePackageVersionLocking ) } } diff --git a/Sources/TuistGraphTesting/Models/Project+TestData.swift b/Sources/TuistGraphTesting/Models/Project+TestData.swift index 2bc3e39f4..37a67bfa7 100644 --- a/Sources/TuistGraphTesting/Models/Project+TestData.swift +++ b/Sources/TuistGraphTesting/Models/Project+TestData.swift @@ -11,12 +11,7 @@ extension Project { name: String = "Project", organizationName: String? = nil, developmentRegion: String? = nil, - options: Options = .init( - automaticSchemesOptions: .disabled, - disableBundleAccessors: false, - disableSynthesizedResourceAccessors: false, - textSettings: .init(usesTabs: nil, indentWidth: nil, tabWidth: nil, wrapsLines: nil) - ), + options: Options = .test(automaticSchemesOptions: .disabled), settings: Settings = Settings.test(), filesGroup: ProjectGroup = .group(name: "Project"), targets: [Target] = [Target.test()], @@ -54,12 +49,7 @@ extension Project { name: String = "Project", organizationName: String? = nil, developmentRegion: String? = nil, - options: Options = .init( - automaticSchemesOptions: .disabled, - disableBundleAccessors: false, - disableSynthesizedResourceAccessors: false, - textSettings: .init(usesTabs: nil, indentWidth: nil, tabWidth: nil, wrapsLines: nil) - ), + options: Options = .test(automaticSchemesOptions: .disabled), settings: Settings = .default, filesGroup: ProjectGroup = .group(name: "Project"), targets: [Target] = [], diff --git a/Sources/TuistGraphTesting/Models/ProjectOptions+TestData.swift b/Sources/TuistGraphTesting/Models/ProjectOptions+TestData.swift index ad9ce32ac..8941a0369 100644 --- a/Sources/TuistGraphTesting/Models/ProjectOptions+TestData.swift +++ b/Sources/TuistGraphTesting/Models/ProjectOptions+TestData.swift @@ -13,12 +13,14 @@ extension Project.Options { testingOptions: [] ), disableBundleAccessors: Bool = false, + disableShowEnvironmentVarsInScriptPhases: Bool = false, disableSynthesizedResourceAccessors: Bool = false, textSettings: TextSettings = .init(usesTabs: nil, indentWidth: nil, tabWidth: nil, wrapsLines: nil) ) -> Self { .init( automaticSchemesOptions: automaticSchemesOptions, disableBundleAccessors: disableBundleAccessors, + disableShowEnvironmentVarsInScriptPhases: disableShowEnvironmentVarsInScriptPhases, disableSynthesizedResourceAccessors: disableSynthesizedResourceAccessors, textSettings: textSettings ) diff --git a/Sources/TuistGraphTesting/Models/Workspace+TestData.swift b/Sources/TuistGraphTesting/Models/Workspace+TestData.swift index 9ea12ac96..f24f924b8 100644 --- a/Sources/TuistGraphTesting/Models/Workspace+TestData.swift +++ b/Sources/TuistGraphTesting/Models/Workspace+TestData.swift @@ -12,11 +12,7 @@ extension Workspace { schemes: [Scheme] = [], ideTemplateMacros: IDETemplateMacros? = nil, additionalFiles: [FileElement] = [], - lastUpgradeCheck: Version? = nil, - generationOptions: GenerationOptions = .init( - enableAutomaticXcodeSchemes: false, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) - ) + generationOptions: GenerationOptions = .test() ) -> Workspace { Workspace( path: path, @@ -26,8 +22,21 @@ extension Workspace { schemes: schemes, generationOptions: generationOptions, ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles, - lastUpgradeCheck: lastUpgradeCheck + additionalFiles: additionalFiles + ) + } +} + +extension Workspace.GenerationOptions { + public static func test( + enableAutomaticXcodeSchemes: Bool? = false, + autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes = .enabled(codeCoverageMode: .disabled, testingOptions: []), + lastXcodeUpgradeCheck: Version? = nil + ) -> Self { + .init( + enableAutomaticXcodeSchemes: enableAutomaticXcodeSchemes, + autogeneratedWorkspaceSchemes: autogeneratedWorkspaceSchemes, + lastXcodeUpgradeCheck: lastXcodeUpgradeCheck ) } } diff --git a/Sources/TuistKit/Generator/GeneratorFactory.swift b/Sources/TuistKit/Generator/GeneratorFactory.swift index 41c00b34c..71ba7f036 100644 --- a/Sources/TuistKit/Generator/GeneratorFactory.swift +++ b/Sources/TuistKit/Generator/GeneratorFactory.swift @@ -39,7 +39,7 @@ protocol GeneratorFactorying { /// Returns the default generator. /// - Parameter config: The project configuration. /// - Returns: A Generator instance. - func `default`(config: Config) -> Generating + func `default`() -> Generating /// Returns a generator that generates a cacheable project. /// - Parameter config: The project configuration. @@ -71,7 +71,7 @@ class GeneratorFactory: GeneratorFactorying { { let contentHasher = ContentHasher() let projectMapperFactory = ProjectMapperFactory(contentHasher: contentHasher) - let projectMappers = projectMapperFactory.default(config: config) + let projectMappers = projectMapperFactory.default() let workspaceMapperFactory = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMappers)) let graphMapperFactory = GraphMapperFactory(contentHasher: contentHasher) @@ -82,7 +82,7 @@ class GeneratorFactory: GeneratorFactorying { cacheProfile: cacheProfile, cacheOutputType: xcframeworks ? .xcframework : .framework ) - let workspaceMappers = workspaceMapperFactory.default(config: config) + let workspaceMappers = workspaceMapperFactory.default() let manifestLoader = ManifestLoaderFactory().createManifestLoader() return Generator( manifestLoader: manifestLoader, @@ -94,10 +94,6 @@ class GeneratorFactory: GeneratorFactorying { ) } - func `default`(config: Config) -> Generating { - self.default(config: config, contentHasher: ContentHasher()) - } - func test( config: Config, automationPath: AbsolutePath, @@ -106,13 +102,12 @@ class GeneratorFactory: GeneratorFactorying { ) -> Generating { let contentHasher = ContentHasher() let projectMapperFactory = ProjectMapperFactory(contentHasher: contentHasher) - let projectMappers = projectMapperFactory.automation(config: config, skipUITests: skipUITests) + let projectMappers = projectMapperFactory.automation(skipUITests: skipUITests) let workspaceMapperFactory = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMappers)) let graphMapperFactory = GraphMapperFactory(contentHasher: contentHasher) let graphMappers = graphMapperFactory.automation(config: config, testsCacheDirectory: testsCacheDirectory) let workspaceMappers = workspaceMapperFactory.automation( - config: config, workspaceDirectory: FileHandler.shared.resolveSymlinks(automationPath) ) let manifestLoader = ManifestLoaderFactory().createManifestLoader() @@ -135,7 +130,7 @@ class GeneratorFactory: GeneratorFactorying { ) -> Generating { let contentHasher = ContentHasher() let projectMapperFactory = ProjectMapperFactory(contentHasher: contentHasher) - let projectMappers = projectMapperFactory.default(config: config) + let projectMappers = projectMapperFactory.default() let workspaceMapperFactory = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMappers)) let graphMapperFactory = GraphMapperFactory(contentHasher: contentHasher) @@ -152,7 +147,7 @@ class GeneratorFactory: GeneratorFactorying { graphMappers = graphMapperFactory.cache(includedTargets: includedTargets) } - let workspaceMappers = workspaceMapperFactory.cache(config: config, includedTargets: includedTargets) + let workspaceMappers = workspaceMapperFactory.cache(includedTargets: includedTargets) let manifestLoader = ManifestLoaderFactory().createManifestLoader() return Generator( manifestLoader: manifestLoader, @@ -164,16 +159,14 @@ class GeneratorFactory: GeneratorFactorying { ) } - // MARK: - Fileprivate - - func `default`(config: Config, contentHasher _: ContentHashing) -> Generating { + func `default`() -> Generating { let contentHasher = ContentHasher() let projectMapperFactory = ProjectMapperFactory(contentHasher: contentHasher) - let projectMappers = projectMapperFactory.default(config: config) + let projectMappers = projectMapperFactory.default() let workspaceMapperFactory = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMappers)) let graphMapperFactory = GraphMapperFactory(contentHasher: contentHasher) let graphMappers = graphMapperFactory.default() - let workspaceMappers = workspaceMapperFactory.default(config: config) + let workspaceMappers = workspaceMapperFactory.default() let manifestLoader = ManifestLoaderFactory().createManifestLoader() return Generator( manifestLoader: manifestLoader, diff --git a/Sources/TuistKit/Mappers/Factories/ProjectMapperFactory.swift b/Sources/TuistKit/Mappers/Factories/ProjectMapperFactory.swift index 14b963ec7..1798c0f86 100644 --- a/Sources/TuistKit/Mappers/Factories/ProjectMapperFactory.swift +++ b/Sources/TuistKit/Mappers/Factories/ProjectMapperFactory.swift @@ -12,13 +12,13 @@ protocol ProjectMapperFactorying { /// Returns the default project mapper. /// - Parameter config: The project configuration /// - Returns: A project mapper instance. - func `default`(config: Config) -> [ProjectMapping] + func `default`() -> [ProjectMapping] /// Returns a project mapper for automation. /// - Parameter config: The project configuration. /// - Parameter skipUITests: Whether UI tests should be skipped. /// - Returns: An instance of a project mapper. - func automation(config: Config, skipUITests: Bool) -> [ProjectMapping] + func automation(skipUITests: Bool) -> [ProjectMapping] } final class ProjectMapperFactory: ProjectMapperFactorying { @@ -28,9 +28,9 @@ final class ProjectMapperFactory: ProjectMapperFactorying { self.contentHasher = contentHasher } - func automation(config: Config, skipUITests: Bool) -> [ProjectMapping] { + func automation(skipUITests: Bool) -> [ProjectMapping] { var mappers: [ProjectMapping] = [] - mappers += self.default(config: config) + mappers += self.default() mappers.append( SourceRootPathProjectMapper() @@ -45,7 +45,7 @@ final class ProjectMapperFactory: ProjectMapperFactorying { return mappers } - func `default`(config: Config) -> [ProjectMapping] { + func `default`() -> [ProjectMapping] { var mappers: [ProjectMapping] = [] // Delete current derived @@ -59,11 +59,7 @@ final class ProjectMapperFactory: ProjectMapperFactorying { ) // Logfile noise suppression - if config.generationOptions.disableShowEnvironmentVarsInScriptPhases { - mappers.append( - TargetProjectMapper(mapper: TargetActionEnvironmentMapper(false)) - ) - } + mappers.append(TargetActionDisableShowEnvVarsProjectMapper()) // Support for resources in libraries mappers.append(ResourcesProjectMapper(contentHasher: ContentHasher())) @@ -75,12 +71,6 @@ final class ProjectMapperFactory: ProjectMapperFactorying { // Info Plist mappers.append(GenerateInfoPlistProjectMapper()) - // Project name and organization - mappers.append(ProjectNameAndOrganizationMapper(config: config)) - - // Development region - mappers.append(ProjectDevelopmentRegionMapper(config: config)) - // Template macros mappers.append(IDETemplateMacrosMapper()) diff --git a/Sources/TuistKit/Mappers/Factories/WorkspaceMapperFactory.swift b/Sources/TuistKit/Mappers/Factories/WorkspaceMapperFactory.swift index a501e3cfd..a364e95dd 100644 --- a/Sources/TuistKit/Mappers/Factories/WorkspaceMapperFactory.swift +++ b/Sources/TuistKit/Mappers/Factories/WorkspaceMapperFactory.swift @@ -9,19 +9,19 @@ import TuistGraph protocol WorkspaceMapperFactorying { /// Returns the default workspace mapper. /// - Returns: A workspace mapping instance. - func `default`(config: Config) -> [WorkspaceMapping] + func `default`() -> [WorkspaceMapping] /// Returns a mapper to generate cacheable prorjects. /// - Parameter config: The project configuration. /// - Parameter includedTargets: The list of targets to cache. /// - Returns: A workspace mapping instance. - func cache(config: Config, includedTargets: Set) -> [WorkspaceMapping] + func cache(includedTargets: Set) -> [WorkspaceMapping] /// Returns a mapper for automation commands like build and test. /// - Parameter config: The project configuration. /// - Parameter workspaceDirectory: The directory where the workspace will be generated. /// - Returns: A workspace mapping instance. - func automation(config: Config, workspaceDirectory: AbsolutePath) -> [WorkspaceMapping] + func automation(workspaceDirectory: AbsolutePath) -> [WorkspaceMapping] } final class WorkspaceMapperFactory: WorkspaceMapperFactorying { @@ -31,25 +31,25 @@ final class WorkspaceMapperFactory: WorkspaceMapperFactorying { self.projectMapper = projectMapper } - func cache(config: Config, includedTargets: Set) -> [WorkspaceMapping] { - var mappers = self.default(config: config, forceWorkspaceSchemes: false) + func cache(includedTargets: Set) -> [WorkspaceMapping] { + var mappers = self.default(forceWorkspaceSchemes: false) mappers += [GenerateCacheableSchemesWorkspaceMapper(includedTargets: includedTargets)] return mappers } - func automation(config: Config, workspaceDirectory: AbsolutePath) -> [WorkspaceMapping] { + func automation(workspaceDirectory: AbsolutePath) -> [WorkspaceMapping] { var mappers: [WorkspaceMapping] = [] mappers.append(AutomationPathWorkspaceMapper(workspaceDirectory: workspaceDirectory)) - mappers += self.default(config: config, forceWorkspaceSchemes: true) + mappers += self.default(forceWorkspaceSchemes: true) return mappers } - func `default`(config: Config) -> [WorkspaceMapping] { - self.default(config: config, forceWorkspaceSchemes: false) + func `default`() -> [WorkspaceMapping] { + self.default(forceWorkspaceSchemes: false) } - private func `default`(config: Config, forceWorkspaceSchemes: Bool) -> [WorkspaceMapping] { + private func `default`(forceWorkspaceSchemes: Bool) -> [WorkspaceMapping] { var mappers: [WorkspaceMapping] = [] mappers.append( @@ -72,13 +72,9 @@ final class WorkspaceMapperFactory: WorkspaceMapperFactorying { ModuleMapMapper() ) - if let lastUpgradeVersion = config.generationOptions.lastXcodeUpgradeCheck { - mappers.append( - LastUpgradeVersionWorkspaceMapper( - lastUpgradeVersion: lastUpgradeVersion - ) - ) - } + mappers.append( + LastUpgradeVersionWorkspaceMapper() + ) return mappers } diff --git a/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift b/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift index e131d11bd..dbaf260b5 100644 --- a/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift +++ b/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift @@ -74,7 +74,8 @@ final class ProjectEditorMapper: ProjectEditorMapping { projects: projects.map(\.path), generationOptions: .init( enableAutomaticXcodeSchemes: false, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) + autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []), + lastXcodeUpgradeCheck: nil ) ) @@ -254,6 +255,7 @@ final class ProjectEditorMapper: ProjectEditorMapping { options: .init( automaticSchemesOptions: .disabled, disableBundleAccessors: true, + disableShowEnvironmentVarsInScriptPhases: false, disableSynthesizedResourceAccessors: true, textSettings: .init(usesTabs: nil, indentWidth: nil, tabWidth: nil, wrapsLines: nil) ), @@ -345,6 +347,7 @@ final class ProjectEditorMapper: ProjectEditorMapping { options: .init( automaticSchemesOptions: .disabled, disableBundleAccessors: true, + disableShowEnvironmentVarsInScriptPhases: false, disableSynthesizedResourceAccessors: true, textSettings: .init(usesTabs: nil, indentWidth: nil, tabWidth: nil, wrapsLines: nil) ), diff --git a/Sources/TuistKit/Services/BuildService.swift b/Sources/TuistKit/Services/BuildService.swift index 7ea626199..122b4aa79 100644 --- a/Sources/TuistKit/Services/BuildService.swift +++ b/Sources/TuistKit/Services/BuildService.swift @@ -38,18 +38,15 @@ final class BuildService { private let generatorFactory: GeneratorFactorying private let buildGraphInspector: BuildGraphInspecting private let targetBuilder: TargetBuilding - private let configLoader: ConfigLoading init( generatorFactory: GeneratorFactorying = GeneratorFactory(), buildGraphInspector: BuildGraphInspecting = BuildGraphInspector(), - targetBuilder: TargetBuilding = TargetBuilder(), - configLoader: ConfigLoading = ConfigLoader(manifestLoader: ManifestLoader()) + targetBuilder: TargetBuilding = TargetBuilder() ) { self.generatorFactory = generatorFactory self.buildGraphInspector = buildGraphInspector self.targetBuilder = targetBuilder - self.configLoader = configLoader } // swiftlint:disable:next function_body_length @@ -62,8 +59,7 @@ final class BuildService { path: AbsolutePath ) async throws { let graph: Graph - let config = try configLoader.loadConfig(path: path) - let generator = generatorFactory.default(config: config) + let generator = generatorFactory.default() if try (generate || buildGraphInspector.workspacePath(directory: path) == nil) { graph = try await generator.generateWithGraph(path: path).1 } else { diff --git a/Sources/TuistKit/Services/Cache/CachePrintHashesService.swift b/Sources/TuistKit/Services/Cache/CachePrintHashesService.swift index 3d48f3ea7..d3a5f636d 100644 --- a/Sources/TuistKit/Services/Cache/CachePrintHashesService.swift +++ b/Sources/TuistKit/Services/Cache/CachePrintHashesService.swift @@ -45,7 +45,7 @@ final class CachePrintHashesService { let absolutePath = absolutePath(path) let timer = clock.startTimer() let config = try configLoader.loadConfig(path: absolutePath) - let generator = generatorFactory.default(config: config) + let generator = generatorFactory.default() let graph = try await generator.load(path: absolutePath) let cacheOutputType: CacheOutputType = xcframeworks ? .xcframework : .framework let cacheProfile = try CacheProfileResolver().resolveCacheProfile(named: profile, from: config) diff --git a/Sources/TuistKit/Services/RunService.swift b/Sources/TuistKit/Services/RunService.swift index 2db6c3b5c..c752b5739 100644 --- a/Sources/TuistKit/Services/RunService.swift +++ b/Sources/TuistKit/Services/RunService.swift @@ -44,21 +44,17 @@ final class RunService { private let buildGraphInspector: BuildGraphInspecting private let targetBuilder: TargetBuilding private let targetRunner: TargetRunning - private let configLoader: ConfigLoading init( generatorFactory: GeneratorFactorying = GeneratorFactory(), buildGraphInspector: BuildGraphInspecting = BuildGraphInspector(), targetBuilder: TargetBuilding = TargetBuilder(), - targetRunner: TargetRunning = TargetRunner(), - configLoader: ConfigLoading = ConfigLoader(manifestLoader: ManifestLoader()) - + targetRunner: TargetRunning = TargetRunner() ) { self.generatorFactory = generatorFactory self.buildGraphInspector = buildGraphInspector self.targetBuilder = targetBuilder self.targetRunner = targetRunner - self.configLoader = configLoader } // swiftlint:disable:next function_body_length @@ -80,8 +76,7 @@ final class RunService { } let graph: Graph - let config = try self.configLoader.loadConfig(path: runPath) - let generator = generatorFactory.default(config: config) + let generator = generatorFactory.default() if try (generate || buildGraphInspector.workspacePath(directory: runPath) == nil) { logger.notice("Generating project for running", metadata: .section) graph = try await generator.generateWithGraph(path: runPath).1 diff --git a/Sources/TuistLoader/Mappers/ProjectDevelopmentRegionMapper.swift b/Sources/TuistLoader/Mappers/ProjectDevelopmentRegionMapper.swift deleted file mode 100644 index 7d805b156..000000000 --- a/Sources/TuistLoader/Mappers/ProjectDevelopmentRegionMapper.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import ProjectDescription -import TSCBasic -import TuistCore -import TuistGraph -import TuistSupport - -/// Mapper that changes the development region based on configuration -/// in the Config.swift -public final class ProjectDevelopmentRegionMapper: ProjectMapping { - private let config: TuistGraph.Config - - public init(config: TuistGraph.Config) { - self.config = config - } - - // MARK: - ProjectMapping - - public func map(project: TuistGraph.Project) throws -> (TuistGraph.Project, [SideEffectDescriptor]) { - var project = project - - // Xcode project development region - if let developmentRegion = config.generationOptions.developmentRegion { - project.developmentRegion = developmentRegion - } - - return (project, []) - } -} diff --git a/Sources/TuistLoader/Mappers/ProjectNameAndOrganizationMapper.swift b/Sources/TuistLoader/Mappers/ProjectNameAndOrganizationMapper.swift deleted file mode 100644 index 798ac34d3..000000000 --- a/Sources/TuistLoader/Mappers/ProjectNameAndOrganizationMapper.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import ProjectDescription -import TSCBasic -import TuistCore -import TuistGraph -import TuistSupport - -/// It's a mapper that changes the project name and organization based on the configuration -/// in the Config.swift -public class ProjectNameAndOrganizationMapper: ProjectMapping { - private let config: TuistGraph.Config - - public init(config: TuistGraph.Config) { - self.config = config - } - - // MARK: - ProjectMapping - - public func map(project: TuistGraph.Project) throws -> (TuistGraph.Project, [SideEffectDescriptor]) { - var project = project - - // Xcode project file name - if var xcodeFileName = config.generationOptions.xcodeProjectName { - let projectNameTemplate = TemplateString.Token.projectName.rawValue - xcodeFileName = xcodeFileName.replacingOccurrences( - of: projectNameTemplate, - with: project.name - ) - project.xcodeProjPath = project.xcodeProjPath.parentDirectory.appending(component: "\(xcodeFileName).xcodeproj") - } - - // Xcode project organization name - if let organizationName = config.generationOptions.organizationName { - project.organizationName = organizationName - } - - return (project, []) - } -} diff --git a/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift index edcdd3df6..cf53cb663 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift @@ -51,13 +51,8 @@ extension TuistGraph.Config.GenerationOptions { /// - manifest: Manifest representation of Tuist config generation options static func from(manifest: ProjectDescription.Config.GenerationOptions) throws -> TuistGraph.Config.GenerationOptions { .init( - xcodeProjectName: manifest.xcodeProjectName?.description, - organizationName: manifest.organizationName, - developmentRegion: manifest.developmentRegion, - disableShowEnvironmentVarsInScriptPhases: manifest.disableShowEnvironmentVarsInScriptPhases, resolveDependenciesWithSystemScm: manifest.resolveDependenciesWithSystemScm, - disablePackageVersionLocking: manifest.disablePackageVersionLocking, - lastXcodeUpgradeCheck: manifest.lastXcodeUpgradeCheck.map { .init($0.major, $0.minor, $0.patch) } + disablePackageVersionLocking: manifest.disablePackageVersionLocking ) } } diff --git a/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift index c4746fc8e..1d87e75ae 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift @@ -20,7 +20,9 @@ extension TuistGraph.Project { resourceSynthesizerPathLocator: ResourceSynthesizerPathLocating ) throws -> TuistGraph.Project { let name = manifest.name + let xcodeProjectName = manifest.options.xcodeProjectName ?? name let organizationName = manifest.organizationName + let developmentRegion = manifest.options.developmentRegion let options = TuistGraph.Project.Options.from(manifest: manifest.options) let settings = try manifest.settings.map { try TuistGraph.Settings.from(manifest: $0, generatorPaths: generatorPaths) } let targets = try manifest.targets.map { @@ -43,10 +45,10 @@ extension TuistGraph.Project { return Project( path: generatorPaths.manifestDirectory, sourceRootPath: generatorPaths.manifestDirectory, - xcodeProjPath: generatorPaths.manifestDirectory.appending(component: "\(name).xcodeproj"), + xcodeProjPath: generatorPaths.manifestDirectory.appending(component: "\(xcodeProjectName).xcodeproj"), name: name, organizationName: organizationName, - developmentRegion: nil, + developmentRegion: developmentRegion, options: options, settings: settings ?? .default, filesGroup: .group(name: "Project"), diff --git a/Sources/TuistLoader/Models+ManifestMappers/ProjectOption+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/ProjectOption+ManifestMapper.swift index 0a459f076..e74640889 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/ProjectOption+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/ProjectOption+ManifestMapper.swift @@ -9,6 +9,7 @@ extension TuistGraph.Project.Options { .init( automaticSchemesOptions: .from(manifest: manifest.automaticSchemesOptions), disableBundleAccessors: manifest.disableBundleAccessors, + disableShowEnvironmentVarsInScriptPhases: manifest.disableShowEnvironmentVarsInScriptPhases, disableSynthesizedResourceAccessors: manifest.disableSynthesizedResourceAccessors, textSettings: .init( usesTabs: manifest.textSettings.usesTabs, diff --git a/Sources/TuistLoader/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestMapper.swift index 35690cd86..db6e226b2 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestMapper.swift @@ -16,7 +16,8 @@ extension TuistGraph.Workspace.GenerationOptions { autogeneratedWorkspaceSchemes: try .from( manifest: manifest.autogeneratedWorkspaceSchemes, generatorPaths: generatorPaths - ) + ), + lastXcodeUpgradeCheck: manifest.lastXcodeUpgradeCheck.map { .init($0.major, $0.minor, $0.patch) } ) } } diff --git a/Tests/ProjectDescriptionTests/ConfigTests.swift b/Tests/ProjectDescriptionTests/ConfigTests.swift index aae25c231..b5e69dc5d 100644 --- a/Tests/ProjectDescriptionTests/ConfigTests.swift +++ b/Tests/ProjectDescriptionTests/ConfigTests.swift @@ -7,13 +7,8 @@ final class ConfigTests: XCTestCase { let config = Config( cloud: Cloud(url: "https://cloud.tuist.io", projectId: "123", options: [.analytics]), generationOptions: .options( - xcodeProjectName: "someprefix-\(.projectName)", - organizationName: "TestOrg", - developmentRegion: "de", - disableShowEnvironmentVarsInScriptPhases: true, resolveDependenciesWithSystemScm: false, - disablePackageVersionLocking: true, - lastXcodeUpgradeCheck: .init(12, 5, 1) + disablePackageVersionLocking: true ) ) diff --git a/Tests/TuistAutomationTests/Utilities/TargetRunnerTests.swift b/Tests/TuistAutomationTests/Utilities/TargetRunnerTests.swift index 7de04ceda..d654559cd 100644 --- a/Tests/TuistAutomationTests/Utilities/TargetRunnerTests.swift +++ b/Tests/TuistAutomationTests/Utilities/TargetRunnerTests.swift @@ -148,8 +148,8 @@ final class TargetRunnerTests: TuistUnitTestCase { let outputPath = try temporaryPath().appending(component: ".build") let appPath = outputPath.appending(component: target.productNameWithExtension) let arguments = ["Argument", "--option1", "AnotherArgument", "--option2=true", "-opt3"] - let minVersion = Version(string: "14.0") - let version = Version(string: "15.0") + let minVersion = Version("14.0.0") + let version = Version("15.0.0") let deviceName = "iPhone 11" let bundleId = "com.tuist.bundleid" diff --git a/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift index 37e9c263a..1a28331cb 100644 --- a/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift @@ -1728,7 +1728,7 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase { let workspace = Workspace.test( projects: [project.path], schemes: [.test()], - lastUpgradeCheck: .init(13, 0, 0) + generationOptions: .test(lastXcodeUpgradeCheck: .init(13, 0, 0)) ) let graph = Graph.test( diff --git a/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift index 88f6def6c..ba42ba117 100644 --- a/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift @@ -130,7 +130,7 @@ final class WorkspaceDescriptorGeneratorTests: TuistUnitTestCase { let workspace = Workspace.test( xcWorkspacePath: temporaryPath.appending(component: "Test.xcworkspace"), projects: [], - generationOptions: .init(enableAutomaticXcodeSchemes: false, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(enableAutomaticXcodeSchemes: false) ) let graph = Graph.test(workspace: workspace) @@ -150,7 +150,7 @@ final class WorkspaceDescriptorGeneratorTests: TuistUnitTestCase { let workspace = Workspace.test( xcWorkspacePath: temporaryPath.appending(component: "Test.xcworkspace"), projects: [], - generationOptions: .init(enableAutomaticXcodeSchemes: true, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(enableAutomaticXcodeSchemes: true) ) let graph = Graph.test(workspace: workspace) @@ -170,7 +170,7 @@ final class WorkspaceDescriptorGeneratorTests: TuistUnitTestCase { let workspace = Workspace.test( xcWorkspacePath: temporaryPath.appending(component: "Test.xcworkspace"), projects: [], - generationOptions: .init(enableAutomaticXcodeSchemes: nil, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(enableAutomaticXcodeSchemes: nil) ) let graph = Graph.test(workspace: workspace) diff --git a/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift index 1d7f08946..015aa1835 100644 --- a/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift @@ -38,7 +38,9 @@ final class WorkspaceSettingsDescriptorGeneratorTests: TuistUnitTestCase { func test_generate_withGenerationOptions() { // Given let workspace = Workspace.test( - generationOptions: .init(enableAutomaticXcodeSchemes: true, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test( + enableAutomaticXcodeSchemes: true + ) ) // When diff --git a/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift b/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift index 478e635c7..692e06592 100644 --- a/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift +++ b/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift @@ -112,7 +112,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase XCTAssertFalse(try XCTUnwrap(scheme.testAction?.coverage)) } - func test_map_diabled() throws { + func test_map_disabled() throws { // Given let subject = AutogeneratedWorkspaceSchemeWorkspaceMapper(forceWorkspaceSchemes: false) let targetA = Target.test( @@ -157,7 +157,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase project.path, projectB.path, ], - generationOptions: .init(enableAutomaticXcodeSchemes: false, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(autogeneratedWorkspaceSchemes: .disabled) ) // When @@ -217,7 +217,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase project.path, projectB.path, ], - generationOptions: .init(enableAutomaticXcodeSchemes: false, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(autogeneratedWorkspaceSchemes: .disabled) ) // When @@ -462,10 +462,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projects: [ project.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) - ) + generationOptions: .test(autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: [])) ) // When @@ -504,10 +501,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projects: [ project.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .all, testingOptions: []) - ) + generationOptions: .test(autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .all, testingOptions: [])) ) // When @@ -550,8 +544,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projects: [ project.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .targets([targetBRef]), testingOptions: []) ) ) @@ -610,10 +603,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projects: [ project.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: []) - ) + generationOptions: .test(autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: [])) ) let subject = AutogeneratedWorkspaceSchemeWorkspaceMapper(forceWorkspaceSchemes: false) @@ -688,10 +678,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projectSingleCoverage.path, projectAllCoverage.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: []) - ) + generationOptions: .test(autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: [])) ) let subject = AutogeneratedWorkspaceSchemeWorkspaceMapper(forceWorkspaceSchemes: false) @@ -741,10 +728,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase projects: [ project.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: []) - ) + generationOptions: .test(autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: [])) ) let subject = AutogeneratedWorkspaceSchemeWorkspaceMapper(forceWorkspaceSchemes: false) @@ -807,8 +791,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase project.path, projectB.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled( codeCoverageMode: .disabled, testingOptions: [.parallelizable, .randomExecutionOrdering] @@ -919,8 +902,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase project.path, projectB.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: [.parallelizable]) ) ) @@ -1028,8 +1010,7 @@ final class AutogeneratedWorkspaceSchemeWorkspaceMapperTests: TuistUnitTestCase project.path, projectB.path, ], - generationOptions: .init( - enableAutomaticXcodeSchemes: nil, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) ) ) diff --git a/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift b/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift index 8cfd7944a..bfe33976b 100644 --- a/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift @@ -1250,8 +1250,7 @@ final class GraphLinterTests: TuistUnitTestCase { let graphTraverser = GraphTraverser( graph: .test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .all, testingOptions: []) ) ) @@ -1288,8 +1287,7 @@ final class GraphLinterTests: TuistUnitTestCase { let graph = Graph.test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: []) ) ), @@ -1314,8 +1312,7 @@ final class GraphLinterTests: TuistUnitTestCase { // Given let graphTraverser = GraphTraverser(graph: .test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .relevant, testingOptions: []) ) ) @@ -1348,8 +1345,7 @@ final class GraphLinterTests: TuistUnitTestCase { ) let graph = Graph.test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled( codeCoverageMode: .targets([.init(projectPath: project.path, name: "TargetA")]), testingOptions: [] @@ -1377,8 +1373,7 @@ final class GraphLinterTests: TuistUnitTestCase { // Given let graphTraverser = GraphTraverser(graph: .test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .targets([]), testingOptions: []) ) ) @@ -1411,8 +1406,7 @@ final class GraphLinterTests: TuistUnitTestCase { ) let graph = Graph.test( workspace: .test( - generationOptions: .init( - enableAutomaticXcodeSchemes: false, + generationOptions: .test( autogeneratedWorkspaceSchemes: .enabled( codeCoverageMode: .targets([.init(projectPath: project.path, name: "TargetA")]), testingOptions: [] diff --git a/Tests/TuistGeneratorTests/ProjectMappers/LastUpgradeVersionWorkspaceMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/LastUpgradeVersionWorkspaceMapperTests.swift index 48886c828..0d4d5ab9b 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/LastUpgradeVersionWorkspaceMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/LastUpgradeVersionWorkspaceMapperTests.swift @@ -11,7 +11,7 @@ final class LastUpgradeVersionWorkspaceMapperTests: TuistUnitTestCase { override func setUp() { super.setUp() - subject = LastUpgradeVersionWorkspaceMapper(lastUpgradeVersion: .init(12, 5, 1)) + subject = LastUpgradeVersionWorkspaceMapper() } override func tearDown() { @@ -22,9 +22,13 @@ final class LastUpgradeVersionWorkspaceMapperTests: TuistUnitTestCase { func test_maps_last_upgrade_version() throws { // Given - subject = LastUpgradeVersionWorkspaceMapper(lastUpgradeVersion: .init(12, 5, 1)) + subject = LastUpgradeVersionWorkspaceMapper() - let workspace = Workspace.test(lastUpgradeCheck: nil) + let workspace = Workspace.test( + generationOptions: .test( + lastXcodeUpgradeCheck: .init(12, 5, 1) + ) + ) let projectAPath = try temporaryPath().appending(component: "A") let projectBPath = try temporaryPath().appending(component: "B") @@ -76,13 +80,10 @@ final class LastUpgradeVersionWorkspaceMapperTests: TuistUnitTestCase { lastUpgradeCheck: .init(12, 5, 1) ) - var mappedWorkspace = workspace - mappedWorkspace.lastUpgradeCheck = .init(12, 5, 1) - XCTAssertEqual( gotWorkspaceWithProjects, WorkspaceWithProjects( - workspace: mappedWorkspace, + workspace: workspace, projects: [ mappedProjectA, mappedProjectB, diff --git a/Tests/TuistGeneratorTests/ProjectMappers/ConfigShowEnvironmentMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift similarity index 82% rename from Tests/TuistGeneratorTests/ProjectMappers/ConfigShowEnvironmentMapperTests.swift rename to Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift index 66b8e6493..19a4c7771 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/ConfigShowEnvironmentMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift @@ -5,17 +5,15 @@ import XCTest @testable import TuistGenerator @testable import TuistSupportTesting -final class ConfigShowEnvironmentMapperTests: TuistUnitTestCase { +final class TargetActionDisableShowEnvVarsProjectMapperTests: TuistUnitTestCase { func test_map_environmentLoggingDisables() throws { // Given - let targetMapper = TargetActionEnvironmentMapper(false) - - let subject = TargetProjectMapper(mapper: targetMapper) + let subject = TargetActionDisableShowEnvVarsProjectMapper() let scriptA = TargetScript(name: "Pre Script", order: .pre) let scriptB = TargetScript(name: "Post Script", order: .post) let targetA = Target.test(name: "A", scripts: [scriptA, scriptB]) let targetB = Target.test(name: "B", scripts: [scriptA, scriptB]) - let project = Project.test(targets: [targetA, targetB]) + let project = Project.test(options: .test(disableShowEnvironmentVarsInScriptPhases: true), targets: [targetA, targetB]) // When let (updatedProject, _) = try subject.map(project: project) @@ -33,14 +31,12 @@ final class ConfigShowEnvironmentMapperTests: TuistUnitTestCase { func test_map_environmentLoggingEnables() throws { // Given - let targetMapper = TargetActionEnvironmentMapper(true) - - let subject = TargetProjectMapper(mapper: targetMapper) + let subject = TargetActionDisableShowEnvVarsProjectMapper() let scriptA = TargetScript(name: "Pre Script", order: .pre) let scriptB = TargetScript(name: "Post Script", order: .post) let targetA = Target.test(name: "A", scripts: [scriptA, scriptB]) let targetB = Target.test(name: "B", scripts: [scriptA, scriptB]) - let project = Project.test(targets: [targetA, targetB]) + let project = Project.test(options: .test(disableShowEnvironmentVarsInScriptPhases: false), targets: [targetA, targetB]) // When let (updatedProject, _) = try subject.map(project: project) diff --git a/Tests/TuistGraphTests/Models/WorkspaceGenerationOptionsTests.swift b/Tests/TuistGraphTests/Models/WorkspaceGenerationOptionsTests.swift index 88456feee..d9a6d75c9 100644 --- a/Tests/TuistGraphTests/Models/WorkspaceGenerationOptionsTests.swift +++ b/Tests/TuistGraphTests/Models/WorkspaceGenerationOptionsTests.swift @@ -7,10 +7,7 @@ import XCTest final class WorkspaceGenerationOptionsTests: TuistUnitTestCase { func test_codable_whenDefault() { // Given - let subject = Workspace.GenerationOptions( - enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .enabled(codeCoverageMode: .disabled, testingOptions: []) - ) + let subject = Workspace.GenerationOptions.test() // Then XCTAssertCodable(subject) diff --git a/Tests/TuistGraphTests/Models/WorkspaceTests.swift b/Tests/TuistGraphTests/Models/WorkspaceTests.swift index 6d9b8e9d8..2f4cb55f2 100644 --- a/Tests/TuistGraphTests/Models/WorkspaceTests.swift +++ b/Tests/TuistGraphTests/Models/WorkspaceTests.swift @@ -15,16 +15,4 @@ final class WorkspaceTests: TuistUnitTestCase { // Then XCTAssertCodable(subject) } - - func test_codable_withGenerationOptions() { - // Given - let subject = Workspace.test( - path: "/path/to/workspace", - name: "name", - generationOptions: .init(enableAutomaticXcodeSchemes: false, autogeneratedWorkspaceSchemes: .disabled) - ) - - // Then - XCTAssertCodable(subject) - } } diff --git a/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift b/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift index 80cd53be6..b7307345f 100644 --- a/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift +++ b/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift @@ -389,7 +389,7 @@ final class MultipleConfigurationsIntegrationTests: TuistUnitTestCase { xcWorkspacePath: path.appending(component: "Workspace.xcworkspace"), name: "Workspace", projects: try projects.map { try pathTo($0) }, - generationOptions: .init(enableAutomaticXcodeSchemes: nil, autogeneratedWorkspaceSchemes: .disabled) + generationOptions: .test(enableAutomaticXcodeSchemes: nil) ) } diff --git a/Tests/TuistKitIntegrationTests/Commands/DumpServiceIntegrationTests.swift b/Tests/TuistKitIntegrationTests/Commands/DumpServiceIntegrationTests.swift index 1a06816fc..c3ab4e354 100644 --- a/Tests/TuistKitIntegrationTests/Commands/DumpServiceIntegrationTests.swift +++ b/Tests/TuistKitIntegrationTests/Commands/DumpServiceIntegrationTests.swift @@ -62,6 +62,7 @@ final class DumpServiceTests: TuistTestCase { } }, "disableBundleAccessors": false, + "disableShowEnvironmentVarsInScriptPhases": false, "disableSynthesizedResourceAccessors": false, "textSettings": { @@ -169,7 +170,6 @@ final class DumpServiceTests: TuistTestCase { }, "generationOptions": { "disablePackageVersionLocking": false, - "disableShowEnvironmentVarsInScriptPhases": false, "resolveDependenciesWithSystemScm": false }, "plugins": [ diff --git a/Tests/TuistKitTests/Generator/Mocks/MockGeneratorFactory.swift b/Tests/TuistKitTests/Generator/Mocks/MockGeneratorFactory.swift index 59abc9cdb..4216a59f3 100644 --- a/Tests/TuistKitTests/Generator/Mocks/MockGeneratorFactory.swift +++ b/Tests/TuistKitTests/Generator/Mocks/MockGeneratorFactory.swift @@ -58,15 +58,11 @@ final class MockGeneratorFactory: GeneratorFactorying { var invokedDefault = false var invokedDefaultCount = 0 - var invokedDefaultParameters: (config: Config, Void)? - var invokedDefaultParametersList = [(config: Config, Void)]() var stubbedDefaultResult: Generating! - func `default`(config: Config) -> Generating { + func `default`() -> Generating { invokedDefault = true invokedDefaultCount += 1 - invokedDefaultParameters = (config, ()) - invokedDefaultParametersList.append((config, ())) return stubbedDefaultResult } diff --git a/Tests/TuistKitTests/Mappers/Factories/ProjectMapperFactoryTests.swift b/Tests/TuistKitTests/Mappers/Factories/ProjectMapperFactoryTests.swift index d0e269002..8dc94644a 100644 --- a/Tests/TuistKitTests/Mappers/Factories/ProjectMapperFactoryTests.swift +++ b/Tests/TuistKitTests/Mappers/Factories/ProjectMapperFactoryTests.swift @@ -25,47 +25,26 @@ final class ProjectMapperFactoryTests: TuistUnitTestCase { } func test_default_when_synthesizing_of_resource_interfaces_is_disabled() { - // Given - let config = Config.default - // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, SynthesizedResourceInterfaceProjectMapper.self) } - func test_default_when_showing_env_variables_in_scripts_is_disabled() { - // Given - let config = Config.test(generationOptions: .test(disableShowEnvironmentVarsInScriptPhases: true)) - + func test_default_contains_target_mapper() { // When - let got = subject.default(config: config) + let got = subject.default() // Then - XCTAssertContainsElementOfType(got, TargetProjectMapper.self) - } - - func test_default_when_showing_env_variables_in_scripts_is_enabled() { - // Given - let config = Config.default - - // When - let got = subject.default(config: config) - - // Then - - XCTAssertDoesntContainElementOfType(got, TargetProjectMapper.self) + XCTAssertContainsElementOfType(got, TargetActionDisableShowEnvVarsProjectMapper.self) } func test_default_when_bundle_accessors_are_enabled() { - // Given - let config = Config.default - // When - let got = subject.default(config: config) + let got = subject.default() // Then @@ -74,88 +53,48 @@ final class ProjectMapperFactoryTests: TuistUnitTestCase { } func test_default_contains_the_generate_info_plist_mapper() { - // Given - let config = Config.default - // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, GenerateInfoPlistProjectMapper.self, after: DeleteDerivedDirectoryProjectMapper.self) } - func test_default_contains_the_project_name_and_organization_mapper() { - // Given - let config = Config.default - - // When - let got = subject.default(config: config) - - // Then - XCTAssertContainsElementOfType(got, ProjectNameAndOrganizationMapper.self) - } - - func test_default_contains_the_project_development_region_mapper() { - // Given - let config = Config.default - - // When - let got = subject.default(config: config) - - // Then - XCTAssertContainsElementOfType(got, ProjectDevelopmentRegionMapper.self) - } - func test_default_contains_the_ide_template_macros_mapper() { - // Given - let config = Config.default - // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, IDETemplateMacrosMapper.self) } func test_default_contains_the_signing_mapper() { - // Given - let config = Config.default - // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, SigningMapper.self) } func test_automation_contains_the_source_root_path_project_mapper() { - // Given - let config = Config.default - // When - let got = subject.automation(config: config, skipUITests: true) + let got = subject.automation(skipUITests: true) // Then XCTAssertContainsElementOfType(got, SourceRootPathProjectMapper.self) } func test_automation_contains_the_skip_ui_tests_mapper_when_skip_ui_tests_is_true() { - // Given - let config = Config.default - // When - let got = subject.automation(config: config, skipUITests: true) + let got = subject.automation(skipUITests: true) // Then XCTAssertContainsElementOfType(got, SkipUITestsProjectMapper.self) } func test_automation_doesnt_contain_the_skip_ui_tests_mapper_when_skip_ui_tests_is_false() { - // Given - let config = Config.default - // When - let got = subject.automation(config: config, skipUITests: false) + let got = subject.automation(skipUITests: false) // Then XCTAssertDoesntContainElementOfType(got, SkipUITestsProjectMapper.self) diff --git a/Tests/TuistKitTests/Mappers/Factories/WorkspaceMapperFactoryTests.swift b/Tests/TuistKitTests/Mappers/Factories/WorkspaceMapperFactoryTests.swift index b8121569d..821a7d612 100644 --- a/Tests/TuistKitTests/Mappers/Factories/WorkspaceMapperFactoryTests.swift +++ b/Tests/TuistKitTests/Mappers/Factories/WorkspaceMapperFactoryTests.swift @@ -1,5 +1,6 @@ import Foundation import TSCBasic +import TSCUtility import TuistCoreTesting import TuistGraph import TuistLoader @@ -28,12 +29,10 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_default_contains_the_project_workspace_mapper() { // Given - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, ProjectWorkspaceMapper.self) @@ -41,12 +40,10 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_default_contains_the_tuist_workspace_identifier_mapper() { // Given - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, TuistWorkspaceIdentifierMapper.self) @@ -54,12 +51,10 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_default_contains_the_tide_template_macros_mapper() { // Given - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, IDETemplateMacrosMapper.self) @@ -67,12 +62,10 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_default_contains_the_autogenerated_project_scheme_mapper_when_autogenerated_schemes_are_enabled() { // Given - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, AutogeneratedWorkspaceSchemeWorkspaceMapper.self) @@ -80,43 +73,33 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_default_contains_the_modulemap_mapper() { // Given - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then XCTAssertContainsElementOfType(got, ModuleMapMapper.self) } - func test_default_contains_the_last_upgrade_version_mapper_when_the_configuration_is_set() { + func test_default_contains_the_last_upgrade_version_mapper() { // Given - let config = Config.test(generationOptions: .test(lastXcodeUpgradeCheck: "3.2.1")) - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.default(config: config) + let got = subject.default() // Then - let mapper = XCTAssertContainsElementOfType(got, LastUpgradeVersionWorkspaceMapper.self) - XCTAssertEqual(mapper?.lastUpgradeVersion, "3.2.1") + XCTAssertContainsElementOfType(got, LastUpgradeVersionWorkspaceMapper.self) } func test_automation_contains_the_path_workspace_mapper() throws { // Given let workspaceDirectory = try temporaryPath() - let config = Config.default - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.automation( - config: config, - workspaceDirectory: workspaceDirectory - ) + let got = subject.automation(workspaceDirectory: workspaceDirectory) // Then let mapper = XCTAssertContainsElementOfType(got, AutomationPathWorkspaceMapper.self) @@ -125,16 +108,11 @@ final class WorkspaceMapperFactoryTests: TuistUnitTestCase { func test_cache_contains_the_generate_cacheable_schemes_workspace_mapper() throws { // Given - let config = Config.default let includedTargets = Set(arrayLiteral: "MyTarget") - subject = - WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default(config: config))) + subject = WorkspaceMapperFactory(projectMapper: SequentialProjectMapper(mappers: projectMapperFactory.default())) // When - let got = subject.cache( - config: config, - includedTargets: includedTargets - ) + let got = subject.cache(includedTargets: includedTargets) // Then let mapper = XCTAssertContainsElementOfType(got, GenerateCacheableSchemesWorkspaceMapper.self) diff --git a/Tests/TuistKitTests/Services/RunServiceTests.swift b/Tests/TuistKitTests/Services/RunServiceTests.swift index 8fc4926f7..1c353cdc1 100644 --- a/Tests/TuistKitTests/Services/RunServiceTests.swift +++ b/Tests/TuistKitTests/Services/RunServiceTests.swift @@ -142,7 +142,7 @@ final class RunServiceTests: TuistUnitTestCase { let schemeName = "AScheme" let configuration = "Test" let minVersion = Target.test().deploymentTarget?.version.version() - let version = Version(string: "15.0.0") + let version = Version("15.0.0") let deviceName = "iPhone 11" let arguments = ["-arg1", "--arg2", "SomeArgument"] targetRunner @@ -168,7 +168,7 @@ final class RunServiceTests: TuistUnitTestCase { schemeName: schemeName, configuration: configuration, device: deviceName, - version: version?.description, + version: version.description, arguments: arguments ) await waitForExpectations(timeout: 1) diff --git a/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift index 19b31ee27..9d974b90a 100644 --- a/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift @@ -63,7 +63,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { let path: AbsolutePath = "/project/Tuist/Config.swift" stub(path: path, exists: true) stub( - config: .test(generationOptions: .options(developmentRegion: "fr")), + config: .test(), at: path.parentDirectory ) @@ -77,7 +77,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { cache: nil, swiftVersion: nil, plugins: [], - generationOptions: .test(developmentRegion: "fr"), + generationOptions: .test(), path: path )) } @@ -104,7 +104,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { stub(path: $0, exists: true) } stub( - config: .test(generationOptions: .options(developmentRegion: "fr")), + config: .test(), at: "/project/Tuist" ) @@ -118,7 +118,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { cache: nil, swiftVersion: nil, plugins: [], - generationOptions: .test(developmentRegion: "fr"), + generationOptions: .test(), path: "/project/Tuist/Config.swift" )) } diff --git a/Tests/TuistLoaderTests/Mappers/ProjectDevelopmentRegionMapperTests.swift b/Tests/TuistLoaderTests/Mappers/ProjectDevelopmentRegionMapperTests.swift deleted file mode 100644 index 070579dfb..000000000 --- a/Tests/TuistLoaderTests/Mappers/ProjectDevelopmentRegionMapperTests.swift +++ /dev/null @@ -1,38 +0,0 @@ -import ProjectDescription -import TuistCore -import TuistGraph -import TuistSupport -import XCTest - -@testable import TuistCoreTesting -@testable import TuistLoader -@testable import TuistSupportTesting - -final class ProjectDevelopmentRegionMapperTests: TuistUnitTestCase { - var subject: ProjectDevelopmentRegionMapper! - var config: TuistGraph.Config! - - override func setUp() { - super.setUp() - - config = TuistGraph.Config.test(generationOptions: .test(developmentRegion: "en")) - subject = ProjectDevelopmentRegionMapper(config: config) - } - - override func tearDown() { - subject = nil - config = nil - super.tearDown() - } - - func test_map_changes_the_development_region() throws { - // Given - let project = TuistGraph.Project.test(name: "Test", developmentRegion: nil) - - // When - let (got, _) = try subject.map(project: project) - - // Then - XCTAssertEqual(got.developmentRegion, "en") - } -} diff --git a/Tests/TuistLoaderTests/Mappers/ProjectNameAndOrganizationMapperTests.swift b/Tests/TuistLoaderTests/Mappers/ProjectNameAndOrganizationMapperTests.swift deleted file mode 100644 index d23f6a3b1..000000000 --- a/Tests/TuistLoaderTests/Mappers/ProjectNameAndOrganizationMapperTests.swift +++ /dev/null @@ -1,55 +0,0 @@ -import ProjectDescription -import TuistCore -import TuistGraph -import TuistSupport -import XCTest - -@testable import TuistCoreTesting -@testable import TuistLoader -@testable import TuistSupportTesting - -class ProjectNameAndOrganizationMapperTests: TuistUnitTestCase { - var subject: ProjectNameAndOrganizationMapper! - var config: TuistGraph.Config! - - override func setUp() { - super.setUp() - - let nameTemplate: TemplateString = "Tuist-\(.projectName)" - config = TuistGraph.Config.test( - generationOptions: .test( - xcodeProjectName: nameTemplate.description, - organizationName: "Tuist" - ) - ) - subject = ProjectNameAndOrganizationMapper(config: config) - } - - override func tearDown() { - subject = nil - config = nil - super.tearDown() - } - - func test_map_changes_the_project_name() throws { - // Given - let project = TuistGraph.Project.test(name: "Test") - - // When - let (got, _) = try subject.map(project: project) - - // Then - XCTAssertEqual(got.xcodeProjPath.basename, "Tuist-Test.xcodeproj") - } - - func test_map_changes_the_organization() throws { - // Given - let project = TuistGraph.Project.test(name: "Test", organizationName: nil) - - // When - let (got, _) = try subject.map(project: project) - - // Then - XCTAssertEqual(got.organizationName, "Tuist") - } -} diff --git a/Tests/TuistLoaderTests/Models+ManifestMappers/Project+ManifestMapperTests.swift b/Tests/TuistLoaderTests/Models+ManifestMappers/Project+ManifestMapperTests.swift new file mode 100644 index 000000000..d30827c71 --- /dev/null +++ b/Tests/TuistLoaderTests/Models+ManifestMappers/Project+ManifestMapperTests.swift @@ -0,0 +1,89 @@ +import Foundation +import ProjectDescription +import TSCBasic +import TuistCore +import TuistLoaderTesting +import TuistSupport +import XCTest + +@testable import TuistGraph +@testable import TuistLoader +@testable import TuistSupportTesting + +final class ProjectManifestMapperTests: TuistUnitTestCase { + func test_from() throws { + // Given + let project = ProjectDescription.Project( + name: "Name", + organizationName: "Organization", + options: .options( + automaticSchemesOptions: .enabled( + targetSchemesGrouping: .byNameSuffix(build: ["build"], test: ["test"], run: ["run"]), + codeCoverageEnabled: true, + testingOptions: [.parallelizable] + ), + developmentRegion: "us", + disableBundleAccessors: true, + disableShowEnvironmentVarsInScriptPhases: true, + disableSynthesizedResourceAccessors: true, + textSettings: .textSettings(usesTabs: true, indentWidth: 1, tabWidth: 2, wrapsLines: true), + xcodeProjectName: "XcodeName" + ), + packages: [ + .remote(url: "url", requirement: .branch("b")), + .local(path: "/path"), + ], + targets: [], + schemes: [], + fileHeaderTemplate: .string("123"), + additionalFiles: [.glob(pattern: "/file.swift")], + resourceSynthesizers: [] + ) + fileHandler.stubExists = { _ in true } + + // When + let got = try TuistGraph.Project.from( + manifest: project, + generatorPaths: .init(manifestDirectory: "/"), + plugins: .none, + externalDependencies: [:], + resourceSynthesizerPathLocator: MockResourceSynthesizerPathLocator() + ) + + // Then + XCTAssertEqual( + got, + TuistGraph.Project( + path: "/", + sourceRootPath: "/", + xcodeProjPath: "/XcodeName.xcodeproj", + name: "Name", + organizationName: "Organization", + developmentRegion: "us", + options: .init( + automaticSchemesOptions: .enabled( + targetSchemesGrouping: .byNameSuffix(build: ["build"], test: ["test"], run: ["run"]), + codeCoverageEnabled: true, + testingOptions: [.parallelizable] + ), + disableBundleAccessors: true, + disableShowEnvironmentVarsInScriptPhases: true, + disableSynthesizedResourceAccessors: true, + textSettings: .init(usesTabs: true, indentWidth: 1, tabWidth: 2, wrapsLines: true) + ), + settings: .default, + filesGroup: .group(name: "Project"), + targets: [], + packages: [ + .remote(url: "url", requirement: .branch("b")), + .local(path: "/path"), + ], + schemes: [], + ideTemplateMacros: .init(fileHeader: "123"), + additionalFiles: [.file(path: "/file.swift")], + resourceSynthesizers: [], + lastUpgradeCheck: nil + ) + ) + } +} diff --git a/Tests/TuistLoaderTests/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestWrapperTests.swift b/Tests/TuistLoaderTests/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestWrapperTests.swift index a078903be..77de43f40 100644 --- a/Tests/TuistLoaderTests/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestWrapperTests.swift +++ b/Tests/TuistLoaderTests/Models+ManifestMappers/WorkspaceGenerationOptions+ManifestWrapperTests.swift @@ -15,14 +15,22 @@ final class WorkspaceGenerationOptionsManifestMapperTests: TuistTestCase { let generatorPaths = GeneratorPaths(manifestDirectory: temporaryPath) let manifest = ProjectDescription.Workspace.GenerationOptions.options( enableAutomaticXcodeSchemes: nil, - autogeneratedWorkspaceSchemes: .disabled + autogeneratedWorkspaceSchemes: .disabled, + lastXcodeUpgradeCheck: .init("1.2.3") ) // When let actual = try TuistGraph.Workspace.GenerationOptions.from(manifest: manifest, generatorPaths: generatorPaths) // Then - XCTAssertEqual(actual, .init(enableAutomaticXcodeSchemes: nil, autogeneratedWorkspaceSchemes: .disabled)) + XCTAssertEqual( + actual, + .init( + enableAutomaticXcodeSchemes: nil, + autogeneratedWorkspaceSchemes: .disabled, + lastXcodeUpgradeCheck: .init("1.2.3") + ) + ) } func test_from_whenAutomaticXcodeSchemeIsDisabled() throws { @@ -38,7 +46,14 @@ final class WorkspaceGenerationOptionsManifestMapperTests: TuistTestCase { let actual = try TuistGraph.Workspace.GenerationOptions.from(manifest: manifest, generatorPaths: generatorPaths) // Then - XCTAssertEqual(actual, .init(enableAutomaticXcodeSchemes: false, autogeneratedWorkspaceSchemes: .disabled)) + XCTAssertEqual( + actual, + .init( + enableAutomaticXcodeSchemes: false, + autogeneratedWorkspaceSchemes: .disabled, + lastXcodeUpgradeCheck: nil + ) + ) } func test_from_whenAutomaticXcodeSchemeIsEnabled() throws { @@ -54,7 +69,14 @@ final class WorkspaceGenerationOptionsManifestMapperTests: TuistTestCase { let actual = try TuistGraph.Workspace.GenerationOptions.from(manifest: manifest, generatorPaths: generatorPaths) // Then - XCTAssertEqual(actual, .init(enableAutomaticXcodeSchemes: true, autogeneratedWorkspaceSchemes: .disabled)) + XCTAssertEqual( + actual, + .init( + enableAutomaticXcodeSchemes: true, + autogeneratedWorkspaceSchemes: .disabled, + lastXcodeUpgradeCheck: nil + ) + ) } func test_from_whenAutogenerationOptionsIsEnabled() throws { @@ -80,7 +102,20 @@ final class WorkspaceGenerationOptionsManifestMapperTests: TuistTestCase { autogeneratedWorkspaceSchemes: .enabled( codeCoverageMode: .all, testingOptions: [.parallelizable, .randomExecutionOrdering] - ) + ), + lastXcodeUpgradeCheck: nil + ) + ) + // Then + XCTAssertEqual( + actual, + .init( + enableAutomaticXcodeSchemes: true, + autogeneratedWorkspaceSchemes: .enabled( + codeCoverageMode: .all, + testingOptions: [.parallelizable, .randomExecutionOrdering] + ), + lastXcodeUpgradeCheck: nil ) ) } diff --git a/projects/docs/docs/manifests/config.md b/projects/docs/docs/manifests/config.md index ead77a277..e89d66e3e 100644 --- a/projects/docs/docs/manifests/config.md +++ b/projects/docs/docs/manifests/config.md @@ -69,14 +69,9 @@ Generation options allow customizing the generation of Xcode projects. | Property | Description | | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `xcodeProjectName(TemplateString)` | Customize the name of the generated .xcodeproj. | -| `organizationName(String)` | Customize the organization name of the generated .xcodeproj. | -| `developmentRegion(String)` | Customize the development region of the generated .xcodeproj. The default development region is `en`. | -| `disableShowEnvironmentVarsInScriptPhases` | Suppress logging of environment in Run Script build phases. | | `templateMacros(IDETemplateMacros)` | Apply IDE Template macros to your project. | | `resolveDependenciesWithSystemScm` | Resolve SPM dependencies using your system's SCM credentials, instead of Xcode accounts. | | `disablePackageVersionLocking` | Disables locking Swift packages. This can speed up generation but does increase risk if packages are not locked in their declarations. | -| `lastXcodeUpgradeCheck(Version)` | Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. It is recommended to set the version option to Xcode's version that is used for development of a project, for example `.lastUpgradeCheck(Version(13, 0, 0))` for Xcode 13.0.0. | ### TemplateString diff --git a/projects/docs/docs/manifests/project.md b/projects/docs/docs/manifests/project.md index b89929689..3fe48472d 100644 --- a/projects/docs/docs/manifests/project.md +++ b/projects/docs/docs/manifests/project.md @@ -82,9 +82,12 @@ List of additional options: | Case | Description | | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | `automaticSchemesOptions(AutomaticSchemesOptions)` | To configure automatic target schemes generation. | -| `disableSynthesizedResourceAccessors` | To disable synthesized resource accessors. | +| `developmentRegion` | To customize the development region. | | `disableBundleAccessors` | To disables generating Bundle accessors. | +| `disableShowEnvironmentVarsInScriptPhases` | To suppress logging of environment in Run Script build phases. | +| `disableSynthesizedResourceAccessors` | To disable synthesized resource accessors. | | `textSettings(usesTabs: Bool?, indentWidth: UInt?, tabWidth: UInt?, wrapsLines: Bool?)` | [Text settings](#text-settings) to override user ones for current project. | +| `xcodeProjectName` | To customize the name of the generated `.xcodeproj`. | ## AutomaticSchemesOptions diff --git a/projects/docs/docs/manifests/workspace.md b/projects/docs/docs/manifests/workspace.md index 0d1bee3b6..a3592d981 100644 --- a/projects/docs/docs/manifests/workspace.md +++ b/projects/docs/docs/manifests/workspace.md @@ -66,10 +66,11 @@ A `Workspace.swift` should initialize a variable of type `Workspace`. It can tak Generation options allow customizing the generation of the Xcode workspace. -| Property | Description | Type | Required | Default | -| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | -------- | ----------------------------------------------------------- | -| `disableAutomaticXcodeSchemes` | Enable or disable automatic generation of schemes _by Xcode_. | [`AutomaticSchemeMode`](#automaticschememode) | No | `false` | -| `autogeneratedWorkspaceSchemes(AutogenerationOptions)` | Enable or disable automatic generation of `*-Workspace*` schemes. If enabled, options to configure code coverage and test targets can be passed in via associated values. | [`AutogeneratedWorkspaceSchemes`](#autogeneratedworkspaceschemes) | No | `.enabled(codeCoverageMode: .disabled, testingOptions: [])` | +| Property | Description | Type | Required | Default | +| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------- | ----------------------------------------------------------- | +| `disableAutomaticXcodeSchemes` | Enable or disable automatic generation of schemes _by Xcode_. | [`AutomaticSchemeMode`](#automaticschememode) | No | `false` | +| `autogeneratedWorkspaceSchemes(AutogenerationOptions)` | Enable or disable automatic generation of `*-Workspace*` schemes. If enabled, options to configure code coverage and test targets can be passed in via associated values. | [`AutogeneratedWorkspaceSchemes`](#autogeneratedworkspaceschemes) | No | `.enabled(codeCoverageMode: .disabled, testingOptions: [])` | +| `lastXcodeUpgradeCheck(Version)` | Allows to suppress warnings in Xcode about updates to recommended settings added in or below the specified Xcode version. The warnings appear when Xcode version has been upgraded. | `Version` | No | `nil` | ### CodeCoverageMode diff --git a/projects/tuist/features/generate-1.feature b/projects/tuist/features/generate-1.feature index 14c2c08bf..f6c959999 100644 --- a/projects/tuist/features/generate-1.feature +++ b/projects/tuist/features/generate-1.feature @@ -1,13 +1,5 @@ Feature: Generate a new project using Tuist (suite 1) - Scenario: The project is an iOS application with tests (app_with_development_region_config) - Given that tuist is available - And I have a working directory - Then I copy the fixture app_with_development_region_config into the working directory - Then tuist generates the project - Then I should be able to build for iOS the scheme App - Then the product 'App.app' with destination 'Debug-iphonesimulator' contains the Info.plist key 'CFBundleDevelopmentRegion' with value 'de' - Scenario: The project is an iOS application with tests (ios_app_with_tests) Given that tuist is available And I have a working directory diff --git a/projects/tuist/fixtures/README.md b/projects/tuist/fixtures/README.md index 09504b504..8aaf38eb9 100644 --- a/projects/tuist/fixtures/README.md +++ b/projects/tuist/fixtures/README.md @@ -294,14 +294,6 @@ A simple iOS app with a Core Data model and Mapping Model (.xcmappingmodel) An iOS app that has a dependency with a dependency with a framework for macOS. -## app_with_development_region_config - -An iOS app where the development region is defined at the `Config` level. - -## app_with_organization_name_config - -An iOS app where the organization name is defined at the `Config` level. - ## app_with_organization_name_project An iOS app where the organization name is defined at the `Project` level. diff --git a/projects/tuist/fixtures/app_with_development_region_config/App/AppDelegate.swift b/projects/tuist/fixtures/app_with_development_region_config/App/AppDelegate.swift deleted file mode 100644 index 1e9fddc4b..000000000 --- a/projects/tuist/fixtures/app_with_development_region_config/App/AppDelegate.swift +++ /dev/null @@ -1,19 +0,0 @@ -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .white - window?.rootViewController = viewController - window?.makeKeyAndVisible() - return true - } - - func hello() -> String { - "AppDelegate.hello()" - } -} diff --git a/projects/tuist/fixtures/app_with_development_region_config/Config.swift b/projects/tuist/fixtures/app_with_development_region_config/Config.swift deleted file mode 100644 index 93f550980..000000000 --- a/projects/tuist/fixtures/app_with_development_region_config/Config.swift +++ /dev/null @@ -1,7 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options( - developmentRegion: "de" - ) -) diff --git a/projects/tuist/fixtures/app_with_development_region_config/Info.plist b/projects/tuist/fixtures/app_with_development_region_config/Info.plist deleted file mode 100644 index c407fafb0..000000000 --- a/projects/tuist/fixtures/app_with_development_region_config/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSHumanReadableCopyright - Copyright ©. All rights reserved. - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/projects/tuist/fixtures/app_with_development_region_config/Project.swift b/projects/tuist/fixtures/app_with_development_region_config/Project.swift deleted file mode 100644 index 427e3d371..000000000 --- a/projects/tuist/fixtures/app_with_development_region_config/Project.swift +++ /dev/null @@ -1,21 +0,0 @@ -import ProjectDescription - -let project = Project( - name: "App", - targets: [ - Target( - name: "App", - platform: .iOS, - product: .app, - bundleId: "io.tuist.app", - infoPlist: .file(path: .relativeToManifest("Info.plist")), - sources: "App/**", - settings: .settings( - base: [ - "CODE_SIGN_IDENTITY": "", - "CODE_SIGNING_REQUIRED": "NO", - ] - ) - ), - ] -) diff --git a/projects/tuist/fixtures/app_with_organization_name_config/.gitignore b/projects/tuist/fixtures/app_with_organization_name_config/.gitignore deleted file mode 100644 index 2f132f033..000000000 --- a/projects/tuist/fixtures/app_with_organization_name_config/.gitignore +++ /dev/null @@ -1,63 +0,0 @@ -### 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 \ No newline at end of file diff --git a/projects/tuist/fixtures/app_with_organization_name_config/App/AppDelegate.swift b/projects/tuist/fixtures/app_with_organization_name_config/App/AppDelegate.swift deleted file mode 100644 index 1e9fddc4b..000000000 --- a/projects/tuist/fixtures/app_with_organization_name_config/App/AppDelegate.swift +++ /dev/null @@ -1,19 +0,0 @@ -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .white - window?.rootViewController = viewController - window?.makeKeyAndVisible() - return true - } - - func hello() -> String { - "AppDelegate.hello()" - } -} diff --git a/projects/tuist/fixtures/app_with_organization_name_config/Config.swift b/projects/tuist/fixtures/app_with_organization_name_config/Config.swift deleted file mode 100644 index adf3b3197..000000000 --- a/projects/tuist/fixtures/app_with_organization_name_config/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options(organizationName: "Tuist") -) diff --git a/projects/tuist/fixtures/app_with_organization_name_config/Info.plist b/projects/tuist/fixtures/app_with_organization_name_config/Info.plist deleted file mode 100644 index c407fafb0..000000000 --- a/projects/tuist/fixtures/app_with_organization_name_config/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSHumanReadableCopyright - Copyright ©. All rights reserved. - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/projects/tuist/fixtures/app_with_organization_name_config/Project.swift b/projects/tuist/fixtures/app_with_organization_name_config/Project.swift deleted file mode 100644 index 427e3d371..000000000 --- a/projects/tuist/fixtures/app_with_organization_name_config/Project.swift +++ /dev/null @@ -1,21 +0,0 @@ -import ProjectDescription - -let project = Project( - name: "App", - targets: [ - Target( - name: "App", - platform: .iOS, - product: .app, - bundleId: "io.tuist.app", - infoPlist: .file(path: .relativeToManifest("Info.plist")), - sources: "App/**", - settings: .settings( - base: [ - "CODE_SIGN_IDENTITY": "", - "CODE_SIGNING_REQUIRED": "NO", - ] - ) - ), - ] -) diff --git a/projects/tuist/fixtures/ios_app_large/Tuist/Config.swift b/projects/tuist/fixtures/ios_app_large/Tuist/Config.swift deleted file mode 100644 index 0313e771e..000000000 --- a/projects/tuist/fixtures/ios_app_large/Tuist/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options(lastXcodeUpgradeCheck: Version(12, 5, 1)) -) diff --git a/projects/tuist/fixtures/ios_app_with_env_suppressed/App With Space/Project.swift b/projects/tuist/fixtures/ios_app_with_env_suppressed/App With Space/Project.swift index 3a82817f2..d1321dea2 100644 --- a/projects/tuist/fixtures/ios_app_with_env_suppressed/App With Space/Project.swift +++ b/projects/tuist/fixtures/ios_app_with_env_suppressed/App With Space/Project.swift @@ -2,6 +2,7 @@ import ProjectDescription let project = Project( name: "AppWithSpace", + options: .options(disableShowEnvironmentVarsInScriptPhases: true), targets: [ Target( name: "AppWithSpace", diff --git a/projects/tuist/fixtures/ios_app_with_env_suppressed/App/Project.swift b/projects/tuist/fixtures/ios_app_with_env_suppressed/App/Project.swift index 4026b28e3..03ffceaa0 100644 --- a/projects/tuist/fixtures/ios_app_with_env_suppressed/App/Project.swift +++ b/projects/tuist/fixtures/ios_app_with_env_suppressed/App/Project.swift @@ -2,6 +2,7 @@ import ProjectDescription let project = Project( name: "App", + options: .options(disableShowEnvironmentVarsInScriptPhases: true), targets: [ Target( name: "App", diff --git a/projects/tuist/fixtures/ios_app_with_env_suppressed/Config.swift b/projects/tuist/fixtures/ios_app_with_env_suppressed/Config.swift deleted file mode 100644 index 1f02252f3..000000000 --- a/projects/tuist/fixtures/ios_app_with_env_suppressed/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options(disableShowEnvironmentVarsInScriptPhases: true) -) diff --git a/projects/tuist/fixtures/ios_app_with_frameworks/Tuist/Config.swift b/projects/tuist/fixtures/ios_app_with_frameworks/Tuist/Config.swift deleted file mode 100644 index b1b6556fa..000000000 --- a/projects/tuist/fixtures/ios_app_with_frameworks/Tuist/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options(xcodeProjectName: "AwesomePrefix-\(.projectName)-AwesomeSuffix") -) diff --git a/projects/tuist/fixtures/ios_app_with_headers_in_one_dir/Tuist/Config.swift b/projects/tuist/fixtures/ios_app_with_headers_in_one_dir/Tuist/Config.swift deleted file mode 100644 index aad592f05..000000000 --- a/projects/tuist/fixtures/ios_app_with_headers_in_one_dir/Tuist/Config.swift +++ /dev/null @@ -1,6 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: [ - ] -)