build.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  4. Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
  5. Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  6. Other names may be trademarks of their respective owners.
  7. The contents of this file are subject to the terms of either the GNU
  8. General Public License Version 2 only ("GPL") or the Common
  9. Development and Distribution License("CDDL") (collectively, the
  10. "License"). You may not use this file except in compliance with the
  11. License. You can obtain a copy of the License at
  12. http://www.netbeans.org/cddl-gplv2.html
  13. or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  14. specific language governing permissions and limitations under the
  15. License. When distributing the software, include this License Header
  16. Notice in each file and include the License file at
  17. nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
  18. particular file as subject to the "Classpath" exception as provided
  19. by Oracle in the GPL Version 2 section of the License file that
  20. accompanied this code. If applicable, add the following below the
  21. License Header, with the fields enclosed by brackets [] replaced by
  22. your own identifying information:
  23. "Portions Copyrighted [year] [name of copyright owner]"
  24. Contributor(s):
  25. The Original Software is NetBeans. The Initial Developer of the Original
  26. Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
  27. Microsystems, Inc. All Rights Reserved.
  28. If you wish your version of this file to be governed by only the CDDL
  29. or only the GPL Version 2, indicate your decision by adding
  30. "[Contributor] elects to include this software in this distribution
  31. under the [CDDL or GPL Version 2] license." If you do not indicate a
  32. single choice of license, a recipient has the option to distribute
  33. your version of this file under either the CDDL, the GPL Version 2 or
  34. to extend the choice of license to its licensees as provided above.
  35. However, if you add GPL Version 2 code and therefore, elected the GPL
  36. Version 2 license, then the option applies only if the new code is
  37. made subject to such option by the copyright holder.
  38. -->
  39. <project name="harness" basedir="." default="netbeans">
  40. <import file="common.xml"/>
  41. <import file="jdk.xml"/>
  42. <target name="taskdefs" unless="harness.taskdefs.done">
  43. <dirname property="harness.dir" file="${harness.file}"/>
  44. <taskdef classpath="${harness.dir}/tasks.jar" resource="org/netbeans/nbbuild/taskdefs.properties"/>
  45. <typedef name="pathfileset" classname="org.netbeans.nbbuild.PathFileSet"
  46. classpath="${harness.dir}/tasks.jar"/>
  47. <property name="harness.taskdefs.done" value="true"/>
  48. <fail message="When using cluster.path property, remove netbeans.dest.dir, enabled.clusters and disabled.clusters properties from platform config, they would be ignored.">
  49. <condition>
  50. <and>
  51. <isset property="cluster.path.evaluated"/>
  52. <or>
  53. <isset property="netbeans.dest.dir"/>
  54. <isset property="enabled.clusters"/>
  55. <isset property="disabled.clusters"/>
  56. </or>
  57. <not>
  58. <isset property="suite.dir"/>
  59. </not>
  60. </and>
  61. </condition>
  62. </fail>
  63. </target>
  64. <target name="-convert-old-project" unless="cluster.path.evaluated">
  65. <fail unless="netbeans.dest.dir" message="Either cluster.path/cluster.path.evaluated properties or netbeans.dest.dir must be set."/>
  66. <pathconvert property="old.project.update.tracking">
  67. <fileset dir="${netbeans.dest.dir}" includes="**/update_tracking/*.xml"/>
  68. </pathconvert>
  69. <!-- standalone modules don't specify enabled/disabled clusters -->
  70. <property name="enabled.clusters" value=""/>
  71. <property name="disabled.clusters" value=""/>
  72. <property name="disabled.modules" value=""/>
  73. <selector id="old.project.included.files">
  74. <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
  75. <param name="excludeModules" value="${disabled.modules}"/>
  76. <!-- XXX inc/exc clusters -->
  77. <param name="includeClusters" value="${enabled.clusters}"/>
  78. <param name="excludeClusters" value="${disabled.clusters}"/>
  79. <param name="updateTrackingFiles" value="${old.project.update.tracking}"/>
  80. </custom>
  81. </selector>
  82. <pathconvert property="old.project.clusters.duplicates" pathsep="&#10;">
  83. <fileset dir="${netbeans.dest.dir}">
  84. <selector refid="old.project.included.files"/>
  85. </fileset>
  86. <chainedmapper>
  87. <mapper type="regexp" from="(^.+)[/\\]config[/\\]Modules[/\\]" to="\1"/> <!-- #71849 -->
  88. <filtermapper>
  89. <linecontainsregexp negate="true">
  90. <regexp pattern="update[/\\]backup[/\\]netbeans[/\\]?$"/>
  91. </linecontainsregexp>
  92. </filtermapper>
  93. </chainedmapper>
  94. </pathconvert>
  95. <tempfile property="old.project.clusters.duplicates.file" destdir="${basedir}/build" deleteonexit="true" prefix="duplicates"/>
  96. <mkdir dir="${basedir}/build"/>
  97. <echo file="${old.project.clusters.duplicates.file}" message="${old.project.clusters.duplicates}"/>
  98. <pathconvert property="cluster.path.evaluated">
  99. <union id="old.project.clusters"> <!-- union removes duplicates -->
  100. <files includesfile="${old.project.clusters.duplicates.file}"/>
  101. </union>
  102. </pathconvert>
  103. </target>
  104. <target name="common-init" depends="taskdefs,-convert-old-project">
  105. <property name="netbeans.javadoc.dir" location="build/javadoc"/>
  106. <condition property="cluster.path.basedir" value="${suite.dir}" else="${basedir}">
  107. <isset property="suite.dir"/>
  108. </condition>
  109. <convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id" basedir="${cluster.path.basedir}"/>
  110. </target>
  111. <target name="basic-init" depends="projectized-common.basic-init">
  112. <!-- Must be done even without build-init, or clean will not work. -->
  113. <condition property="cluster" value="${suite.dir}/build/cluster"> <!-- #59872 -->
  114. <isset property="suite.dir"/>
  115. </condition>
  116. <property name="cluster" location="build/cluster"/>
  117. <condition property="test.dist.dir" value="${suite.dir}/build/testdist">
  118. <isset property="suite.dir"/>
  119. </condition>
  120. <property name="test.dist.dir" location="build/testdist"/>
  121. <property name="build.classes.dir" location="build/classes"/>
  122. </target>
  123. <target name="init" depends="basic-init,files-init,build-init,-javac-init"/>
  124. <target name="nbm-license-init" unless="license.file">
  125. <mkdir dir="build"/>
  126. <property name="license.file" location="build/no-license.txt"/>
  127. <echo file="${license.file}">[NO LICENSE SPECIFIED]</echo>
  128. </target>
  129. <target name="build-init" depends="basic-init,nbm-license-init">
  130. <condition property="public.package.jar.dir" value="${suite.dir}/build/public-package-jars">
  131. <isset property="suite.dir"/>
  132. </condition>
  133. <property name="public.package.jar.dir" location="build/public-package-jars"/>
  134. <mkdir dir="${public.package.jar.dir}"/>
  135. <!-- Similar to projectized.xml but does not try to set NBM homepage/distribution, nor is javahelp.excludes predefined. -->
  136. <parseprojectxml
  137. project="."
  138. publicpackagesproperty="public.packages"
  139. friendsproperty="friends"
  140. javadocpackagesproperty="module.javadoc.packages"
  141. moduledependenciesproperty="module.dependencies"
  142. moduleclasspathproperty="module.classpath"
  143. publicpackagejardir="${public.package.jar.dir}"
  144. modulerunclasspathproperty="module.run.classpath"
  145. classpathextensionsproperty="class.path.extensions"
  146. >
  147. <testtype name="unit"
  148. folder="test.unit.folder"
  149. runtimecp="test.unit.runtime.cp"
  150. compilecp="test.unit.compile.cp"
  151. compiledep="test.unit.testdep"/>
  152. <testtype name="qa-functional"
  153. folder="test.qa-functional.folder"
  154. runtimecp="test.qa-functional.runtime.cp"
  155. compilecp="test.qa-functional.compile.cp"
  156. compiledep="test.qa-functional.testdep"/>
  157. </parseprojectxml>
  158. <condition property="is.regular">
  159. <not>
  160. <or>
  161. <isset property="is.autoload"/>
  162. <isset property="is.eager"/>
  163. <equals arg1="${module.jar.dir}" arg2="core"/>
  164. <equals arg1="${module.jar.dir}" arg2="lib"/>
  165. </or>
  166. </not>
  167. </condition>
  168. <property name="build.compiler.debug" value="true"/>
  169. <property name="build.compiler.debuglevel" value="source,lines,vars"/>
  170. <property name="build.compiler.deprecation" value="true"/>
  171. <property name="build.sysclasspath" value="ignore"/>
  172. <property name="build.compiler.optimize" value="off"/>
  173. <property name="build.package.compress" value="false"/>
  174. <property name="build.package.index" value="false"/>
  175. <property name="manifest.mf" location="manifest.mf"/>
  176. <property name="src.dir" location="src"/>
  177. <property name="nbm" value="${code.name.base.dashes}.nbm"/>
  178. <property name="nbm.module.author" value=""/>
  179. <property name="nbm.release.date" value=""/>
  180. <property name="nbm.needs.restart" value="false"/>
  181. <property name="nbm.is.global" value=""/>
  182. <!-- Override if you want to use these: -->
  183. <property name="nbm.distribution" value=""/>
  184. <property name="nbm.homepage" value=""/>
  185. <property name="build.javahelp.dir" location="build/javahelp"/>
  186. <property name="javahelp.base" value="${code.name.base.slashes}/docs"/>
  187. <property name="javahelp.search" value="JavaHelpSearch"/>
  188. </target>
  189. <target name="test-lib-init" depends="init">
  190. <!-- NbModuleSuite must be made to ignore disabled.modules during a test; see discussion in #136621: -->
  191. <delete failonerror="false">
  192. <fileset dir="${suite.dir}">
  193. <include name="build/cluster/config/Modules/*.xml_hidden"/>
  194. </fileset>
  195. </delete>
  196. <path id="test.unit.lib.cp">
  197. <pathelement path="${test.unit.lib.cp}"/> <!-- for manual override -->
  198. <!-- As a fallback for old platforms which do not include the right modules: -->
  199. <pathfileset include="modules/ext/junit-*.jar">
  200. <path refid="cluster.path.id"/>
  201. </pathfileset>
  202. <fileset dir="${netbeans.home}/..">
  203. <include name="*/modules/ext/junit-*.jar"/>
  204. </fileset>
  205. </path>
  206. </target>
  207. <target name="javahelp" depends="init" if="has.javahelp">
  208. <!-- Similar to projectized.xml but does not fiddle with usersguide/.../ide.css, and finds jhall.jar differently: -->
  209. <property name="jhall.jar" location="${harness.dir}/antlib/jsearch-2.0_05.jar"/>
  210. <available property="jhall.jar.exists" file="${jhall.jar}"/>
  211. <fail unless="jhall.jar.exists">You must set 'jhall.jar' (e.g. in private.properties) to the location of jsearch.jar from a JavaHelp distribution</fail>
  212. <mkdir dir="${build.javahelp.dir}/${javahelp.base}/${javahelp.search}"/>
  213. <copy todir="${build.javahelp.dir}">
  214. <fileset dir="javahelp"/>
  215. </copy>
  216. <jhindexer basedir="${build.javahelp.dir}/${javahelp.base}"
  217. db="${build.javahelp.dir}/${javahelp.base}/${javahelp.search}">
  218. <classpath>
  219. <pathelement location="${jhall.jar}"/>
  220. <pathelement location="${harness.dir}/tasks.jar"/>
  221. </classpath>
  222. <include name="**/*.html"/>
  223. <include name="**/*.htm"/> <!-- Fix for Issue #160276 -->
  224. <exclude name="${javahelp.search}/"/>
  225. <exclude name="${javahelp.excludes}"/>
  226. </jhindexer>
  227. <mkdir dir="${cluster}/${javahelp.jar.dir}"/>
  228. <jar jarfile="${cluster}/${javahelp.jar}" compress="true">
  229. <fileset dir="${build.javahelp.dir}"/>
  230. </jar>
  231. </target>
  232. <target name="javadoc" depends="build-init,-javadoc-init">
  233. <mkdir dir="${netbeans.javadoc.dir}/${code.name.base.dashes}"/>
  234. <javadoc destdir="${netbeans.javadoc.dir}/${code.name.base.dashes}" packagenames="${module.javadoc.packages}" source="${javac.source}" windowtitle="${javadoc.title}" encoding="UTF-8">
  235. <classpath refid="cp"/>
  236. <classpath path="${module.run.classpath}"/><!-- XXX #157320 -->
  237. <sourcepath location="${src.dir}"/>
  238. <doctitle>${javadoc.title}</doctitle>
  239. <header>${javadoc.header}</header>
  240. </javadoc>
  241. </target>
  242. <target name="javadoc-nb" depends="init,javadoc" if="netbeans.home">
  243. <nbbrowse file="${netbeans.javadoc.dir}/${code.name.base.dashes}/index.html"/>
  244. </target>
  245. <target name="run" depends="netbeans">
  246. <ant antfile="${harness.dir}/run.xml" target="run">
  247. <reference refid="cluster.path.id"/>
  248. </ant>
  249. </target>
  250. <target name="profile" depends="netbeans,-jdk-presetdef-nbprofiledirect">
  251. <ant antfile="${harness.dir}/run.xml" target="profile">
  252. <reference refid="cluster.path.id"/>
  253. </ant>
  254. </target>
  255. <target name="debug" depends="netbeans,-jdk-presetdef-nbjpdastart">
  256. <ant antfile="${harness.dir}/run.xml" target="debug">
  257. <reference refid="cluster.path.id"/>
  258. </ant>
  259. </target>
  260. <target name="reload" depends="netbeans">
  261. <ant antfile="${harness.dir}/run.xml" target="run">
  262. <property name="run.args" value='--reload "${cluster}/${module.jar}"'/>
  263. <property name="run.args.extra" value=""/>
  264. <reference refid="cluster.path.id"/>
  265. </ant>
  266. </target>
  267. <target name="reload-in-ide" depends="netbeans">
  268. <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
  269. <nbinstaller module="${cluster}/${module.jar}" action="reinstall"/>
  270. </target>
  271. </project>