-
-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tuist generate regression after 4.31.0 with RevenueCat: The file “App” couldn’t be opened because there is no such file. #7145
Comments
Hey @KaiOelfke! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve this issue. The issue you're encountering seems to be related to how Tuist handles symbolic links in newer versions, specifically with the Tuist's project generation process resolves symbolic links to their target paths. However, there is a known issue with symlink resolution, particularly with the To address this, you can try the following:
These steps should help you diagnose and potentially resolve the symlink issue in your project. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
When I run tuist via Xcode locally I don't run into the RevenueCat issue but with the closed source package. In So I guess that function maybe doesn't work with the symlink (modelPath). extension XcodeGraph.CoreDataModel {
/// Maps a `.xcdatamodeld` package into a XcodeGraph.CoreDataModel instance.
/// - Parameters:
/// - path: The path for a `.xcdatamodeld` package.
static func from(
path modelPath: AbsolutePath,
fileSystem: FileSysteming
) async throws -> XcodeGraph.CoreDataModel {
let versions = try await fileSystem.glob(directory: modelPath, include: ["*.xcdatamodel"]).collect()
let currentVersion: String = try await {
if try await CoreDataVersionExtractor.isVersioned(at: modelPath) {
return try CoreDataVersionExtractor.version(fromVersionFileAtPath: modelPath)
} else {
return (versions.count == 1 ? versions[0] : modelPath).basenameWithoutExt
}
}()
return CoreDataModel(path: modelPath, versions: versions, currentVersion: currentVersion)
}
} |
Resolving the symlink by doing some local changes in the Tuist codebase indeed gets the four versions. However, in BuildPhaseGenerator.swift the currentVersionPath is still the unresolved path, which doesn't match the resolved paths of the versions. I'm not really familiar with how Tuist's file system works and when symlinks are resolved or if the file system glob is supposed to return the versions as paths including the symlink so that it stays unresolved. private func generateCoreDataModel(
coreDataModel: CoreDataModel,
fileElements: ProjectFileElements,
pbxproj _: PBXProj
) -> PBXBuildFile {
let currentVersion = coreDataModel.currentVersion
let path = coreDataModel.path
let currentVersionPath = path.appending(component: "\(currentVersion).xcdatamodel")
// swiftlint:disable:next force_cast
let modelReference = fileElements.group(path: path)! as! XCVersionGroup
if fileElements.file(path: currentVersionPath) == nil {
print(fileElements.elements)
}
let currentVersionReference = fileElements.file(path: currentVersionPath)!
modelReference.currentVersion = currentVersionReference
let pbxBuildFile = PBXBuildFile(file: modelReference)
return pbxBuildFile
} |
I removed the problematic dependency and then it works in Xcode (main branch). But running 4.36.0 via mise still fails with the RevenueCat error. So I have no idea why I when run as CLI installed via mise gave me the error regarding RevenueCat. With Tuist 4.32 I actually get the errors regarding the closed source xcdatamodel, which seems more correct. |
cc @fortmarek maybe you know when and where symlinks are resolved for such a versioned core data model? I could try making a PR, but I'm not sure design / requirement wise how it should be handled. |
We have a fixture with RevenueCat that we run as part of our acceptance tests, so I'd be surprised if the integration of it doesn't work: https://github.com/tuist/tuist/tree/main/fixtures/app_with_revenue_cat
We should follow symlinks. We have a unit test for that in our
What changes did you do? Have you been able to find the exact glob that we run and that doesn't return the expected results? I'd love to help more but without a reproducible sample, I can only provide guidance on how to further debug this, sorry! |
Thanks for the hints. I've figured it out I think. func test_glob_with_symlink_new2() async throws {
let versionPaths = [
"CDEEventStoreModel_0.xcdatamodel",
"CDEEventStoreModel_1.xcdatamodel",
"CDEEventStoreModel_2.xcdatamodel",
"CDEEventStoreModel_3.xcdatamodel",
]
let absolutePath = try AbsolutePath(validating: "/Users/kaioelfke/Developer/ensembles-next/Framework/Source/SwiftPackageResources/CDEEventStoreModel.xcdatamodeld")
// When
let got = try await subject.glob(
directory: absolutePath,
include: ["*.xcdatamodel"]
)
.collect()
.sorted()
// Then
XCTAssertEqual(got.count, 4)
XCTAssertEqual(got.map(\.basename), versionPaths)
} This test case fails. But this is a hardcoded path only working on my machine. The thing is that I don't know how to create a relative sym link with The symlink is defined as relative path:
I think in Documentation:
With these changes it works:
I can either provide you a sample with these specific files or you could tell me how I can make a unit test with relative sym links instead of an absolute one. E.g. a unit test I made using the
|
The problem appears at [email protected] [email protected] has other bugs to prevent my project from being compiled. |
A unit test in |
What happened?
I have a project, which generates with 4.31.0, but any later version fails. First with some CDEEventStoreModel.xcdatamodeld from a closed-source SPM package. And from Tuist 4.33.0 it fails for RevenueCat's purchases-ios-spm repo.
I guess something is wrong with the file system changes and symlinks. In the RevenueCat project I can see that CustomEntitlementComputation is a symlink to the Sources folder.
https://github.com/RevenueCat/purchases-ios-spm/blob/main/CustomEntitlementComputation
Appears to be similar to this issue: #6981
How do we reproduce it?
I'm still working on it, but my guess would be setting up a sample project with https://github.com/RevenueCat/purchases-ios-spm as dependency and running tuist install and tuist generate with a Tuist version from 4.33.0 or higher.
Error log
macOS version
15.1.1
Tuist version
4.36.0
Xcode version
16.1
The text was updated successfully, but these errors were encountered: