diff --git a/.github/workflows/tuist.yml b/.github/workflows/tuist.yml index 17017e9c5..c26f7e869 100644 --- a/.github/workflows/tuist.yml +++ b/.github/workflows/tuist.yml @@ -21,9 +21,9 @@ jobs: name: 'Cache SPM dependencies' with: path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + key: ${{ runner.os }}-${{ matrix.xcode }}-spm-${{ hashFiles('**/Package.resolved') }} restore-keys: | - ${{ runner.os }}-spm- + ${{ runner.os }}-${{ matrix.xcode }}-spm- - name: Run tests run: | rm -rf .coverage @@ -42,9 +42,9 @@ jobs: - uses: actions/cache@v2 with: path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + key: ${{ runner.os }}-${{ matrix.xcode }}-spm-${{ hashFiles('**/Package.resolved') }} restore-keys: | - ${{ runner.os }}-spm- + ${{ runner.os }}-${{ matrix.xcode }}-spm- - name: Build Tuist for release run: swift build -c release --product tuist - name: Build Tuistenv for release diff --git a/.swift-version b/.swift-version index 1b47e8f3e..e60200b54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.1.2 \ No newline at end of file +5.2.5 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b7a20b9..19e8a2f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ ### Changed - Change `launchArguments` of `Target` and `RunAction` to ordered array so order can be preserved [#2052](https://github.com/tuist/tuist/pull/2052) by [@olejnjak](https://github.com/olejnjak). +- Added `Package.swift` to some subdirectories to prevent Xcode from including them in the generated Xcode project [#2058](https://github.com/tuist/tuist/pull/2058) by [@pepibumur](https://github.com/pepibumur). ### Fixed diff --git a/Package.resolved b/Package.resolved index ca172fc1a..6cb69979f 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,17 +6,17 @@ "repositoryURL": "https://github.com/tadija/AEXML", "state": { "branch": null, - "revision": "e4d517844dd03dac557e35d77a8e9ab438de91a6", - "version": "4.4.0" + "revision": "8623e73b193386909566a9ca20203e33a09af142", + "version": "4.5.0" } }, { "package": "Signals", - "repositoryURL": "https://github.com/IBM-Swift/BlueSignals", + "repositoryURL": "https://github.com/tuist/BlueSignals.git", "state": { "branch": null, - "revision": "b7331c8bef913f5f8b3cffa6ecfcce679f7c2531", - "version": "1.0.21" + "revision": "1f6c49e186c8a4eeef87ba14f2f97b8646559d13", + "version": "1.0.200" } }, { @@ -48,11 +48,11 @@ }, { "package": "CryptoSwift", - "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift", + "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git", "state": { "branch": null, - "revision": "39f08ac5269361a50c08ce1e2f41989bfc4b1ec8", - "version": "1.3.1" + "revision": "e2bc81be54d71d566a52ca17c3983d141c30aa70", + "version": "1.3.3" } }, { @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/tid-kijyun/Kanna.git", "state": { "branch": null, - "revision": "609367a2cd84827a33383cf7923cb4fe8f69ee0a", - "version": "5.2.2" + "revision": "4a80ebe93b6966d5083394fcaaaff57a2fcec935", + "version": "5.2.3" } }, { @@ -156,7 +156,7 @@ }, { "package": "swift-argument-parser", - "repositoryURL": "https://github.com/apple/swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser.git", "state": { "branch": null, "revision": "92646c0cdbaca076c8d3d0207891785b3379cbff", @@ -174,7 +174,7 @@ }, { "package": "swift-tools-support-core", - "repositoryURL": "https://github.com/apple/swift-tools-support-core", + "repositoryURL": "https://github.com/apple/swift-tools-support-core.git", "state": { "branch": null, "revision": "243beea77d20db46647a3de4765c96e2c801c7c7", @@ -210,20 +210,11 @@ }, { "package": "XcodeProj", - "repositoryURL": "https://github.com/tuist/XcodeProj", + "repositoryURL": "https://github.com/tuist/XcodeProj.git", "state": { "branch": null, - "revision": "2ae8e322ddbed99655802533441bc52f9ae76f24", - "version": "7.17.0" - } - }, - { - "package": "XcodeProjCExt", - "repositoryURL": "https://github.com/tuist/XcodeProjCExt", - "state": { - "branch": null, - "revision": "21a510c225ff2bc83d5920a21d902af4b1e7e218", - "version": "0.1.0" + "revision": "82bf5efcaa27e94ed8c761c1eb3e397b6dea82b9", + "version": "7.18.0" } }, { @@ -231,8 +222,8 @@ "repositoryURL": "https://github.com/jpsim/Yams.git", "state": { "branch": null, - "revision": "88caa2e6fffdbef2e91c2022d038576062042907", - "version": "4.0.0" + "revision": "138cf1b701cf825233b92ceac919152d5aba8a3f", + "version": "4.0.1" } }, { diff --git a/Package.swift b/Package.swift index 6c7b5e538..a3207df98 100644 --- a/Package.swift +++ b/Package.swift @@ -1,7 +1,19 @@ -// swift-tools-version:5.1 +// swift-tools-version:5.2.0 import PackageDescription +let signalsDependency: Target.Dependency = .byName(name: "Signals") +let rxSwiftDependency: Target.Dependency = .product(name: "RxSwift", package: "RxSwift") +let rxBlockingDependency: Target.Dependency = .product(name: "RxBlocking", package: "RxSwift") +let rxRelayDependency: Target.Dependency = .product(name: "RxRelay", package: "RxSwift") +let rxTestDependency: Target.Dependency = .product(name: "RxTest", package: "RxSwift") +let swiftToolsSupportDependency: Target.Dependency = .product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core") +let loggingDependency: Target.Dependency = .product(name: "Logging", package: "swift-log") +let argumentParserDependency: Target.Dependency = .product(name: "ArgumentParser", package: "swift-argument-parser") +let beautifyDependency: Target.Dependency = .product(name: "XcbeautifyLib", package: "xcbeautify") +let swiftGenKitDependency: Target.Dependency = .product(name: "SwiftGenKit", package: "SwiftGen") +let swifterDependency: Target.Dependency = .byName(name: "Swifter") + let package = Package( name: "tuist", platforms: [.macOS(.v10_12)], @@ -27,18 +39,18 @@ let package = Package( targets: ["TuistGenerator"]), ], dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj", .upToNextMajor(from: "7.17.0")), - .package(url: "https://github.com/IBM-Swift/BlueSignals", .upToNextMajor(from: "1.0.21")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "7.17.0")), + .package(name: "Signals", url: "https://github.com/tuist/BlueSignals.git", .upToNextMajor(from: "1.0.21")), .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.1.1")), .package(url: "https://github.com/rnine/Checksum.git", .upToNextMajor(from: "1.0.2")), .package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.4.0")), .package(url: "https://github.com/thii/xcbeautify.git", .upToNextMajor(from: "0.8.1")), - .package(url: "https://github.com/krzyzanowskim/CryptoSwift", .upToNextMajor(from: "1.3.0")), + .package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMajor(from: "1.3.3")), .package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMajor(from: "0.14.0")), .package(url: "https://github.com/kishikawakatsumi/KeychainAccess.git", .upToNextMajor(from: "4.1.0")), - .package(url: "https://github.com/httpswift/swifter.git", .upToNextMajor(from: "1.5.0")), - .package(url: "https://github.com/apple/swift-tools-support-core", .upToNextMinor(from: "0.1.12")), - .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "0.3.1")), + .package(name: "Swifter", url: "https://github.com/httpswift/swifter.git", .upToNextMajor(from: "1.5.0")), + .package(url: "https://github.com/apple/swift-tools-support-core.git", .upToNextMinor(from: "0.1.12")), + .package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMajor(from: "0.3.1")), .package(url: "https://github.com/marmelroy/Zip.git", .upToNextMinor(from: "2.1.1")), .package(url: "https://github.com/tuist/GraphViz.git", .branch("tuist")), .package(url: "https://github.com/fortmarek/SwiftGen", .revision("ef8d6b186a03622cec8d228b18f0e2b3bb20b81c")), @@ -48,7 +60,7 @@ let package = Package( targets: [ .target( name: "TuistCore", - dependencies: ["SwiftToolsSupport-auto", "TuistSupport", "XcodeProj", "Checksum"] + dependencies: [swiftToolsSupportDependency, "TuistSupport", "XcodeProj", "Checksum"] ), .target( name: "TuistCoreTesting", @@ -64,43 +76,125 @@ let package = Package( ), .target( name: "TuistDoc", - dependencies: ["SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "Signals", "RxBlocking"] + dependencies: [ + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + signalsDependency, + rxBlockingDependency, + ] ), .target( name: "TuistDocTesting", - dependencies: ["TuistDoc", "SwiftToolsSupport-auto", "TuistCore", "TuistCoreTesting", "TuistSupportTesting"] + dependencies: [ + "TuistDoc", + swiftToolsSupportDependency, + "TuistCore", + "TuistCoreTesting", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistDocTests", - dependencies: ["TuistDoc", "TuistDocTesting", "SwiftToolsSupport-auto", "TuistSupportTesting", "TuistCore", "TuistCoreTesting", "TuistSupport"] + dependencies: [ + "TuistDoc", + "TuistDocTesting", + swiftToolsSupportDependency, + "TuistSupportTesting", + "TuistCore", + "TuistCoreTesting", + "TuistSupport", + ] ), .target( name: "TuistKit", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "ArgumentParser", "TuistSupport", "TuistGenerator", "TuistCache", "TuistAutomation", "ProjectDescription", "Signals", "RxSwift", "RxBlocking", "TuistLoader", "TuistInsights", "TuistScaffold", "TuistSigning", "TuistDependencies", "TuistCloud", "TuistDoc", "GraphViz", "TuistMigration", "TuistAsyncQueue"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + argumentParserDependency, + "TuistSupport", + "TuistGenerator", + "TuistCache", + "TuistAutomation", + "ProjectDescription", + signalsDependency, + rxSwiftDependency, + rxBlockingDependency, + "TuistLoader", + "TuistInsights", + "TuistScaffold", + "TuistSigning", + "TuistDependencies", + "TuistCloud", + "TuistDoc", + "GraphViz", + "TuistMigration", + "TuistAsyncQueue", + ] ), .testTarget( name: "TuistKitTests", - dependencies: ["TuistKit", "TuistAutomation", "TuistSupportTesting", "TuistCoreTesting", "ProjectDescription", "RxBlocking", "TuistLoaderTesting", "TuistCacheTesting", "TuistGeneratorTesting", "TuistScaffoldTesting", "TuistCloudTesting", "TuistAutomationTesting", "TuistSigningTesting", "TuistDependenciesTesting", "TuistMigrationTesting", "TuistDocTesting", "TuistAsyncQueueTesting"] + dependencies: [ + "TuistKit", + "TuistAutomation", + "TuistSupportTesting", + "TuistCoreTesting", + "ProjectDescription", + rxBlockingDependency, + "TuistLoaderTesting", + "TuistCacheTesting", + "TuistGeneratorTesting", + "TuistScaffoldTesting", + "TuistCloudTesting", + "TuistAutomationTesting", + "TuistSigningTesting", + "TuistDependenciesTesting", + "TuistMigrationTesting", + "TuistDocTesting", + "TuistAsyncQueueTesting", + ] ), .testTarget( name: "TuistKitIntegrationTests", - dependencies: ["TuistKit", "TuistCoreTesting", "TuistSupportTesting", "ProjectDescription", "RxBlocking", "TuistLoaderTesting", "TuistCloudTesting"] + dependencies: [ + "TuistKit", + "TuistCoreTesting", + "TuistSupportTesting", + "ProjectDescription", + rxBlockingDependency, + "TuistLoaderTesting", + "TuistCloudTesting", + ] ), .target( name: "tuist", - dependencies: ["TuistKit", "ProjectDescription"] + dependencies: [ + "TuistKit", + "ProjectDescription", + ] ), .target( name: "TuistEnvKit", - dependencies: ["ArgumentParser", "SwiftToolsSupport-auto", "TuistSupport", "RxSwift", "RxBlocking"] + dependencies: [ + argumentParserDependency, + swiftToolsSupportDependency, + "TuistSupport", + rxSwiftDependency, + rxBlockingDependency, + ] ), .testTarget( name: "TuistEnvKitTests", - dependencies: ["TuistEnvKit", "TuistSupportTesting"] + dependencies: [ + "TuistEnvKit", + "TuistSupportTesting", + ] ), .target( name: "tuistenv", - dependencies: ["TuistEnvKit"] + dependencies: [ + "TuistEnvKit", + ] ), .target( name: "ProjectDescription", @@ -108,71 +202,165 @@ let package = Package( ), .testTarget( name: "ProjectDescriptionTests", - dependencies: ["ProjectDescription", "TuistSupportTesting"] + dependencies: [ + "ProjectDescription", + "TuistSupportTesting", + ] ), .target( name: "TuistSupport", - dependencies: ["SwiftToolsSupport-auto", "RxSwift", "RxRelay", "Logging", "KeychainAccess", "Swifter", "Signals", "Zip"] + dependencies: [ + swiftToolsSupportDependency, + rxSwiftDependency, + rxRelayDependency, + loggingDependency, + "KeychainAccess", + swifterDependency, + signalsDependency, + "Zip", + ] ), .target( name: "TuistSupportTesting", - dependencies: ["TuistSupport", "SwiftToolsSupport-auto"] + dependencies: [ + "TuistSupport", + swiftToolsSupportDependency, + ] ), .testTarget( name: "TuistSupportTests", - dependencies: ["TuistSupport", "TuistSupportTesting", "RxBlocking"] + dependencies: [ + "TuistSupport", + "TuistSupportTesting", + rxBlockingDependency, + ] ), .testTarget( name: "TuistSupportIntegrationTests", - dependencies: ["TuistSupport", "TuistSupportTesting", "RxBlocking"] + dependencies: [ + "TuistSupport", + "TuistSupportTesting", + rxBlockingDependency, + ] ), .target( name: "TuistGenerator", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "RxBlocking", "GraphViz", "SwiftGenKit", "StencilSwiftKit"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + rxBlockingDependency, + "GraphViz", + swiftGenKitDependency, + "StencilSwiftKit", + ] ), .target( name: "TuistGeneratorTesting", - dependencies: ["TuistGenerator", "TuistCoreTesting", "TuistSupportTesting"] + dependencies: [ + "TuistGenerator", + "TuistCoreTesting", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistGeneratorTests", - dependencies: ["TuistGenerator", "TuistSupportTesting", "TuistCoreTesting", "TuistGeneratorTesting", "TuistSigningTesting"] + dependencies: [ + "TuistGenerator", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistGeneratorTesting", + "TuistSigningTesting", + ] ), .testTarget( name: "TuistGeneratorIntegrationTests", - dependencies: ["TuistGenerator", "TuistSupportTesting", "TuistCoreTesting", "TuistGeneratorTesting"] + dependencies: [ + "TuistGenerator", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistGeneratorTesting", + ] ), .target( name: "TuistCache", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "RxSwift"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + rxSwiftDependency, + ] ), .testTarget( name: "TuistCacheTests", - dependencies: ["TuistCache", "TuistSupportTesting", "TuistCoreTesting", "RxBlocking", "TuistCacheTesting"] + dependencies: [ + "TuistCache", + "TuistSupportTesting", + "TuistCoreTesting", + rxBlockingDependency, + "TuistCacheTesting", + ] ), .target( name: "TuistCacheTesting", - dependencies: ["TuistCache", "SwiftToolsSupport-auto", "TuistCore", "RxTest", "RxSwift", "TuistSupportTesting"] + dependencies: [ + "TuistCache", + swiftToolsSupportDependency, + "TuistCore", + rxTestDependency, + rxSwiftDependency, + "TuistSupportTesting", + ] ), .target( name: "TuistCloud", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "RxSwift"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + rxSwiftDependency, + ] ), .testTarget( name: "TuistCloudTests", - dependencies: ["TuistCloud", "TuistSupportTesting", "TuistCoreTesting", "RxBlocking"] + dependencies: [ + "TuistCloud", + "TuistSupportTesting", + "TuistCoreTesting", + rxBlockingDependency, + ] ), .target( name: "TuistCloudTesting", - dependencies: ["TuistCloud", "SwiftToolsSupport-auto", "TuistCore", "RxTest", "RxSwift"] + dependencies: [ + "TuistCloud", + swiftToolsSupportDependency, + "TuistCore", + rxTestDependency, + rxSwiftDependency, + ] ), .testTarget( name: "TuistCacheIntegrationTests", - dependencies: ["TuistCache", "TuistSupportTesting", "RxBlocking", "TuistCoreTesting"] + dependencies: [ + "TuistCache", + "TuistSupportTesting", + rxBlockingDependency, + "TuistCoreTesting", + ] ), .target( name: "TuistScaffold", - dependencies: ["SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "StencilSwiftKit", "Stencil"] + dependencies: [ + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + "StencilSwiftKit", + "Stencil", + ] ), .target( name: "TuistScaffoldTesting", @@ -180,43 +368,88 @@ let package = Package( ), .testTarget( name: "TuistScaffoldTests", - dependencies: ["TuistScaffold", "TuistSupportTesting", "TuistCoreTesting"] + dependencies: [ + "TuistScaffold", + "TuistSupportTesting", + "TuistCoreTesting", + ] ), .testTarget( name: "TuistScaffoldIntegrationTests", - dependencies: ["TuistScaffold", "TuistSupportTesting"] + dependencies: [ + "TuistScaffold", + "TuistSupportTesting", + ] ), .target( name: "TuistAutomation", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "XcbeautifyLib"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + beautifyDependency, + ] ), .testTarget( name: "TuistAutomationTests", - dependencies: ["TuistAutomation", "TuistSupportTesting", "TuistCoreTesting", "RxBlocking"] + dependencies: [ + "TuistAutomation", + "TuistSupportTesting", + "TuistCoreTesting", + rxBlockingDependency, + ] ), .target( name: "TuistAutomationTesting", - dependencies: ["TuistAutomation", "SwiftToolsSupport-auto", "TuistCore", "TuistCoreTesting", "ProjectDescription", "TuistSupportTesting"] + dependencies: [ + "TuistAutomation", + swiftToolsSupportDependency, + "TuistCore", + "TuistCoreTesting", + "ProjectDescription", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistAutomationIntegrationTests", - dependencies: ["TuistAutomation", "TuistSupportTesting", "RxBlocking"] + dependencies: [ + "TuistAutomation", + "TuistSupportTesting", + rxBlockingDependency, + ] ), .target( name: "TuistInsights", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "XcbeautifyLib"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + beautifyDependency, + ] ), .testTarget( name: "TuistInsightsTests", - dependencies: ["TuistInsights", "TuistSupportTesting"] + dependencies: [ + "TuistInsights", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistInsightsIntegrationTests", - dependencies: ["TuistInsights", "TuistSupportTesting"] + dependencies: [ + "TuistInsights", + "TuistSupportTesting", + ] ), .target( name: "TuistSigning", - dependencies: ["TuistCore", "TuistSupport", "CryptoSwift"] + dependencies: [ + "TuistCore", + "TuistSupport", + "CryptoSwift", + ] ), .target( name: "TuistSigningTesting", @@ -224,15 +457,26 @@ let package = Package( ), .testTarget( name: "TuistSigningTests", - dependencies: ["TuistSigning", "TuistSupportTesting", "TuistCoreTesting", "TuistSigningTesting"] + dependencies: [ + "TuistSigning", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistSigningTesting", + ] ), .testTarget( name: "TuistSigningIntegrationTests", - dependencies: ["TuistSigning", "TuistSupportTesting", "TuistCoreTesting", "TuistSigningTesting"] + dependencies: [ + "TuistSigning", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistSigningTesting", + ] ), .target( name: "TuistDependencies", - dependencies: ["TuistCore", "TuistSupport"] + dependencies: ["TuistCore", + "TuistSupport"] ), .target( name: "TuistDependenciesTesting", @@ -240,15 +484,30 @@ let package = Package( ), .testTarget( name: "TuistDependenciesTests", - dependencies: ["TuistDependencies", "TuistDependenciesTesting", "TuistCoreTesting", "TuistSupportTesting"] + dependencies: [ + "TuistDependencies", + "TuistDependenciesTesting", + "TuistCoreTesting", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistDependenciesIntegrationTests", - dependencies: ["TuistDependencies", "TuistDependenciesTesting", "TuistCoreTesting", "TuistSupportTesting"] + dependencies: [ + "TuistDependencies", + "TuistDependenciesTesting", + "TuistCoreTesting", + "TuistSupportTesting", + ] ), .target( name: "TuistMigration", - dependencies: ["TuistCore", "TuistSupport", "XcodeProj", "SwiftToolsSupport-auto"] + dependencies: [ + "TuistCore", + "TuistSupport", + "XcodeProj", + swiftToolsSupportDependency, + ] ), .target( name: "TuistMigrationTesting", @@ -256,15 +515,31 @@ let package = Package( ), .testTarget( name: "TuistMigrationTests", - dependencies: ["TuistMigration", "TuistSupportTesting", "TuistCoreTesting", "TuistMigrationTesting"] + dependencies: [ + "TuistMigration", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistMigrationTesting", + ] ), .testTarget( name: "TuistMigrationIntegrationTests", - dependencies: ["TuistMigration", "TuistSupportTesting", "TuistCoreTesting", "TuistMigrationTesting"] + dependencies: [ + "TuistMigration", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistMigrationTesting", + ] ), .target( name: "TuistAsyncQueue", - dependencies: ["TuistCore", "TuistSupport", "XcodeProj", "SwiftToolsSupport-auto", "Queuer"] + dependencies: [ + "TuistCore", + "TuistSupport", + "XcodeProj", + swiftToolsSupportDependency, + "Queuer", + ] ), .target( name: "TuistAsyncQueueTesting", @@ -272,27 +547,62 @@ let package = Package( ), .testTarget( name: "TuistAsyncQueueTests", - dependencies: ["TuistAsyncQueue", "TuistSupportTesting", "TuistCoreTesting", "TuistAsyncQueueTesting", "RxBlocking"] + dependencies: [ + "TuistAsyncQueue", + "TuistSupportTesting", + "TuistCoreTesting", + "TuistAsyncQueueTesting", + rxBlockingDependency, + ] ), .target( name: "TuistLoader", - dependencies: ["XcodeProj", "SwiftToolsSupport-auto", "TuistCore", "TuistSupport", "ProjectDescription"] + dependencies: [ + "XcodeProj", + swiftToolsSupportDependency, + "TuistCore", + "TuistSupport", + "ProjectDescription", + ] ), .target( name: "TuistLoaderTesting", - dependencies: ["TuistLoader", "SwiftToolsSupport-auto", "TuistCore", "ProjectDescription", "TuistSupportTesting"] + dependencies: [ + "TuistLoader", + swiftToolsSupportDependency, + "TuistCore", + "ProjectDescription", + "TuistSupportTesting", + ] ), .testTarget( name: "TuistLoaderTests", - dependencies: ["TuistLoader", "TuistSupportTesting", "TuistLoaderTesting", "TuistCoreTesting", "RxBlocking"] + dependencies: [ + "TuistLoader", + "TuistSupportTesting", + "TuistLoaderTesting", + "TuistCoreTesting", + rxBlockingDependency, + ] ), .testTarget( name: "TuistLoaderIntegrationTests", - dependencies: ["TuistLoader", "TuistSupportTesting", "ProjectDescription", "RxBlocking"] + dependencies: [ + "TuistLoader", + "TuistSupportTesting", + "ProjectDescription", + rxBlockingDependency, + ] ), .testTarget( name: "TuistIntegrationTests", - dependencies: ["TuistGenerator", "TuistSupportTesting", "TuistSupport", "TuistCoreTesting", "TuistLoaderTesting"] + dependencies: [ + "TuistGenerator", + "TuistSupportTesting", + "TuistSupport", + "TuistCoreTesting", + "TuistLoaderTesting", + ] ), ] ) diff --git a/Sources/TuistAutomation/Utilities/BuildGraphInspector.swift b/Sources/TuistAutomation/Utilities/BuildGraphInspector.swift index 7290313c9..c5f35bb89 100644 --- a/Sources/TuistAutomation/Utilities/BuildGraphInspector.swift +++ b/Sources/TuistAutomation/Utilities/BuildGraphInspector.swift @@ -105,7 +105,7 @@ public class BuildGraphInspector: BuildGraphInspecting { public func buildableEntrySchemes(graph: Graph) -> [Scheme] { let projects = Set(graph.entryNodes.compactMap { ($0 as? TargetNode)?.project }) return projects - .flatMap { $0.schemes } + .flatMap(\.schemes) .filter { $0.buildAction?.targets.isEmpty == false } .sorted(by: { $0.name < $1.name }) } diff --git a/Sources/TuistAutomation/XcodeBuild/XcodeBuildController.swift b/Sources/TuistAutomation/XcodeBuild/XcodeBuildController.swift index b15a7c4dc..c2c559b30 100644 --- a/Sources/TuistAutomation/XcodeBuild/XcodeBuildController.swift +++ b/Sources/TuistAutomation/XcodeBuild/XcodeBuildController.swift @@ -48,7 +48,7 @@ public final class XcodeBuildController: XcodeBuildControlling { command.append(contentsOf: target.xcodebuildArguments) // Arguments - command.append(contentsOf: arguments.flatMap { $0.arguments }) + command.append(contentsOf: arguments.flatMap(\.arguments)) return run(command: command) } @@ -75,7 +75,7 @@ public final class XcodeBuildController: XcodeBuildControlling { command.append(contentsOf: target.xcodebuildArguments) // Arguments - command.append(contentsOf: arguments.flatMap { $0.arguments }) + command.append(contentsOf: arguments.flatMap(\.arguments)) switch destination { case let .device(udid): @@ -111,7 +111,7 @@ public final class XcodeBuildController: XcodeBuildControlling { command.append(contentsOf: ["-archivePath", archivePath.pathString]) // Arguments - command.append(contentsOf: arguments.flatMap { $0.arguments }) + command.append(contentsOf: arguments.flatMap(\.arguments)) return run(command: command) } diff --git a/Sources/TuistCache/Cache/CacheRemoteStorage.swift b/Sources/TuistCache/Cache/CacheRemoteStorage.swift index 0a112f1ff..c778f6472 100644 --- a/Sources/TuistCache/Cache/CacheRemoteStorage.swift +++ b/Sources/TuistCache/Cache/CacheRemoteStorage.swift @@ -77,7 +77,7 @@ public final class CacheRemoteStorage: CacheStoring { let resource = try CloudCacheResponse.fetchResource(hash: hash, cloud: cloudConfig) return cloudClient .request(resource) - .map { $0.object.data.url } + .map(\.object.data.url) .flatMap { (url: URL) in self.fileClient.download(url: url) .do(onSubscribed: { logger.info("Downloading cache artifact with hash \(hash).") }) diff --git a/Sources/TuistCache/ContentHashing/CoreDataModelsContentHasher.swift b/Sources/TuistCache/ContentHashing/CoreDataModelsContentHasher.swift index f1aeb580c..39de1b761 100644 --- a/Sources/TuistCache/ContentHashing/CoreDataModelsContentHasher.swift +++ b/Sources/TuistCache/ContentHashing/CoreDataModelsContentHasher.swift @@ -24,7 +24,7 @@ public final class CoreDataModelsContentHasher: CoreDataModelsContentHashing { let contentHash = try contentHasher.hash(path: cdModel.path) let currentVersionHash = try contentHasher.hash([cdModel.currentVersion]) let cdModelHash = try contentHasher.hash([contentHash, currentVersionHash]) - let versionsHash = try contentHasher.hash(cdModel.versions.map { $0.pathString }) + let versionsHash = try contentHasher.hash(cdModel.versions.map(\.pathString)) stringsToHash.append(cdModelHash) stringsToHash.append(versionsHash) } diff --git a/Sources/TuistCache/GraphMappers/CacheGraphMutator.swift b/Sources/TuistCache/GraphMappers/CacheGraphMutator.swift index 7b1934ca2..b0e5a6727 100644 --- a/Sources/TuistCache/GraphMappers/CacheGraphMutator.swift +++ b/Sources/TuistCache/GraphMappers/CacheGraphMutator.swift @@ -42,7 +42,7 @@ class CacheGraphMutator: CacheGraphMutating { public func map(graph: Graph, precompiledFrameworks: [TargetNode: AbsolutePath], sources: Set) throws -> Graph { var visitedPrecompiledFrameworkPaths: [TargetNode: VisitedPrecompiledFramework?] = [:] var loadedPrecompiledNodes: [AbsolutePath: PrecompiledNode] = [:] - let userSpecifiedSourceTargets = graph.targets.flatMap { $0.value }.filter { sources.contains($0.target.name) } + let userSpecifiedSourceTargets = graph.targets.flatMap(\.value).filter { sources.contains($0.target.name) } let userSpecifiedSourceTestTargets = userSpecifiedSourceTargets.flatMap { graph.testTargetsDependingOn(path: $0.path, name: $0.name) } var sourceTargets: Set = Set(userSpecifiedSourceTargets) diff --git a/Sources/TuistCore/Graph/Graph.swift b/Sources/TuistCore/Graph/Graph.swift index 6e01cb31e..14faeab46 100644 --- a/Sources/TuistCore/Graph/Graph.swift +++ b/Sources/TuistCore/Graph/Graph.swift @@ -78,7 +78,7 @@ public class Graph: Encodable, Equatable { workspace: workspace, projects: Array(cache.projects.values), cocoapods: Array(cache.cocoapodsNodes.values), - packages: Array(cache.packages.flatMap { $0.value }), + packages: Array(cache.packages.flatMap(\.value)), precompiled: Array(cache.precompiledNodes.values), targets: cache.targetNodes.mapValues { Array($0.values) } ) diff --git a/Sources/TuistCore/Graph/GraphCircularDetector.swift b/Sources/TuistCore/Graph/GraphCircularDetector.swift index 08ce4469f..af97d59bd 100644 --- a/Sources/TuistCore/Graph/GraphCircularDetector.swift +++ b/Sources/TuistCore/Graph/GraphCircularDetector.swift @@ -62,7 +62,7 @@ public final class GraphCircularDetector: GraphCircularDetecting { if currentPath.contains(node) { let cyclePath = currentPath + [node] - throw GraphLoadingError.circularDependency(cyclePath.map { $0.element }) + throw GraphLoadingError.circularDependency(cyclePath.map(\.element)) } var currentPath = currentPath diff --git a/Sources/TuistCore/Graph/GraphTraverser.swift b/Sources/TuistCore/Graph/GraphTraverser.swift index f5d1e7e4e..8c3362882 100644 --- a/Sources/TuistCore/Graph/GraphTraverser.swift +++ b/Sources/TuistCore/Graph/GraphTraverser.swift @@ -16,15 +16,15 @@ public final class GraphTraverser: GraphTraversing { } public func directTargetDependencies(path: AbsolutePath, name: String) -> [Target] { - graph.targetDependencies(path: path, name: name).map { $0.target } + graph.targetDependencies(path: path, name: name).map(\.target) } public func appExtensionDependencies(path: AbsolutePath, name: String) -> [Target] { - graph.appExtensionDependencies(path: path, name: name).map { $0.target } + graph.appExtensionDependencies(path: path, name: name).map(\.target) } public func resourceBundleDependencies(path: AbsolutePath, name: String) -> [Target] { - graph.resourceBundleDependencies(path: path, name: name).map { $0.target } + graph.resourceBundleDependencies(path: path, name: name).map(\.target) } public func testTargetsDependingOn(path: AbsolutePath, name: String) -> [Target] { @@ -36,6 +36,6 @@ public final class GraphTraverser: GraphTraversing { } public func appClipsDependency(path: AbsolutePath, name: String) -> Target? { - graph.appClipsDependency(path: path, name: name).map { $0.target } + graph.appClipsDependency(path: path, name: name).map(\.target) } } diff --git a/Sources/TuistCore/Models/InfoPlist.swift b/Sources/TuistCore/Models/InfoPlist.swift index 39511169d..7f0f508c9 100644 --- a/Sources/TuistCore/Models/InfoPlist.swift +++ b/Sources/TuistCore/Models/InfoPlist.swift @@ -13,7 +13,7 @@ public enum InfoPlist: Equatable { public var value: Any { switch self { case let .array(array): - return array.map { $0.value } + return array.map(\.value) case let .boolean(boolean): return boolean case let .dictionary(dictionary): diff --git a/Sources/TuistCore/Models/Project.swift b/Sources/TuistCore/Models/Project.swift index e50305a21..fc69872ab 100644 --- a/Sources/TuistCore/Models/Project.swift +++ b/Sources/TuistCore/Models/Project.swift @@ -117,10 +117,10 @@ public struct Project: Hashable, Equatable, CustomStringConvertible, CustomDebug // Second criteria: Most dependent targets first. let secondDependencies = graph.targetDependencies(path: self.path, name: second.name) .filter { $0.path == self.path } - .map { $0.target.name } + .map(\.target.name) let firstDependencies = graph.targetDependencies(path: self.path, name: first.name) .filter { $0.path == self.path } - .map { $0.target.name } + .map(\.target.name) if secondDependencies.contains(first.name) { return true diff --git a/Sources/TuistCore/Models/Settings.swift b/Sources/TuistCore/Models/Settings.swift index 875a66fd6..0e2be4626 100644 --- a/Sources/TuistCore/Models/Settings.swift +++ b/Sources/TuistCore/Models/Settings.swift @@ -127,7 +127,7 @@ extension Dictionary where Key == BuildConfiguration, Value == Configuration? { public func xcconfigs() -> [AbsolutePath] { sortedByBuildConfigurationName() - .map { $0.value } + .map(\.value) .compactMap { $0?.xcconfig } } } diff --git a/Sources/TuistDoc/SwiftDocController.swift b/Sources/TuistDoc/SwiftDocController.swift index e5736a742..d96c2967e 100644 --- a/Sources/TuistDoc/SwiftDocController.swift +++ b/Sources/TuistDoc/SwiftDocController.swift @@ -47,7 +47,7 @@ public struct SwiftDocController: SwiftDocControlling { "--module-name", moduleName, "--base-url", baseURL, "--output", outputDirectory] - arguments.append(contentsOf: Set(paths.map { $0.dirname })) + arguments.append(contentsOf: Set(paths.map(\.dirname))) logger.pretty("Generating documentation for \(.bold(.raw(moduleName))).") _ = try System.shared.observable(arguments) diff --git a/Sources/TuistEnvKit/Commands/TuistCommand.swift b/Sources/TuistEnvKit/Commands/TuistCommand.swift index 5df60ea98..e5e28dc45 100644 --- a/Sources/TuistEnvKit/Commands/TuistCommand.swift +++ b/Sources/TuistEnvKit/Commands/TuistCommand.swift @@ -50,7 +50,9 @@ public struct TuistCommand: ParsableCommand { private static func parse() throws -> [String]? { let arguments = Array(processArguments().dropFirst()) guard let firstArgument = arguments.first else { return nil } + // swiftformat:disable preferKeyPath let containsCommand = configuration.subcommands.map { $0.configuration.commandName }.contains(firstArgument) + // swiftformat:enable preferKeyPath if containsCommand { return arguments } diff --git a/Sources/TuistEnvKit/Installer/Installer.swift b/Sources/TuistEnvKit/Installer/Installer.swift index f8eb5e319..5bf421afa 100644 --- a/Sources/TuistEnvKit/Installer/Installer.swift +++ b/Sources/TuistEnvKit/Installer/Installer.swift @@ -141,7 +141,7 @@ final class Installer: Installing { .materialize() if case let .failed(elements, error) = gitCheckoutResult { - if elements.map({ $0.value }).first(where: { $0.contains("did not match any file(s) known to git") }) != nil { + if elements.map(\.value).first(where: { $0.contains("did not match any file(s) known to git") }) != nil { throw InstallerError.versionNotFound(version) } else { throw error diff --git a/Sources/TuistEnvKit/Services/InstallService.swift b/Sources/TuistEnvKit/Services/InstallService.swift index a6dbbd8a2..c0b75b69d 100644 --- a/Sources/TuistEnvKit/Services/InstallService.swift +++ b/Sources/TuistEnvKit/Services/InstallService.swift @@ -16,7 +16,7 @@ final class InstallService { } func run(version: String, force: Bool) throws { - let versions = versionsController.versions().map { $0.description } + let versions = versionsController.versions().map(\.description) if versions.contains(version) { logger.warning("Version \(version) already installed, skipping") return diff --git a/Sources/TuistEnvKit/Services/UninstallService.swift b/Sources/TuistEnvKit/Services/UninstallService.swift index fb98b9da7..0dc0291ec 100644 --- a/Sources/TuistEnvKit/Services/UninstallService.swift +++ b/Sources/TuistEnvKit/Services/UninstallService.swift @@ -16,7 +16,7 @@ final class UninstallService { } func run(version: String) throws { - let versions = versionsController.versions().map { $0.description } + let versions = versionsController.versions().map(\.description) if versions.contains(version) { try versionsController.uninstall(version: version) logger.notice("Version \(version) uninstalled", metadata: .success) diff --git a/Sources/TuistGenerator/Generator/LinkGenerator.swift b/Sources/TuistGenerator/Generator/LinkGenerator.swift index 837d29562..071238304 100644 --- a/Sources/TuistGenerator/Generator/LinkGenerator.swift +++ b/Sources/TuistGenerator/Generator/LinkGenerator.swift @@ -237,7 +237,7 @@ final class LinkGenerator: LinkGenerating { pbxTarget: PBXTarget, sourceRootPath: AbsolutePath) throws { - let precompiledPaths = dependencies.compactMap { $0.precompiledPath } + let precompiledPaths = dependencies.compactMap(\.precompiledPath) .map { LinkGeneratorPath.absolutePath($0.removingLastComponent()) } let sdkPaths = dependencies.compactMap { (dependency: GraphDependencyReference) -> LinkGeneratorPath? in if case let GraphDependencyReference.sdk(_, _, source) = dependency { diff --git a/Sources/TuistGenerator/Generator/ProjectFileElements.swift b/Sources/TuistGenerator/Generator/ProjectFileElements.swift index 3ab517956..93c9ec10a 100644 --- a/Sources/TuistGenerator/Generator/ProjectFileElements.swift +++ b/Sources/TuistGenerator/Generator/ProjectFileElements.swift @@ -110,9 +110,9 @@ class ProjectFileElements { func targetFiles(target: Target) throws -> Set { var files = Set() - files.formUnion(target.sources.map { $0.path }) - files.formUnion(target.coreDataModels.map { $0.path }) - files.formUnion(target.coreDataModels.flatMap { $0.versions }) + files.formUnion(target.sources.map(\.path)) + files.formUnion(target.coreDataModels.map(\.path)) + files.formUnion(target.coreDataModels.flatMap(\.versions)) if let headers = target.headers { files.formUnion(headers.public) diff --git a/Sources/TuistGenerator/Generator/ProjectGroups.swift b/Sources/TuistGenerator/Generator/ProjectGroups.swift index 8390a1cf4..d448010fc 100644 --- a/Sources/TuistGenerator/Generator/ProjectGroups.swift +++ b/Sources/TuistGenerator/Generator/ProjectGroups.swift @@ -114,7 +114,7 @@ class ProjectGroups { } private static func extractProjectGroupNames(from project: Project) -> [String] { - let groups = [project.filesGroup] + project.targets.map { $0.filesGroup } + let groups = [project.filesGroup] + project.targets.map(\.filesGroup) let groupNames: [String] = groups.compactMap { switch $0 { case let .group(name: groupName): diff --git a/Sources/TuistGenerator/Linter/GraphLinter.swift b/Sources/TuistGenerator/Linter/GraphLinter.swift index 2cc2f665b..c3fa5819b 100644 --- a/Sources/TuistGenerator/Linter/GraphLinter.swift +++ b/Sources/TuistGenerator/Linter/GraphLinter.swift @@ -111,7 +111,7 @@ public class GraphLinter: GraphLinting { } private func lintMismatchingConfigurations(graph: Graph) -> [LintingIssue] { - let entryNodeProjects = graph.entryNodes.compactMap { $0 as? TargetNode }.map { $0.project } + let entryNodeProjects = graph.entryNodes.compactMap { $0 as? TargetNode }.map(\.project) let knownConfigurations = entryNodeProjects.reduce(into: Set()) { $0.formUnion(Set($1.settings.configurations.keys)) diff --git a/Sources/TuistGenerator/Linter/ProjectLinter.swift b/Sources/TuistGenerator/Linter/ProjectLinter.swift index a80186614..e166cf4ff 100644 --- a/Sources/TuistGenerator/Linter/ProjectLinter.swift +++ b/Sources/TuistGenerator/Linter/ProjectLinter.swift @@ -46,7 +46,7 @@ class ProjectLinter: ProjectLinting { private func lintNotDuplicatedTargets(project: Project) -> [LintingIssue] { var issues: [LintingIssue] = [] - let duplicatedTargets = project.targets.map { $0.name } + let duplicatedTargets = project.targets.map(\.name) .reduce(into: [String: Int]()) { $0[$1] = ($0[$1] ?? 0) + 1 } .filter { $0.value > 1 } .keys diff --git a/Sources/TuistGenerator/Linter/SchemeLinter.swift b/Sources/TuistGenerator/Linter/SchemeLinter.swift index 2cc09eed6..d911c1203 100644 --- a/Sources/TuistGenerator/Linter/SchemeLinter.swift +++ b/Sources/TuistGenerator/Linter/SchemeLinter.swift @@ -61,7 +61,7 @@ private extension SchemeLinter { } func lintCodeCoverageTargets(schemes: [Scheme], targets: [Target]) -> [LintingIssue] { - let targetNames = targets.map { $0.name } + let targetNames = targets.map(\.name) var issues: [LintingIssue] = [] for scheme in schemes { diff --git a/Sources/TuistGenerator/Mappers/AutogeneratedSchemesProjectMapper.swift b/Sources/TuistGenerator/Mappers/AutogeneratedSchemesProjectMapper.swift index b466f2209..9255b3c83 100644 --- a/Sources/TuistGenerator/Mappers/AutogeneratedSchemesProjectMapper.swift +++ b/Sources/TuistGenerator/Mappers/AutogeneratedSchemesProjectMapper.swift @@ -15,7 +15,7 @@ public final class AutogeneratedSchemesProjectMapper: ProjectMapping { // MARK: - ProjectMapping public func map(project: Project) throws -> (Project, [SideEffectDescriptor]) { - let schemeNames = Set(project.schemes.map { $0.name }) + let schemeNames = Set(project.schemes.map(\.name)) let schemes = project.schemes let autogeneratedSchemes = project.targets.compactMap { (target: Target) -> Scheme? in diff --git a/Sources/TuistGenerator/Writers/XcodeProjWriter.swift b/Sources/TuistGenerator/Writers/XcodeProjWriter.swift index 990c46494..9100aab74 100644 --- a/Sources/TuistGenerator/Writers/XcodeProjWriter.swift +++ b/Sources/TuistGenerator/Writers/XcodeProjWriter.swift @@ -58,7 +58,7 @@ public final class XcodeProjWriter: XcodeProjWriting { let xcodeProj = descriptor.xcodeProj let sharedData = xcodeProj.sharedData ?? XCSharedData(schemes: []) - sharedData.schemes.append(contentsOf: sharedSchemes.map { $0.xcScheme }) + sharedData.schemes.append(contentsOf: sharedSchemes.map(\.xcScheme)) xcodeProj.sharedData = sharedData return ProjectDescriptor(path: descriptor.path, diff --git a/Sources/TuistKit/Generator/Generator.swift b/Sources/TuistKit/Generator/Generator.swift index 01c2cfda1..9cf64997c 100644 --- a/Sources/TuistKit/Generator/Generator.swift +++ b/Sources/TuistKit/Generator/Generator.swift @@ -111,7 +111,7 @@ class Generator: Generating { let projectMapper = projectMapperProvider.mapper(config: config) let updatedModels = try models.map(projectMapper.map) let updatedProjects = updatedModels.map(\.0) - let modelMapperSideEffects = updatedModels.flatMap { $0.1 } + let modelMapperSideEffects = updatedModels.flatMap(\.1) // Load Graph let cachedModelLoader = CachedModelLoader(projects: updatedProjects) @@ -238,7 +238,7 @@ class Generator: Generating { let (updatedGraph, graphMapperSideEffects) = try graphMapperProvider.mapper(config: config).map(graph: graph) let updatedWorkspace = updatedModels .workspace - .merging(projects: updatedGraph.projects.map { $0.path }) + .merging(projects: updatedGraph.projects.map(\.path)) return ( project, diff --git a/Sources/TuistKit/ProjectEditor/ProjectEditor.swift b/Sources/TuistKit/ProjectEditor/ProjectEditor.swift index 73b71c95b..65ed720e8 100644 --- a/Sources/TuistKit/ProjectEditor/ProjectEditor.swift +++ b/Sources/TuistKit/ProjectEditor/ProjectEditor.swift @@ -119,7 +119,7 @@ final class ProjectEditor: ProjectEditing { setupPath: setupPath, configPath: configPath, dependenciesPath: dependenciesPath, - manifests: manifests.map { $0.1 }, + manifests: manifests.map(\.1), helpers: helpers, templates: templates, projectDescriptionPath: projectDesciptionPath) diff --git a/Sources/TuistKit/Services/DocService.swift b/Sources/TuistKit/Services/DocService.swift index ff6867777..ad7df5fdc 100644 --- a/Sources/TuistKit/Services/DocService.swift +++ b/Sources/TuistKit/Services/DocService.swift @@ -81,7 +81,7 @@ final class DocService { let targets = graph.targets .flatMap(\.value) .filter { !$0.dependsOnXCTest } - .map { $0.target } + .map(\.target) guard let target = targets.first(where: { $0.name == targetName }) else { throw DocServiceError.targetNotFound(name: targetName) diff --git a/Sources/TuistKit/Services/Lint/LintCodeService.swift b/Sources/TuistKit/Services/Lint/LintCodeService.swift index f78d4e0ed..a6cd384c5 100644 --- a/Sources/TuistKit/Services/Lint/LintCodeService.swift +++ b/Sources/TuistKit/Services/Lint/LintCodeService.swift @@ -102,21 +102,21 @@ final class LintCodeService { return try getTargetSources(targetName: targetName, graph: graph) } else { return graph.targets - .flatMap { $0.value } - .flatMap { $0.target.sources } - .map { $0.path } + .flatMap(\.value) + .flatMap(\.target.sources) + .map(\.path) } } private func getTargetSources(targetName: String, graph: Graph) throws -> [AbsolutePath] { - guard let target = graph.targets.flatMap({ $0.value }) + guard let target = graph.targets.flatMap(\.value) .map(\.target) .first(where: { $0.name == targetName }) else { throw LintCodeServiceError.targetNotFound(targetName) } - let sources = target.sources.map { $0.path } + let sources = target.sources.map(\.path) if sources.isEmpty { throw LintCodeServiceError.lintableFilesForTargetNotFound(targetName) diff --git a/Sources/TuistLoader/Loaders/ManifestLoader.swift b/Sources/TuistLoader/Loaders/ManifestLoader.swift index 1d3f67091..b85325abb 100644 --- a/Sources/TuistLoader/Loaders/ManifestLoader.swift +++ b/Sources/TuistLoader/Loaders/ManifestLoader.swift @@ -121,7 +121,7 @@ public class ManifestLoader: ManifestLoading { } public func manifests(at path: AbsolutePath) -> Set { - Set(manifestFilesLocator.locateProjectManifests(at: path).map { $0.0 }) + Set(manifestFilesLocator.locateProjectManifests(at: path).map(\.0)) } public func loadConfig(at path: AbsolutePath) throws -> ProjectDescription.Config { @@ -226,7 +226,7 @@ public class ManifestLoader: ManifestLoading { switch result { case let .completed(elements): - return elements.filter { $0.isStandardOutput }.map { $0.value }.reduce(into: Data()) { $0.append($1) } + return elements.filter { $0.isStandardOutput }.map(\.value).reduce(into: Data()) { $0.append($1) } case let .failed(_, error): throw error } diff --git a/Sources/TuistLoader/ProjectDEscriptionHelpers/ProjectDescriptionHelpersBuilder.swift b/Sources/TuistLoader/ProjectDEscriptionHelpers/ProjectDescriptionHelpersBuilder.swift index 2f5f1f700..5593e9d92 100644 --- a/Sources/TuistLoader/ProjectDEscriptionHelpers/ProjectDescriptionHelpersBuilder.swift +++ b/Sources/TuistLoader/ProjectDEscriptionHelpers/ProjectDescriptionHelpersBuilder.swift @@ -101,7 +101,7 @@ final class ProjectDescriptionHelpersBuilder: ProjectDescriptionHelpersBuilding command.append(contentsOf: ["-framework", "ProjectDescription"]) } - command.append(contentsOf: files.map { $0.pathString }) + command.append(contentsOf: files.map(\.pathString)) return command } } diff --git a/Sources/TuistLoader/Up/Carthage.swift b/Sources/TuistLoader/Up/Carthage.swift index c7a3384d9..c35fa5db9 100644 --- a/Sources/TuistLoader/Up/Carthage.swift +++ b/Sources/TuistLoader/Up/Carthage.swift @@ -50,7 +50,7 @@ final class Carthage: Carthaging { if !platforms.isEmpty { command.append("--platform") - command.append(platforms.map { $0.caseValue }.joined(separator: ",")) + command.append(platforms.map(\.caseValue).joined(separator: ",")) } command.append(contentsOf: dependencies) diff --git a/Sources/TuistLoader/Up/Rome.swift b/Sources/TuistLoader/Up/Rome.swift index e97da1198..12db47cac 100644 --- a/Sources/TuistLoader/Up/Rome.swift +++ b/Sources/TuistLoader/Up/Rome.swift @@ -35,7 +35,7 @@ final class Rome: Romeaging { if !platforms.isEmpty { command.append("--platform") - command.append(platforms.map { $0.caseValue }.joined(separator: ",")) + command.append(platforms.map(\.caseValue).joined(separator: ",")) } try System.shared.run(command) diff --git a/Sources/TuistSupport/Utils/TextTable.swift b/Sources/TuistSupport/Utils/TextTable.swift index 17f69089f..b8486e337 100644 --- a/Sources/TuistSupport/Utils/TextTable.swift +++ b/Sources/TuistSupport/Utils/TextTable.swift @@ -93,7 +93,7 @@ public struct TextTable { } private func render(cells: [Cell], in table: inout String) { - table += cells.map { $0.value }.joined(separator: " ") + table += cells.map(\.value).joined(separator: " ") } private func calculateWidths(for data: C) -> [Int] where C.Iterator.Element == T { @@ -101,7 +101,7 @@ public struct TextTable { // Headers let headers = mapper(first) - var widths = headers.map { $0.title.count } + var widths = headers.map(\.title.count) // Data Rows for element in data { diff --git a/Templates/Package.swift b/Templates/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/Templates/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/Tests/TuistCoreTests/Graph/GraphTests.swift b/Tests/TuistCoreTests/Graph/GraphTests.swift index c6bfb66ad..8b20ba188 100644 --- a/Tests/TuistCoreTests/Graph/GraphTests.swift +++ b/Tests/TuistCoreTests/Graph/GraphTests.swift @@ -67,7 +67,7 @@ final class GraphTests: TuistUnitTestCase { let testDependencies = graph.testTargetsDependingOn(path: project.path, name: target.name) // then - let testDependenciesNames = try XCTUnwrap(testDependencies).map { $0.name } + let testDependenciesNames = try XCTUnwrap(testDependencies).map(\.name) XCTAssertEqual(testDependenciesNames.count, 3) XCTAssertEqual(testDependenciesNames, ["MainTests1", "MainTests2", "MainTests3"]) } diff --git a/Tests/TuistCoreTests/Graph/Mappers/TargetNodeGraphMapperTests.swift b/Tests/TuistCoreTests/Graph/Mappers/TargetNodeGraphMapperTests.swift index a9f8b13eb..e394087a7 100644 --- a/Tests/TuistCoreTests/Graph/Mappers/TargetNodeGraphMapperTests.swift +++ b/Tests/TuistCoreTests/Graph/Mappers/TargetNodeGraphMapperTests.swift @@ -80,7 +80,7 @@ class TargetNodeGraphMapperTests: XCTestCase { let (results, _) = subject.map(graph: graph) // Then - XCTAssertEqual(results.targets.flatMap { $0.value }.count, 1) + XCTAssertEqual(results.targets.flatMap(\.value).count, 1) XCTAssertEqual(results.projects.count, 1) } @@ -107,7 +107,7 @@ class TargetNodeGraphMapperTests: XCTestCase { _ = subject.map(graph: graph) // Then - XCTAssertEqual(graph.targets.flatMap { $0.value }.count, 3) + XCTAssertEqual(graph.targets.flatMap(\.value).count, 3) XCTAssertEqual(graph.projects.count, 2) } } diff --git a/Tests/TuistCoreTests/Models/SettingsTests.swift b/Tests/TuistCoreTests/Models/SettingsTests.swift index f282fa30c..38906191f 100644 --- a/Tests/TuistCoreTests/Models/SettingsTests.swift +++ b/Tests/TuistCoreTests/Models/SettingsTests.swift @@ -18,7 +18,7 @@ final class SettingsTests: XCTestCase { let got = configurations.xcconfigs() // Then - XCTAssertEqual(got.map { $0.pathString }, ["/A", "/B", "/D"]) + XCTAssertEqual(got.map(\.pathString), ["/A", "/B", "/D"]) } func testSortedByBuildConfigurationName() { @@ -34,7 +34,7 @@ final class SettingsTests: XCTestCase { let got = configurations.sortedByBuildConfigurationName() // Then - XCTAssertEqual(got.map { $0.0.name }, ["A", "B", "C", "D"]) + XCTAssertEqual(got.map(\.0.name), ["A", "B", "C", "D"]) } func testDefaultDebugConfigurationWhenDefaultExists() { diff --git a/Tests/TuistGeneratorIntegrationTests/Generator/XcodeProjWriterTests.swift b/Tests/TuistGeneratorIntegrationTests/Generator/XcodeProjWriterTests.swift index 74977724b..afdf6b0e3 100644 --- a/Tests/TuistGeneratorIntegrationTests/Generator/XcodeProjWriterTests.swift +++ b/Tests/TuistGeneratorIntegrationTests/Generator/XcodeProjWriterTests.swift @@ -120,7 +120,7 @@ final class XcodeProjWriterTests: TuistTestCase { // Then let fileHandler = FileHandler.shared - let schemes = fileHandler.glob(xcodeProjPath, glob: "**/*.xcscheme").map { $0.basename } + let schemes = fileHandler.glob(xcodeProjPath, glob: "**/*.xcscheme").map(\.basename) XCTAssertEqual(schemes, [ "SchemeA.xcscheme", "UserScheme.xcscheme", @@ -141,7 +141,7 @@ final class XcodeProjWriterTests: TuistTestCase { let fileHandler = FileHandler.shared let username = NSUserName() let schemesPath = xcodeProjPath.appending(components: "xcuserdata", "\(username).xcuserdatad", "xcschemes") - let schemes = fileHandler.glob(schemesPath, glob: "*.xcscheme").map { $0.basename } + let schemes = fileHandler.glob(schemesPath, glob: "*.xcscheme").map(\.basename) XCTAssertEqual(schemes, [ "UserScheme.xcscheme", ]) diff --git a/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift b/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift index 1ca329e4a..44aec183c 100644 --- a/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift +++ b/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift @@ -18,7 +18,7 @@ class XcodeprojExtrasTests: XCTestCase { let sorted = elements.sorted(by: PBXFileElement.filesBeforeGroupsSort) // Then - XCTAssertEqual(sorted.map { $0.nameOrPath }, [ + XCTAssertEqual(sorted.map(\.nameOrPath), [ // Files "c", "d", diff --git a/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift index aab5ae71c..f73dc6acc 100644 --- a/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift @@ -51,7 +51,7 @@ final class BuildPhaseGeneratorTests: TuistUnitTestCase { SourceFile(path: "/test/file2.swift"), ] - let fileElements = createFileElements(for: sources.map { $0.path }) + let fileElements = createFileElements(for: sources.map(\.path)) // When try subject.generateSourcesBuildPhase(files: sources, @@ -146,7 +146,7 @@ final class BuildPhaseGeneratorTests: TuistUnitTestCase { let buildPhase = try target.sourcesBuildPhase() let buildFiles = buildPhase?.files ?? [] - XCTAssertEqual(buildFiles.map { $0.file }, [ + XCTAssertEqual(buildFiles.map(\.file), [ fileElements.elements["/path/sources/OTTSiriExtension.intentdefinition"], ]) } @@ -312,7 +312,7 @@ final class BuildPhaseGeneratorTests: TuistUnitTestCase { // Then let buildPhase = nativeTarget.buildPhases.first - XCTAssertEqual(buildPhase?.files?.map { $0.file }, [ + XCTAssertEqual(buildPhase?.files?.map(\.file), [ fileElements.elements["/path/resources/Main.storyboard"], fileElements.elements["/path/resources/App.strings"], ]) diff --git a/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift index ec6f10d55..355d4bdb4 100644 --- a/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift @@ -494,7 +494,7 @@ final class LinkGeneratorErrorTests: XCTestCase { let buildPhase = try pbxTarget.frameworksBuildPhase() XCTAssertNotNil(buildPhase) - XCTAssertEqual(buildPhase?.files?.map { $0.file }, [ + XCTAssertEqual(buildPhase?.files?.map(\.file), [ requiredFile, optionalFile, ]) diff --git a/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift index 569d5c59f..44f80a261 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift @@ -260,7 +260,7 @@ final class ProjectDescriptorGeneratorTests: TuistUnitTestCase { // Then let pbxproj = got.xcodeProj.pbxproj let rootGroup = try XCTUnwrap(pbxproj.rootGroup()) - let paths = rootGroup.children.compactMap { $0.path } + let paths = rootGroup.children.compactMap(\.path) XCTAssertEqual(paths, [ "../Packages/LocalPackageA", ]) diff --git a/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift index 91e1c58c3..1b9c870c7 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift @@ -488,8 +488,8 @@ final class ProjectFileElementsTests: TuistUnitTestCase { let variantGroup = group.children.first as? PBXVariantGroup XCTAssertEqual(variantGroup?.name, "App.strings") XCTAssertNil(variantGroup?.path) - XCTAssertEqual(variantGroup?.children.map { $0.name }, ["en"]) - XCTAssertEqual(variantGroup?.children.map { $0.path }, ["en.lproj/App.strings"]) + XCTAssertEqual(variantGroup?.children.map(\.name), ["en"]) + XCTAssertEqual(variantGroup?.children.map(\.path), ["en.lproj/App.strings"]) XCTAssertEqual(variantGroup?.children.map { ($0 as? PBXFileReference)?.lastKnownFileType }, [ Xcode.filetype(extension: "strings"), ]) diff --git a/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift index 642937d0d..bfc014203 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift @@ -121,7 +121,9 @@ final class ProjectGroupsTests: XCTestCase { playgrounds: playgrounds) // Then + // swiftformat:disable preferKeyPath let paths = subject.sortedMain.children.compactMap { $0.nameOrPath } + // swiftformat:enable preferKeyPath XCTAssertEqual(paths, [ "P", "B", diff --git a/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift b/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift index df38afeec..84ddc117b 100644 --- a/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift +++ b/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift @@ -40,8 +40,8 @@ final class GraphToGraphVizMapperTests: XCTestCase { // When let got = subject.map(graph: graph, skipTestTargets: false, skipExternalDependencies: false) let expected = makeExpectedGraphViz() - let gotNodeIds = got.nodes.map { $0.id }.sorted() - let expectedNodeIds = expected.nodes.map { $0.id }.sorted() + let gotNodeIds = got.nodes.map(\.id).sorted() + let expectedNodeIds = expected.nodes.map(\.id).sorted() let gotEdgeIds = got.edges.map { $0.from + " -> " + $0.to }.sorted() let expectedEdgeIds = expected.edges.map { $0.from + " -> " + $0.to }.sorted() XCTAssertEqual(gotNodeIds, expectedNodeIds) @@ -69,8 +69,8 @@ final class GraphToGraphVizMapperTests: XCTestCase { // When let got = subject.map(graph: graph, skipTestTargets: false, skipExternalDependencies: true) let expected = makeExpectedGraphViz(includeExternalDependencies: false) - let gotNodeIds = got.nodes.map { $0.id }.sorted() - let expectedNodeIds = expected.nodes.map { $0.id }.sorted() + let gotNodeIds = got.nodes.map(\.id).sorted() + let expectedNodeIds = expected.nodes.map(\.id).sorted() let gotEdgeIds = got.edges.map { $0.from + " -> " + $0.to }.sorted() let expectedEdgeIds = expected.edges.map { $0.from + " -> " + $0.to }.sorted() diff --git a/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift b/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift index ea585bbe9..fd524ce3c 100644 --- a/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift +++ b/Tests/TuistIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift @@ -406,7 +406,7 @@ final class MultipleConfigurationsIntegrationTests: TuistUnitTestCase { return } - let configurationNames = Set(nativeTarget.buildConfigurationList?.buildConfigurations.map { $0.name } ?? []) + let configurationNames = Set(nativeTarget.buildConfigurationList?.buildConfigurations.map(\.name) ?? []) XCTAssertEqual(configurationNames, expectedConfigurations, file: file, line: line) } @@ -424,7 +424,7 @@ final class MultipleConfigurationsIntegrationTests: TuistUnitTestCase { return } - let configurationNames = Set(rootProject?.buildConfigurationList?.buildConfigurations.map { $0.name } ?? []) + let configurationNames = Set(rootProject?.buildConfigurationList?.buildConfigurations.map(\.name) ?? []) XCTAssertEqual(configurationNames, expectedConfigurations, file: file, line: line) } } diff --git a/Tests/TuistIntegrationTests/Generator/StableStructureIntegrationTests.swift b/Tests/TuistIntegrationTests/Generator/StableStructureIntegrationTests.swift index 41d9117ba..c9c2e56ff 100644 --- a/Tests/TuistIntegrationTests/Generator/StableStructureIntegrationTests.swift +++ b/Tests/TuistIntegrationTests/Generator/StableStructureIntegrationTests.swift @@ -91,7 +91,7 @@ final class StableXcodeProjIntegrationTests: TuistTestCase { extension XCWorkspace { var projectPaths: [String] { - data.children.flatMap { $0.projectPaths } + data.children.flatMap(\.projectPaths) } } @@ -102,7 +102,7 @@ extension XCWorkspaceDataElement { let path = file.location.path return path.hasSuffix(".xcodeproj") ? [path] : [] case let .group(elements): - return elements.children.flatMap { $0.projectPaths } + return elements.children.flatMap(\.projectPaths) } } } diff --git a/Tests/TuistIntegrationTests/Generator/TestModelGenerator.swift b/Tests/TuistIntegrationTests/Generator/TestModelGenerator.swift index d0d972fbc..bcec30003 100644 --- a/Tests/TuistIntegrationTests/Generator/TestModelGenerator.swift +++ b/Tests/TuistIntegrationTests/Generator/TestModelGenerator.swift @@ -45,7 +45,7 @@ final class TestModelGenerator { let modelLoader = MockGeneratorModelLoader(basePath: rootPath) let projects = try (0 ..< config.projects).map { try createProjectWithDependencies(name: "App\($0)") } - let workspace = try createWorkspace(path: rootPath, projects: projects.map { $0.name }) + let workspace = try createWorkspace(path: rootPath, projects: projects.map(\.name)) projects.forEach { project in modelLoader.mockProject(project.name) { _ in project } } diff --git a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift index 05df799aa..ac83bf89b 100644 --- a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift +++ b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift @@ -59,7 +59,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(manifestsTarget.platform, .macOS) XCTAssertEqual(manifestsTarget.product, .staticFramework) XCTAssertEqual(manifestsTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(manifestsTarget.sources.map { $0.path }, manifestPaths) + XCTAssertEqual(manifestsTarget.sources.map(\.path), manifestPaths) XCTAssertEqual(manifestsTarget.filesGroup, .group(name: "Manifests")) XCTAssertEqual(manifestsTarget.dependencies, [.target(name: "ProjectDescriptionHelpers")]) @@ -71,7 +71,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(helpersTarget.platform, .macOS) XCTAssertEqual(helpersTarget.product, .staticFramework) XCTAssertEqual(helpersTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(helpersTarget.sources.map { $0.path }, helperPaths) + XCTAssertEqual(helpersTarget.sources.map(\.path), helperPaths) XCTAssertEqual(helpersTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(helpersTarget.dependencies) @@ -83,7 +83,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(templatesTarget.platform, .macOS) XCTAssertEqual(templatesTarget.product, .staticFramework) XCTAssertEqual(templatesTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(templatesTarget.sources.map { $0.path }, templates) + XCTAssertEqual(templatesTarget.sources.map(\.path), templates) XCTAssertEqual(templatesTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(templatesTarget.dependencies) @@ -95,7 +95,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(setupTarget.platform, .macOS) XCTAssertEqual(setupTarget.product, .staticFramework) XCTAssertEqual(setupTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(setupTarget.sources.map { $0.path }, [setupPath]) + XCTAssertEqual(setupTarget.sources.map(\.path), [setupPath]) XCTAssertEqual(setupTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(setupTarget.dependencies) @@ -107,7 +107,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(configTarget.platform, .macOS) XCTAssertEqual(configTarget.product, .staticFramework) XCTAssertEqual(configTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(configTarget.sources.map { $0.path }, [configPath]) + XCTAssertEqual(configTarget.sources.map(\.path), [configPath]) XCTAssertEqual(configTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(configTarget.dependencies) @@ -119,7 +119,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(dependenciesTarget.platform, .macOS) XCTAssertEqual(dependenciesTarget.product, .staticFramework) XCTAssertEqual(dependenciesTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(dependenciesTarget.sources.map { $0.path }, [dependenciesPath]) + XCTAssertEqual(dependenciesTarget.sources.map(\.path), [dependenciesPath]) XCTAssertEqual(dependenciesTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(dependenciesTarget.dependencies) @@ -130,7 +130,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { configurations: Settings.default.configurations, defaultSettings: .recommended)) XCTAssertEqual(project.filesGroup, .group(name: "Manifests")) - XCTAssertEqual(project.targets.sorted { $0.name < $1.name }, targetNodes.map { $0.target }) + XCTAssertEqual(project.targets.sorted { $0.name < $1.name }, targetNodes.map(\.target)) // Generated Scheme XCTAssertEqual(project.schemes.count, 1) @@ -138,7 +138,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(scheme.name, "Manifests") let buildAction = try XCTUnwrap(scheme.buildAction) - XCTAssertEqual(buildAction.targets.lazy.map { $0.name }.sorted(), targetNodes.map { $0.name }) + XCTAssertEqual(buildAction.targets.lazy.map(\.name).sorted(), targetNodes.map(\.name)) let runAction = try XCTUnwrap(scheme.runAction) XCTAssertEqual(runAction.filePath, tuistPath) @@ -181,7 +181,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(manifestsTarget.platform, .macOS) XCTAssertEqual(manifestsTarget.product, .staticFramework) XCTAssertEqual(manifestsTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(manifestsTarget.sources.map { $0.path }, manifestPaths) + XCTAssertEqual(manifestsTarget.sources.map(\.path), manifestPaths) XCTAssertEqual(manifestsTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(manifestsTarget.dependencies) @@ -192,7 +192,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { configurations: Settings.default.configurations, defaultSettings: .recommended)) XCTAssertEqual(project.filesGroup, .group(name: "Manifests")) - XCTAssertEqual(project.targets, targetNodes.map { $0.target }) + XCTAssertEqual(project.targets, targetNodes.map(\.target)) // Generated Scheme XCTAssertEqual(project.schemes.count, 1) @@ -200,7 +200,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(scheme.name, "Manifests") let buildAction = try XCTUnwrap(scheme.buildAction) - XCTAssertEqual(buildAction.targets.map { $0.name }, targetNodes.map { $0.name }) + XCTAssertEqual(buildAction.targets.map(\.name), targetNodes.map(\.name)) let runAction = try XCTUnwrap(scheme.runAction) XCTAssertEqual(runAction.filePath, tuistPath) @@ -252,7 +252,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(manifestOneTarget.platform, .macOS) XCTAssertEqual(manifestOneTarget.product, .staticFramework) XCTAssertEqual(manifestOneTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(manifestOneTarget.sources.map { $0.path }, [manifestPaths.last]) + XCTAssertEqual(manifestOneTarget.sources.map(\.path), [manifestPaths.last]) XCTAssertEqual(manifestOneTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(manifestOneTarget.dependencies) @@ -263,7 +263,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(manifestTwoTarget.platform, .macOS) XCTAssertEqual(manifestTwoTarget.product, .staticFramework) XCTAssertEqual(manifestTwoTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(manifestTwoTarget.sources.map { $0.path }, [manifestPaths.first]) + XCTAssertEqual(manifestTwoTarget.sources.map(\.path), [manifestPaths.first]) XCTAssertEqual(manifestTwoTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(manifestTwoTarget.dependencies) @@ -275,7 +275,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(setupTarget.platform, .macOS) XCTAssertEqual(setupTarget.product, .staticFramework) XCTAssertEqual(setupTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(setupTarget.sources.map { $0.path }, [setupPath]) + XCTAssertEqual(setupTarget.sources.map(\.path), [setupPath]) XCTAssertEqual(setupTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(setupTarget.dependencies) @@ -287,7 +287,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(configTarget.platform, .macOS) XCTAssertEqual(configTarget.product, .staticFramework) XCTAssertEqual(configTarget.settings, expectedSettings(sourceRootPath: sourceRootPath)) - XCTAssertEqual(configTarget.sources.map { $0.path }, [configPath]) + XCTAssertEqual(configTarget.sources.map(\.path), [configPath]) XCTAssertEqual(configTarget.filesGroup, .group(name: "Manifests")) XCTAssertEmpty(configTarget.dependencies) @@ -298,7 +298,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { configurations: Settings.default.configurations, defaultSettings: .recommended)) XCTAssertEqual(project.filesGroup, .group(name: "Manifests")) - XCTAssertEqual(project.targets.sorted(by: { $0.name > $1.name }), targetNodes.map { $0.target }.sorted(by: { $0.name > $1.name })) + XCTAssertEqual(project.targets.sorted(by: { $0.name > $1.name }), targetNodes.map(\.target).sorted(by: { $0.name > $1.name })) // Generated Scheme XCTAssertEqual(project.schemes.count, 1) @@ -306,7 +306,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { XCTAssertEqual(scheme.name, "Manifests") let buildAction = try XCTUnwrap(scheme.buildAction) - XCTAssertEqual(buildAction.targets.map { $0.name }.sorted(), targetNodes.map { $0.name }.sorted()) + XCTAssertEqual(buildAction.targets.map(\.name).sorted(), targetNodes.map(\.name).sorted()) let runAction = try XCTUnwrap(scheme.runAction) XCTAssertEqual(runAction.filePath, tuistPath) diff --git a/Tests/TuistSigningTests/SigningMapperTests.swift b/Tests/TuistSigningTests/SigningMapperTests.swift index 35ea79442..dd798b786 100644 --- a/Tests/TuistSigningTests/SigningMapperTests.swift +++ b/Tests/TuistSigningTests/SigningMapperTests.swift @@ -104,7 +104,7 @@ final class SigningMapperTests: TuistUnitTestCase { // Then XCTAssertEmpty(sideEffects) let configurations = mappedProject.targets - .map { $0.settings } + .map(\.settings) .map { $0?.configurations } XCTAssertEqual(configurations.first, expectedConfigurations) diff --git a/assets/Package.swift b/assets/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/assets/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/bin/Package.swift b/bin/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/bin/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/design/Package.swift b/design/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/design/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/features/Package.swift b/features/Package.swift new file mode 100644 index 000000000..54ecd5725 --- /dev/null +++ b/features/Package.swift @@ -0,0 +1 @@ +import PackageDescription \ No newline at end of file diff --git a/fixtures/Package.swift b/fixtures/Package.swift new file mode 100644 index 000000000..54ecd5725 --- /dev/null +++ b/fixtures/Package.swift @@ -0,0 +1 @@ +import PackageDescription \ No newline at end of file diff --git a/fixtures/ios_app_with_local_swift_package/Packages/PackageA/Package.swift b/fixtures/ios_app_with_local_swift_package/Packages/PackageA/Package.swift index b6b0c45a3..8effae322 100644 --- a/fixtures/ios_app_with_local_swift_package/Packages/PackageA/Package.swift +++ b/fixtures/ios_app_with_local_swift_package/Packages/PackageA/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.2.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/fixtures/ios_app_with_static_library_and_package/Packages/PackageA/Package.swift b/fixtures/ios_app_with_static_library_and_package/Packages/PackageA/Package.swift index f46b83b8a..616793233 100644 --- a/fixtures/ios_app_with_static_library_and_package/Packages/PackageA/Package.swift +++ b/fixtures/ios_app_with_static_library_and_package/Packages/PackageA/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.2.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..adc451d0e --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[build] + base = "website/" + publish = "public/" + command = "yarn build" \ No newline at end of file diff --git a/tools/Package.swift b/tools/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/tools/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/tools/fixturegen/Package.resolved b/tools/fixturegen/Package.resolved index 1608155c0..efcccd42b 100644 --- a/tools/fixturegen/Package.resolved +++ b/tools/fixturegen/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-tools-support-core", "state": { "branch": null, - "revision": "693aba4c4c9dcc4767cc853a0dd38bf90ad8c258", - "version": "0.0.1" + "revision": "243beea77d20db46647a3de4765c96e2c801c7c7", + "version": "0.1.12" } } ] diff --git a/tools/fixturegen/Package.swift b/tools/fixturegen/Package.swift index d4ac48aca..a428b48e4 100644 --- a/tools/fixturegen/Package.swift +++ b/tools/fixturegen/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:5.2.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -13,7 +13,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/apple/swift-tools-support-core", from: "0.0.1"), + .package(url: "https://github.com/apple/swift-tools-support-core", .upToNextMinor(from: "0.1.12")), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -21,7 +21,7 @@ let package = Package( .target( name: "FixtureGenerator", dependencies: [ - "SwiftToolsSupport", + .product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"), ] ), ] diff --git a/tools/tuistbench/Package.swift b/tools/tuistbench/Package.swift index 4056b9623..a01195fb4 100644 --- a/tools/tuistbench/Package.swift +++ b/tools/tuistbench/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:5.2.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -13,7 +13,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/apple/swift-tools-support-core", from: "0.0.1"), + .package(url: "https://github.com/apple/swift-tools-support-core", .upToNextMinor(from: "0.1.12")), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -21,7 +21,7 @@ let package = Package( .target( name: "TuistBenchmark", dependencies: [ - "SwiftToolsSupport", + .product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"), ] ), ] diff --git a/vendor/Package.swift b/vendor/Package.swift new file mode 100644 index 000000000..9f926b36a --- /dev/null +++ b/vendor/Package.swift @@ -0,0 +1 @@ +import PackageDescription diff --git a/website/.gitignore b/website/.gitignore index 8ffafd0a9..49b0a657d 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -2,4 +2,5 @@ node_modules .cache public/ yarn-error.log -TODO \ No newline at end of file +TODO +.build/ \ No newline at end of file diff --git a/website/.swift-version b/website/.swift-version new file mode 100644 index 000000000..e60200b54 --- /dev/null +++ b/website/.swift-version @@ -0,0 +1 @@ +5.2.5 \ No newline at end of file diff --git a/website/Package.swift b/website/Package.swift new file mode 100644 index 000000000..9ae8555c9 --- /dev/null +++ b/website/Package.swift @@ -0,0 +1,18 @@ +// swift-tools-version:5.2.0 +import PackageDescription + +// This is necessary for 2 reasons: +// 1. It tricks SPM to not include the website/ directory in the generated Xcode project. +// Because there's a node_modules in it, Xcode is very slow indexing things. +// https://forums.swift.org/t/hiding-ignoring-directories-from-xcode-when-opening-swift-packages/35431/6 +// 2. Netlify detects that there's a Package.swift and tries to build the package. There's +// no way to configure that on Netlify and therefore we need an empty target here. +let package = Package( + name: "website", + platforms: [.macOS(.v10_12)], + products: [], + dependencies: [], + targets: [ + .target(name: "website"), + ] +) diff --git a/website/Sources/website/main.swift b/website/Sources/website/main.swift new file mode 100644 index 000000000..e69de29bb