vscode-gradle icon indicating copy to clipboard operation
vscode-gradle copied to clipboard

Enable incremental build with Gradle build server to support hot code replace

Open testforstephen opened this issue 2 years ago • 7 comments
trafficstars

Opening a Gradle project with a Gradle build server currently results in the loss of the hot reload feature. This is because the build server does not support auto build and the Java debugger has no way to obtain the modified classes from the build server.

testforstephen avatar Nov 08 '23 07:11 testforstephen

This is a feature that I missed alot when debugging. One reason to go back to JDT LS builds

gayanper avatar Nov 14 '23 14:11 gayanper

Any plans to open source the Gradle build server code ?

gayanper avatar Nov 14 '23 14:11 gayanper

It will happen in this week :)

jdneo avatar Nov 15 '23 00:11 jdneo

No updates?

Mike-the-one avatar Jan 20 '24 12:01 Mike-the-one

I miss this feature, too

jodevan avatar Feb 19 '24 20:02 jodevan

had same problem...

msit11125 avatar Feb 20 '24 07:02 msit11125

Any plans to implement this feature?

qiaomo avatar Mar 27 '24 01:03 qiaomo

Need it!

negativems avatar May 12 '24 11:05 negativems

Need it! 2

0gon avatar May 13 '24 05:05 0gon

Received

On Mon, May 13, 2024, 12:48 AM 0gon @.***> wrote:

Need it! 2

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-gradle/issues/1449#issuecomment-2106702645, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFKPRUCSUR2ZF3GTSKSKNSLZCBHZ3AVCNFSM6AAAAAA7CNTY3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWG4YDENRUGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Danman40th avatar May 13 '24 09:05 Danman40th

Some investigation result and thoughts:

Root cause

Since the build is delegated to the gradle, no resource change event is notified to workspace. Thus, The resource change listener in java debugger will not know which class file is updated.

Solution

  1. To solve the synchronization issue between the workspace and the file system. A refreshLocal() needs to be called for the build folder after gradle build finishes.
  2. Debugger needs to find the main project based on the main class name in the context.
  3. If the project is a gradle build server project, since auto build for Gradle build server project will not update .class files, we need to trigger an additional incremental build.

One thing needs to pay attention is the performance. refreshLocal(), find main project based on main class name & delegate build to gradle are all time consuming actions. At least, the progress reporter should be clear to tell users what's going on.

jdneo avatar May 29 '24 06:05 jdneo