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

Migrate DevTools to use pub workspaces #8211

Closed
kenzieschmoll opened this issue Aug 19, 2024 · 5 comments · Fixed by #8549
Closed

Migrate DevTools to use pub workspaces #8211

kenzieschmoll opened this issue Aug 19, 2024 · 5 comments · Fixed by #8549
Assignees
Labels
cost: low Low engineering cost to implement. P1 high priority issues at the top of the work list, actively being worked on.

Comments

@kenzieschmoll
Copy link
Member

This will be a good way for us to dogfood the pub workspaces feature and find any devexp / devtools related bugs (like DevTools extensions or IDE integrations).

The workspace pubspec.yaml should likely live at the root of devtools/packages.

@kenzieschmoll kenzieschmoll added P1 high priority issues at the top of the work list, actively being worked on. cost: low Low engineering cost to implement. labels Aug 19, 2024
@kenzieschmoll
Copy link
Member Author

I pushed up a draft for this at #8549, but something does not seem to working properly. I followed instructions and examples as closely as possible, but I'm not quite sure what is going wrong.

Running dart pub get from the top-level devtools/ directory succeeds, but the Problems view in VS code shows 54k+ problems. I have tried restarting the analysis server and the IDE, but I still have analysis issues all over my project. I am opening the root devtools/ directory in VS Code.

Also, here is the output from running dart pub workspace list:

Package              Path                           
_                    ./                             
devtools_app         packages/devtools_app/         
devtools_app_shared  packages/devtools_app_shared/  
devtools_extensions  packages/devtools_extensions/  
devtools_shared      packages/devtools_shared/      
devtools_test        packages/devtools_test/        
devtools_tool        tool/   

CC @sigurdm - any ideas? Also CC @DanTup in case there could be something going wrong with my local VS Code configuration.

@kenzieschmoll kenzieschmoll self-assigned this Nov 25, 2024
@sigurdm
Copy link
Contributor

sigurdm commented Nov 26, 2024

I believe I found the issue.

On the main branch you have a packages/pubspec.yaml file, (which results in a corresponding packages/.dart_tool/package_config.json.

On the PR branch there is no packages/pubspec.yaml, but when the branch is switched packages/.dart_tool/package_config.json remains, because it is .gitignored.

This file is the cause of all the trouble, because the analyzer picks that one up when it traverses directories towards the root.

pub get will remove existing .dart_tool/package_config.json in any workspace project folder, but not in the interim folders.

The workaround is to run rm packages/.dart_tool/package_config.json from the repository root.

We should probably update pub to delete .dart_tool/package_config.json from all interim folders in the workspace.
@jonasfj WDYT?

@sigurdm
Copy link
Contributor

sigurdm commented Nov 26, 2024

A fix to delete those files is proposed in https://github.com/dart-lang/pub/pull/4446/files

@kenzieschmoll
Copy link
Member Author

@sigurdm thanks for looking into this. That fixed my local setup and I think the fix you pushed up to prevent other users from hitting this will be great.

The next issue I am hitting is with build_runner. We generate mocks as part of our CI setup, and this is now failing with the move to use workspaces:

Running build_runner build for devtools_app...
/home/runner/work/devtools/devtools/packages/devtools_app > /home/runner/work/devtools/devtools/tool/flutter-sdk/bin/flutter pub run build_runner build --delete-conflicting-outputs
Package "build_runner" is not an immediate dependency.
Cannot run executables in transitive dependencies.
Failed to update packages.
ProcessException: Failed with exit code: 65. 
  Command: /home/runner/work/devtools/devtools/tool/flutter-sdk/bin/flutter pub run build_runner build --delete-conflicting-outputs

build_runner is still listed as a dependency in devtools_app/pubspec.yaml but it appears that the system thinks that it is a "transitive dependency".

@kenzieschmoll
Copy link
Member Author

Nevermind I got this passing by adding the build_runner dep to the top level pubspec.yaml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cost: low Low engineering cost to implement. P1 high priority issues at the top of the work list, actively being worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants