-
-
Notifications
You must be signed in to change notification settings - Fork 583
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
Add sourceRootPath to the Project model #1559
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pepibumur - moving some of those properties to the Project model makes sense as it will allow transforming / mapping them on a per project basis 👍
I believe we'll need to also add xcodeProjPath
to get the editor working as it did before 🤐 and support the proposed feature in general.
May help for us to write down what each of those paths represents:
Project.path
the logical path of the project within the graphProject.sourceRootPath
the root path of the sources (Determines the path of the main group in Xcode)xcodeProjPath
the physical location of the.xcodeproj
file on disk
The main group in Xcode has a path that is:
let projectRelativePath = sourceRootPath.relative(to: xcodeprojPath.parentDirectory).pathString
Thanks for the review @kwridan. I followed your suggestions and made the following changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @pepibumur - changes look 👍
enrichedModel = enrichedModel.replacing(fileName: xcodeFileName) | ||
var xcodeProjPath: AbsolutePath = enrichedModel.xcodeProjPath | ||
if let xcodeFileName = xcodeFileNameOverride(from: config, for: model) { | ||
xcodeProjPath = enrichedModel.xcodeProjPath.parentDirectory.appending(component: xcodeFileName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: I believe this may need to be:
enrichedModel.xcodeProjPath.parentDirectory.appending(component: "\(xcodeFileName).xcodeproj")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, good catch.
Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift
Outdated
Show resolved
Hide resolved
30c21d3
to
8db14f9
Compare
Short description 📝
Before this change, we used to pass down the
sourceRootPath
attribute to tell generators about the directory that contains the generated project. With the change in this PR that information is now part of theProject
model.But why? 🧐
This allows the mappers change the location where projects are generated. For example, let's say that users are using the new cache feature with the
focus
command. In that case, we don't want to override the projects that contain the targets with the source code. Instead, we want to create a temporary directory that contains all the Xcode projects with the direct and transitive dependencies as .xcframeworks.