Skip to content

Commit

Permalink
Fix generate with Workspace.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
fortmarek committed Mar 6, 2024
1 parent 463d11d commit e168ece
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift
@@ -1,6 +1,7 @@
import Foundation
import ProjectDescription
import TSCBasic
import TuistCore
import TuistGraph
import TuistSupport

Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -104,15 +108,15 @@ 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,
path: $0,
packageType: .local,
packageSettings: packageSettings,
packageToProject: [:]
)!
)
}
var newDependenciesPaths = Set<AbsolutePath>()
for (path, project) in zip(paths, projects) {
Expand Down
Expand Up @@ -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 })
}
Expand Down
122 changes: 122 additions & 0 deletions 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
}
6 changes: 6 additions & 0 deletions fixtures/multiplatform_app_with_sdk/Workspace.swift
@@ -0,0 +1,6 @@
import ProjectDescription

let workspace = Workspace(
name: "App",
projects: ["./**"]
)

0 comments on commit e168ece

Please sign in to comment.