You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2019/11/28 19:37:12 UTC

[netbeans] branch master updated: added extension-points to targets "compile", "jar", "release" and "nbm"

This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new f22b10b  added extension-points to targets "compile", "jar", "release" and "nbm"
f22b10b is described below

commit f22b10b0b640033d9ba5e54180cb276d91f447cb
Author: Jens Hofschröer <gi...@nigjo.de>
AuthorDate: Wed Jun 27 14:01:48 2018 +0200

    added extension-points to targets "compile", "jar", "release" and "nbm"
---
 harness/apisupport.harness/release/README | 41 ++++++++++++++++++++++---------
 nbbuild/templates/common.xml              | 20 ++++++++++++---
 2 files changed, 46 insertions(+), 15 deletions(-)

diff --git a/harness/apisupport.harness/release/README b/harness/apisupport.harness/release/README
index cd31764..6e35c70 100644
--- a/harness/apisupport.harness/release/README
+++ b/harness/apisupport.harness/release/README
@@ -1111,8 +1111,36 @@ TARGETS AVAILABLE FOR OVERRIDING IN YOUR build.xml
 --------------------------------------------------
 
 Obscure or mostly internal targets are skipped here, but again examine the
-actual harness script if in doubt. If you want to keep the original
-implementation and just add a before hook, try e.g.
+actual harness script if in doubt.
+
+Since Apache NetBeans 11 some of the default targets make the use of Ant "Extension-Points"
+to add "before" and "after" hooks. See Ant manual for more about "Extension-Points"
+https://ant.apache.org/manual/targets.html#extension-points
+
+    <target name="yourStuffName" extensionOf="-pre-jar">
+        <!-- your stuff here -->
+    </target>
+
+compile - compile Java sources for the module.
+
+jar - build the module JAR.
+
+nbm - build the NBM. You might override this to give a complex (multipart)
+license text. Copy basic impl from common.xml and edit.
+
+release - copies contents of ${release.dir} to ${cluster}.
+
+The Call-Graph of these targets is
+
+  "OTHERTARGETS" -> "-pre-TARGET" -> "YOUR-preEXTENSIONS" -> "-do-TARGET"
+  -> "-post-TARGET" -> "YOUR-postEXTENSIONS" -> "TARGET"
+
+The "TARGET" itself does nothing. If your existing build.xml has some customization
+discussed later you may want to update your targets to match the new call-graph.
+You are encurraged to use the extension mechanism.
+
+If you want to keep the original implementation of the other and just add a before hook,
+try e.g.
 
     <target name="-pre-javahelp">
         <!-- your stuff here -->
@@ -1135,8 +1163,6 @@ clean - remove all build products: the "build" directory under your project
 directory, and any files left in the build cluster (including
 ${extra.module.files}).
 
-compile - compile Java sources for the module.
-
 compile-single - compile selected Java sources (F9).
 
 compile-test-single - compile selected unit test classes (F9).
@@ -1157,8 +1183,6 @@ rather than overriding this.
 
 init - all normal initialization.
 
-jar - build the module JAR.
-
 jar-prep - prepare to build the module JAR; define ${buildnumber}.
 
 javadoc - build module Javadoc.
@@ -1172,9 +1196,6 @@ as Build -> Generate Javadoc.
 
 javahelp - build JavaHelp.
 
-nbm - build the NBM. You might override this to give a complex (multipart)
-license text. Copy basic impl from common.xml and edit.
-
 netbeans - build everything needed for the NBM. Do not override; use
 netbeans-extra instead.
 
@@ -1188,8 +1209,6 @@ profile the entire application.
 profile-test-single-nb - run one unit test under the profiler. Available from the
 IDE's menus if the NetBeans profiler is installed.
 
-release - copies contents of ${release.dir} to ${cluster}.
-
 reload - reloads the module in the target IDE/app to try out changes interactively.
 
 reload-in-ide - reloads the module in the current IDE to try out changes
diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml
index 248453b..828bab1 100644
--- a/nbbuild/templates/common.xml
+++ b/nbbuild/templates/common.xml
@@ -189,7 +189,10 @@
         </autoupdate>
     </target>
 
-    <target name="compile" depends="init,up-to-date" unless="is.jar.uptodate">
+    <extension-point name="-pre-compile" depends="init,up-to-date"/>
+    <extension-point name="-post-compile" depends="-pre-compile,-do-compile"/>
+    <target name="compile" depends="-pre-compile,-do-compile,-post-compile"/>
+    <target name="-do-compile" depends="init,up-to-date,-pre-compile" unless="is.jar.uptodate">
         <mkdir dir="${build.classes.dir}"/>
         <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="${build.dir}/depcache">
             <classpath refid="cp"/>
@@ -247,7 +250,10 @@
         </tstamp>
     </target>
 
-    <target name="jar" depends="init,compile,jar-prep" unless="is.jar.uptodate">
+    <extension-point name="-pre-jar" depends="init,compile,jar-prep"/>
+    <extension-point name="-post-jar" depends="-pre-jar,-do-jar"/>
+    <target name="jar" depends="-pre-jar,-do-jar,-post-jar"/>
+    <target name="-do-jar" depends="init,compile,jar-prep,-pre-jar" unless="is.jar.uptodate">
         <!-- This task adds some or all of: -Public-Packages, -Friends, Class-Path, -IDE-Dependencies, -Module-Dependencies, -Specification-Version, -Implementation-Version, -Build-Version, AutoUpdate-Show-In-Client -->
         <jarwithmoduleattributes jarfile="${cluster}/${module.jar}" compress="${build.package.compress}" index="${build.package.index}" manifest="${manifest.mf}" stamp="${cluster}/.lastModified">
             <fileset dir="${build.classes.dir}"/>
@@ -294,7 +300,10 @@
         <copy file="${module.auto.deps.xml}" tofile="${cluster}/config/ModuleAutoDeps/${code.name.base.dashes}.xml"/>
     </target>
 
-    <target name="release" depends="files-init" if="has.release.dir">
+    <extension-point name="-pre-release"/>
+    <extension-point name="-post-release" depends="-pre-release,-do-release"/>
+    <target name="release" depends="-pre-release,-do-release,-post-release"/>
+    <target name="-do-release" depends="files-init,-pre-release" if="has.release.dir">
         <mkdir dir="${cluster}"/>
         <copy todir="${cluster}" overwrite="true">
             <fileset dir="${release.dir}">
@@ -431,7 +440,10 @@
         <zipfileset dir="${cluster}" id="extra.nbm.files" includes="[NOTHING]"/>
     </target>
 
-    <target name="nbm" depends="init,netbeans,-nbm-prompt-for-storepass,-init-executables,-init-extra.nbm.files" description="Build NBM archive.">
+    <extension-point name="-pre-nbm" depends="init,netbeans,-nbm-prompt-for-storepass,-init-executables,-init-extra.nbm.files"/>
+    <extension-point name="-post-nbm" depends="-pre-nbm,-do-nbm"/>
+    <target name="nbm" depends="-pre-nbm,-do-nbm,-post-nbm"/>
+    <target name="-do-nbm" depends="init,netbeans,-nbm-prompt-for-storepass,-init-executables,-init-extra.nbm.files,-pre-nbm" description="Build NBM archive.">
         <mkdir dir="${build.dir}"/>
         <property name="nbm.target.cluster" value=""/> <!-- fallback -->
         <property name="license.file.override" value="${license.file}"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists