diff --git a/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift b/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift index e212622e267..0919bb38ad1 100644 --- a/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift +++ b/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift @@ -1,6 +1,7 @@ import Foundation import ProjectDescription import TSCBasic +import TuistCore import TuistGraph import TuistSupport @@ -26,15 +27,18 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { private let manifestLoader: ManifestLoading private let fileHandler: FileHandling private let packageInfoMapper: PackageInfoMapping + private let rootDirectoryLocator: RootDirectoryLocating public init( manifestLoader: ManifestLoading = ManifestLoader(), fileHandler: FileHandling = FileHandler.shared, - packageInfoMapper: PackageInfoMapping = PackageInfoMapper() + packageInfoMapper: PackageInfoMapping = PackageInfoMapper(), + rootDirectoryLocator: RootDirectoryLocating = RootDirectoryLocator() ) { self.manifestLoader = manifestLoader self.fileHandler = fileHandler self.packageInfoMapper = packageInfoMapper + self.rootDirectoryLocator = rootDirectoryLocator } public func loadWorkspace( @@ -65,7 +69,7 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { }.flatMap { fileHandler.glob($0, glob: "") }.filter { - fileHandler.isFolder($0) + fileHandler.isFolder($0) && $0.basename != Constants.tuistDirectoryName && !$0.pathString.contains(".build/checkouts") }.filter { let manifests = manifestLoader.manifests(at: $0) return manifests.contains(.package) && !manifests.contains(.project) && !manifests.contains(.workspace) @@ -104,7 +108,7 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { var paths = Set(paths) while !paths.isEmpty { paths.subtract(cache.keys) - let projects = try Array(paths).map(context: ExecutionContext.concurrent) { + let projects = try Array(paths).compactMap(context: ExecutionContext.concurrent) { let packageInfo = try manifestLoader.loadPackage(at: $0) return try packageInfoMapper.map( packageInfo: packageInfo, @@ -112,7 +116,7 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { packageType: .local, packageSettings: packageSettings, packageToProject: [:] - )! + ) } var newDependenciesPaths = Set() for (path, project) in zip(paths, projects) { diff --git a/Sources/TuistLoader/Models+ManifestMappers/Workspace+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Workspace+ManifestMapper.swift index 56d97e7fc83..562d565e265 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Workspace+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Workspace+ManifestMapper.swift @@ -21,6 +21,7 @@ extension TuistGraph.Workspace { let projects = FileHandler.shared.glob(AbsolutePath.root, glob: String(resolvedPath.pathString.dropFirst())) .lazy .filter(FileHandler.shared.isFolder) + .filter { $0.basename != Constants.tuistDirectoryName && !$0.pathString.contains(".build/checkouts") } .filter { manifestLoader.manifests(at: $0).contains(where: { $0 == .package || $0 == .project }) } diff --git a/fixtures/multiplatform_app_with_sdk/Tuist/Package.resolved b/fixtures/multiplatform_app_with_sdk/Tuist/Package.resolved new file mode 100644 index 00000000000..61cc8b57847 --- /dev/null +++ b/fixtures/multiplatform_app_with_sdk/Tuist/Package.resolved @@ -0,0 +1,122 @@ +{ + "pins" : [ + { + "identity" : "abseil-cpp-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/abseil-cpp-binary.git", + "state" : { + "revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c", + "version" : "1.2022062300.0" + } + }, + { + "identity" : "app-check", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/app-check.git", + "state" : { + "revision" : "3e464dad87dad2d29bb29a97836789bf0f8f67d2", + "version" : "10.18.1" + } + }, + { + "identity" : "firebase-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/firebase-ios-sdk", + "state" : { + "revision" : "fe09d61a539e11fdbe24f269bba10144b6145fe2", + "version" : "10.22.0" + } + }, + { + "identity" : "googleappmeasurement", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleAppMeasurement.git", + "state" : { + "revision" : "bf3bb24f6b60a7acedaef504e9ce97154203217a", + "version" : "10.22.0" + } + }, + { + "identity" : "googledatatransport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleDataTransport.git", + "state" : { + "revision" : "a637d318ae7ae246b02d7305121275bc75ed5565", + "version" : "9.4.0" + } + }, + { + "identity" : "googleutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleUtilities.git", + "state" : { + "revision" : "26c898aed8bed13b8a63057ee26500abbbcb8d55", + "version" : "7.13.1" + } + }, + { + "identity" : "grpc-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/grpc-binary.git", + "state" : { + "revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98", + "version" : "1.49.1" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "76135c9f4e1ac85459d5fec61b6f76ac47ab3a4c", + "version" : "3.3.1" + } + }, + { + "identity" : "interop-ios-for-google-sdks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/interop-ios-for-google-sdks.git", + "state" : { + "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648", + "version" : "100.0.0" + } + }, + { + "identity" : "leveldb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/leveldb.git", + "state" : { + "revision" : "43aaef65e0c665daadf848761d560e446d350d3d", + "version" : "1.22.4" + } + }, + { + "identity" : "nanopb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/nanopb.git", + "state" : { + "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1", + "version" : "2.30910.0" + } + }, + { + "identity" : "promises", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/promises.git", + "state" : { + "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac", + "version" : "2.4.0" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8", + "version" : "1.25.2" + } + } + ], + "version" : 2 +} diff --git a/fixtures/multiplatform_app_with_sdk/Package.swift b/fixtures/multiplatform_app_with_sdk/Tuist/Package.swift similarity index 100% rename from fixtures/multiplatform_app_with_sdk/Package.swift rename to fixtures/multiplatform_app_with_sdk/Tuist/Package.swift diff --git a/fixtures/multiplatform_app_with_sdk/Workspace.swift b/fixtures/multiplatform_app_with_sdk/Workspace.swift new file mode 100644 index 00000000000..1409a94ed1c --- /dev/null +++ b/fixtures/multiplatform_app_with_sdk/Workspace.swift @@ -0,0 +1,6 @@ +import ProjectDescription + +let workspace = Workspace( + name: "App", + projects: ["./**"] +)