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 226433 - API to notify J2SE Project extensions about build script update.
Summary: API to notify J2SE Project extensions about build script update.
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2013-02-21 07:42 UTC by Tomas Zezula
Modified: 2013-03-14 02:09 UTC (History)
3 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Diff dile (API + Java Web Start rewritten) (47.36 KB, patch)
2013-02-21 07:47 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2013-02-21 07:42:09 UTC
Added a friend API to the J2SE Project to notify J2SE Project extensions about an update of the build script files.
Use case: JFX extension needs to extend the J2SE build script in a way that is not compatible with the previous version of the JFX extension and J2SE build script. Such a change can be done only when the J2SE build script is updated, it should not be done when the user has edited the build file and the build file is not updated.
Comment 1 Tomas Zezula 2013-02-21 07:47:29 UTC
Created attachment 131644 [details]
Diff dile (API + Java Web Start rewritten)
Comment 2 Petr Somol 2013-02-21 09:19:56 UTC
Just remarking that this proposal will affect also future FX support integration with SE project.

Technical question. If I understand it right then after the patch it would look like this: when build-impl is (re)generated, JWS (or other SE extender) is notified and that triggers also (re)generation of extender's build script; but that in turn can lead to another build-impl regeneration in case the new extender's build script requires changes in the internal dependencies among these two scripts. Would not it help if a notification came even before build-impl regeneration, where the notification would carry the info on new api version, so that the extending build script could first remove its old dependencies even before build-impl is actually generated (ant thus to save one of the build-impl regenerations) ? Is this technically possible and/or is it worth the effort ? I better ask before we establish the new interface.
Comment 3 Petr Jiricka 2013-02-21 09:53:05 UTC
I understand this API will for now be only used in Java SE project type, but in case it is needed in other Ant-based project types later, would it be useful to move the GeneratedFilesInterceptor and GeneratedFilesInterceptorSupport classes to a more general place? E.g. into java.api.common:
org.netbeans.modules.java.api.common.ant.GeneratedFilesInterceptor
org.netbeans.modules.java.api.common.util.GeneratedFilesInterceptorSupport

They don't seem to be specific to Java SE project type.
Comment 4 Tomas Zezula 2013-02-21 09:59:49 UTC
>If I understand it right then after the patch it would look
>like this: when build-impl is (re)generated, JWS (or other SE extender) is
>notified and that triggers also (re)generation of extender's build script.
Right
>but that in turn can lead to another build-impl regeneration in case the new
>extender's build script requires changes in the internal dependencies among
>these two scripts.
Yes
> Is this technically possible and/or is it worth the effort ?
Yes, it's possible. Originally I had these two methods (beforeGenerate, afterGenerate)
however I didn't found any use case for the first one. The number of build-impl.xml generation
is the same or even higher in case when you remove the extension before you actually
regenerate build-impl.xml as the AntBuildExtener.removeExtension() modifies project.xml which
needs to be saved.
The extension itself should not depend on information stored in J2SE build-impl.xml file as
it's derived from the project.xml, so it does not need the previous state of the build-impl.xml.
Other problem is that the afterGenerate will need to get a update result and in case that the update
was not successful restore the original state which it has broken in beforeGenerate to be failure atomic.
Comment 5 Tomas Zezula 2013-02-21 10:09:47 UTC
There are currently no use cases for this API except of the JFX.
If such use case appears the API belongs to the  project/ant as it relates to the GeneratedFilesHelper.
Something like:

class GeneratedFilesHelper {

      static interface Interceptor {
          ....
      }
      ...
}
Comment 6 Tomas Zezula 2013-02-21 10:37:07 UTC
One forgotten note about generic nature of this API. Due to the project system threading (the APH is not fully reentrant) the project (J2SE) needs to ensure that the call to GeneratedFilesInterceptor is a tail call of the ProjectXmlSavedHook.projectXMLSaved() and the whole ProjectXmlSavedHook.projectXMLSaved() runs in exclusive mode. The first is hard to request in general.
Comment 7 Tomas Zezula 2013-02-21 12:19:41 UTC
In case of the general API the same threading limitations as in the ProjectXMLSavedHook is required.
If there is other use case than JFX and such a limitation is OK for it I can move the API to project/ant.
Comment 8 David Konecny 2013-02-21 22:06:59 UTC
From EE/Web tier point of view I'm OK with this API being available only to J2SE project for now as we do not have any requirement for it.
Comment 9 Tomas Zezula 2013-02-27 13:44:21 UTC
Fixed jet-main 563b72ae9cb9
Comment 10 Quality Engineering 2013-03-01 02:02:14 UTC
Integrated into 'main-golden', will be available in build *201302282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/563b72ae9cb9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #226433:API to notify J2SE Project extensions about build script update
Comment 11 Petr Somol 2013-03-12 09:15:05 UTC
applied to FX
http://hg.netbeans.org/jet-main/rev/4ac5963ee7ca
Comment 12 Quality Engineering 2013-03-14 02:09:20 UTC
Integrated into 'main-golden', will be available in build *201303132300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4ac5963ee7ca
User: Petr Somol <psomol@netbeans.org>
Log: #226433 - API to notify J2SE Project.. applied to FX