This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270076 - Compile on save must finish before other action is invoked
Summary: Compile on save must finish before other action is invoked
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: Dev
Hardware: PC Linux
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-15 15:05 UTC by Jaroslav Tulach
Modified: 2017-05-16 01:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2017-03-15 15:05:52 UTC
I am using using truffle sources with mx netbeansinit: https://github.com/graalvm/truffle

I have realized that in current version (https://github.com/graalvm/truffle/commit/558469ec5d0e7c23e277d9d156594f68b71bdacd and https://github.com/graalvm/mx/commit/e7fb0fb013b184d9f71468766589c2fe70c84dc0) it takes a lot of time to run a unit test. The long time is especially caused by building the project that contains the test first and only then running it.

But that shouldn't be necessary! The projects have compile-on-save feature enabled, and as such there is no need to compile them again from the command line. Thus I tried to disable that by:


mx$ git diff
diff --git a/mx.py b/mx.py
index 604b5a7..a85e2ab 100755
--- a/mx.py
+++ b/mx.py
@@ -12199,7 +12199,7 @@ def _netbeansinit_project(p, jdks=None, files=None, libFiles=None, dists=None):
     out.close('target')
     out.element('target', {'name' : 'test', 'depends' : 'run'})
     out.element('target', {'name' : 'test-single', 'depends' : 'run'})
-    out.open('target', {'name' : 'run', 'depends' : 'compile'})
+    out.open('target', {'name' : 'run'})
     out.element('property', {'name' : 'test.class', 'value' : p.name})
     out.open('exec', {'executable' : sys.executable, 'failonerror' : 'true', 'dir' : execDir})
     out.element('env', {'key' : 'JAVA_HOME', 'value' : jdk.home})
@@ -12209,7 +12209,7 @@ def _netbeansinit_project(p, jdks=None, files=None, libFiles=None, dists=None):
     out.close('exec')
     out.close('target')
     out.element('target', {'name' : 'debug-test', 'depends' : 'debug'})
-    out.open('target', {'name' : 'debug', 'depends' : 'init,compile'})
+    out.open('target', {'name' : 'debug', 'depends' : 'init'})
     out.element('property', {'name' : 'test.class', 'value' : p.name})
     out.open('nbjpdastart', {'addressproperty' : 'jpda.address', 'name' : p.name})
     out.open('classpath')


This certainly speeds things up. If I select a test file and run it - it starts very quickly.

However there is a problem: If I make modifications and press "Shift-F6", the test is executed - but not with my code in - with the previously saved version.

The problem is that now the "Run Test" actions is as quick that it starts sooner than the CoS manages to save the file. That hurts usability quite a lot.

On the other hand the speed up caused by skipping the compilation step when running a test is significant. I'd like to keep it. There is one solution that comes to my mind: could the IDE delay any Ant invocations on the project before previously scheduled save operations are finished?
Comment 1 Tomas Zezula 2017-05-15 08:58:23 UTC
Fixed jet-main d3f9517f406f
Comment 2 Quality Engineering 2017-05-16 01:43:15 UTC
Integrated into 'main-silver', will be available in build *201705160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d3f9517f406f
User: Tomas Zezula <tzezula@netbeans.org>
Log: #270076:Compile on save must finish before other action is invoked