-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Fix IDE Gradle sync being slow because of lockfile generation #147837
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
Fix IDE Gradle sync being slow because of lockfile generation #147837
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Some notes/questions:
cc gradle gurus @GaryQian @gmackall @reidbaker |
I don't know the answer to most of these off the top of my head. IIRC flutter 2.* used a beta gradle feature to generateLockfiles which has since been made stable but the activation might have a different name than the preview feature. @jwren could you point me towards the code that run in Intellij when we sync gradle files? If so then I can dig into the differences between the IDE behavior and the command line behavior and give a command line equivalent. |
|
Is this ready for review? Happy to take a look if so, but just want to be sure because the PR is still in draft |
|
Added you for the discussion on #147837 (comment) |
|
@reidbaker we have a dart cli which calls gradle on our behalf, cli tool is here: https://github.com/flutter/flutter-intellij/tree/master/tool/plugin |
|
Thank you @jwren! @bartekpacia let me dig in this week and give you better answers. |
|
Thanks a ton, this looks like a good starting point. @reidbaker thanks! If you're busy though, don't bother really, I'll do it myself and if I fail, then I'll ping you back:) |
|
We've found that this actually gets into an infinite loop if we have a plugin added in an init script in the gradle home directory, the Flutter plugin gets applied to the |
|
I can confirm that your fix fixes the infinite loop problem too. Additional interesting find is that the task
I'd say no?
Yes, exactly what we're seeing |
|
After further digging, I've found that our plugin evaluates the project's tasks, which triggers the
Just run |
|
I just talked with @runningcode, a Gradle engineer, on droidcon Berlin and asked him how we can trigger Gradle Sync without an IDE (so we can actually test that our fix will work). He suggested using https://github.com/gradle/gradle-profiler. It has a lot of various config options, some of the ones we might wanna take a look at are Thanks a lot @runningcode! :) |
|
(PR Triage): Hey @bartekpacia do you have plans to continue with this PR? Thanks! |
|
Hey @Piinks! Yes I do! |
Some notesTo trigger a Gradle sync (the same way we can do from IntelliJ), we will likely have to create a scenario file. gradle-profiler --benchmark --scenario-file performance.scenarios intellijSyncSee also |
Thanks @zsolt-marta-bitrise, this is true! I'm wondering why it's happening – why is |
|
oh my, it's the missing |
|
superseded by #162220 |
…guration time (#162220)  This PR attempts to fix #110559 This PR supersedes #147837 Original attempt at fixing this by @GaryQian: #112723 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
I lost way too much time waiting for Gradle syncs to finish because of this problem, so I decided to take a stab at it.
This PR attempts to fix #110559
Revival of #112723
Pre-launch Checklist
///).