Skip to content
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

GraphViz migration to ValueGraph #2542

Merged
merged 18 commits into from Feb 24, 2021
Merged

GraphViz migration to ValueGraph #2542

merged 18 commits into from Feb 24, 2021

Conversation

fortmarek
Copy link
Member

@fortmarek fortmarek commented Feb 18, 2021

Short description πŸ“

Migrate GraphViz to ValueGraph

I'd just ask someone to test this locally, please πŸ™

I can't get tuist graph to work on my machine as I always get:
image

I have no idea what is wrong (I keep getting even after I made fresh install two weeks ago, so maybe my machine is fundamentally and irreparably flawed), so if anyone has an idea how to fix this/debug this, that'd be great.

Checklist βœ…

  • The code architecture and patterns are consistent with the rest of the codebase.
  • The changes have been tested following the documented guidelines.
  • The CHANGELOG.md has been updated to reflect the changes. In case of a breaking change, it's been flagged as such.
  • In case the PR introduces changes that affect users, the documentation has been updated.

Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @fortmarek - thanks for migrating this over!

I can't get tuist graph to work on my machine as I always get:

I wonder if it's Big Sur or maybe an installation issue with graphviz? Worth trying removing and re-installing graphviz.

brew uninstall graphviz
brew install graphviz

If that still fails, you can try changing the output format to be a .dot file and examining the results (text based).

tuist graph --format dot

While testing I noticed a few discrepancies:

When it comes to filtering targets (by explicitly specifying their name), there's a mismatch between the released version of Tuist and this PR where transitive dependencies are not included:

cd fixtures/ios_app_with_transitive_framework
tuist graph AppTests

Released Version:
graph

This PR:
graph

Framework2 isn't included.

Unrelated to those changes, I also noticed the tuist graph --skip-external-dependencies (even the realised version) produces a slightly odd graph (unless I misunderstood what it's meant to do)

cd fixtures/ios_app_with_transitive_framework
tuist graph --skip-external-dependencies

graph

@bolismauro
Copy link
Contributor

@fortmarek I had the very same issue when fixing the graph command. I feel it is a permission issue.
The way I checked the result, besides testing, is by outputting the textual description with po and then use an online service to render the graph.
I haven't been able to understand the reason of the issue though (I'm not very familiar with mac development and permissions)

@fortmarek
Copy link
Member Author

I have a question regarding ValueGraphTraverser - what's the reason for directTargetDependencies returning only local target dependencies (ie it does not return direct target dependencies that are part of a different project)? I believe that naming is misleading and it lead to the bug where tuist graph AppTests does not include Framework1-iOS. If there is a valid reason, I am for renaming directTargetDependencies to directLocalTargetDependencies and keeping method directTargetDependencies which would actually include all direct target dependencies - even if they are a part of a different project. cc @kwridan @pepibumur

@fortmarek
Copy link
Member Author

thanks @bolismauro!

It might be related to permissions but I am not really sure how to fix it/where to look.
I have tried reinstalling + running brew install graphviz --HEAD to install graphviz from source, neither of those helped, unfortunately. So far I have resorted to opening .dot file with a VS Code extension to visualize the graph. But this might be worth investigating more as it seems this is not an issue applicable only to my setup but might be more widespread than we have previously thought.

@kwridan
Copy link
Collaborator

kwridan commented Feb 23, 2021

what's the reason for directTargetDependencies returning only local target dependencies (ie it does not return direct target dependencies that are part of a different project)

I believe there are some cases like searching for host apps (for tests or extensions) where only local targets need to be searched.

I am for renaming directTargetDependencies to directLocalTargetDependencies and keeping method directTargetDependencies which would actually include all direct target dependencies

+1 this makes sense to clarify the intent

@fortmarek
Copy link
Member Author

all of the troubling scenarios you have listed should be fixed. I tested that locally leveraging dot format + added appropriate unit tests to catch any possible future regressions. I think this is worth another look @kwridan, thanks for the thorough review πŸ™‡

Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work @fortmarek

Comment on lines +65 to +68
/// Given a project directory and target name, it returns **all**l its direct target dependencies present in the same project.
/// If you want only direct target dependencies present in the same project as the target, use `directLocalTargetDependencies` instead
/// - Parameters:
/// - path: Path to the directory that contains the project.
/// - path: Path to the directory that contains the target's project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘

@@ -9,6 +9,98 @@ import XCTest
@testable import TuistSupportTesting

final class ValueGraphTraverserTests: TuistUnitTestCase {
func test_dependsOnXCTest_when_is_framework() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done

@fortmarek fortmarek merged commit 89f8016 into main Feb 24, 2021
@danieleformichelli danieleformichelli deleted the graph_viz_migration branch July 22, 2021 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants