group.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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 General Public
  8. License Version 2 only ("GPL") or the Common Development and Distribution
  9. License("CDDL") (collectively, the "License"). You may not use this file except in
  10. compliance with the License. You can obtain a copy of the License at
  11. http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
  12. License for the specific language governing permissions and limitations under the
  13. License. When distributing the software, include this License Header Notice in
  14. each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
  15. designates this particular file as subject to the "Classpath" exception as provided
  16. by Oracle in the GPL Version 2 section of the License file that accompanied this code.
  17. If applicable, add the following below the License Header, with the fields enclosed
  18. by brackets [] replaced by your own identifying information:
  19. "Portions Copyrighted [year] [name of copyright owner]"
  20. Contributor(s):
  21. The Original Software is NetBeans. The Initial Developer of the Original Software
  22. is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
  23. Rights Reserved.
  24. If you wish your version of this file to be governed by only the CDDL or only the
  25. GPL Version 2, indicate your decision by adding "[Contributor] elects to include
  26. this software in this distribution under the [CDDL or GPL Version 2] license." If
  27. you do not indicate a single choice of license, a recipient has the option to
  28. distribute your version of this file under either the CDDL, the GPL Version 2 or
  29. to extend the choice of license to its licensees as provided above. However, if you
  30. add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
  31. option applies only if the new code is made subject to such option by the copyright
  32. holder.
  33. -->
  34. <!--
  35. This is the base build script for an nbi group package.
  36. It is not intended to be used directly, but to be imported into derivative
  37. implementation scripts, which will provide properties' values that are
  38. specific the concrete group implementation. The derivative scripts may also
  39. provide some additional functionality that is required by their respective
  40. group implementations.
  41. This script exposes five primary targets: 'init', 'clean', 'checkout',
  42. 'build' and 'release'; as well as two aggregate targets: 'build-all',
  43. which tranlates into 'init', 'clean', 'checkout', 'build', and
  44. 'release-all' - 'init', 'clean', 'checkout', 'build', 'release'. For the
  45. detailed description of the functionality of these targets, consult the
  46. corresponding documentation.
  47. -->
  48. <project name="group" default="usage" basedir=".">
  49. <!-- a default value for the ${common.dir} property, which allows the user
  50. to see the usage information is he calls this script directly and not
  51. via a derivative (which is the proper way to do this) -->
  52. <property name="common.dir" value="${basedir}"/>
  53. <!-- import the common properties -->
  54. <property file="${common.dir}/common.properties"/>
  55. <!-- import properties specific to the group package's build script -->
  56. <property file="${common.dir}/group.properties"/>
  57. <!-- import the common target library -->
  58. <import file="common.xml" optional="false"/>
  59. <!-- ============================================================================
  60. Initialization
  61. ============================================================================= -->
  62. <!--
  63. Initializes the group package's build script.
  64. This target overrides the '-init' target in common.xml, providing the
  65. custom functionality that is required for the group package's build
  66. script initialization.
  67. In addition to the standard initialization routine, this target defines
  68. several custom ant tasks, which are specific to the group package's build
  69. script.
  70. This target is not intended to be called directly.
  71. -->
  72. <target name="-init" depends=".init">
  73. <!-- define custom ant tasks -->
  74. <taskdef
  75. name="sizeof"
  76. classname="org.netbeans.installer.infra.build.ant.SizeOf"
  77. classpath="${custom.tasks.cls}"/>
  78. <taskdef
  79. name="md5"
  80. classname="org.netbeans.installer.infra.build.ant.Md5"
  81. classpath="${custom.tasks.cls}"/>
  82. <taskdef
  83. name="load-locales"
  84. classname="org.netbeans.installer.infra.build.ant.LoadLocales"
  85. classpath="${custom.tasks.cls}"/>
  86. <taskdef
  87. name="group-descriptor"
  88. classname="org.netbeans.installer.infra.build.ant.GroupDescriptor"
  89. classpath="${custom.tasks.cls}"/>
  90. <if property="release.to.server" value="true">
  91. <taskdef
  92. name="release-package-server"
  93. classname="org.netbeans.installer.infra.build.ant.ReleasePackage"
  94. classpath="${custom.tasks.cls}"/>
  95. </if>
  96. <if property="release.to.server" value="false">
  97. <taskdef
  98. name="release-package-filesystem"
  99. classname="org.netbeans.installer.infra.build.ant.registries.AddPackage"
  100. classpath="${custom.tasks.cls}"/>
  101. </if>
  102. </target>
  103. <!-- ============================================================================
  104. Clean-up
  105. ============================================================================= -->
  106. <!--
  107. Cleans the current working directory and the distributives directory.
  108. This target overrides the '-clean' target in common.xml, providing the
  109. custom functionality that is required for correctly cleaning the group
  110. package.
  111. In addition to the standard behavior the group package distributive file
  112. is removed from the distributives directory.
  113. This target is not intended to be called directly.
  114. -->
  115. <target name="-clean" depends=".clean">
  116. <!-- remove the group's distributive file from the distributives
  117. directory -->
  118. <delete file="${dist.dir}/${group.dist.file.name}"/>
  119. </target>
  120. <!-- ============================================================================
  121. Check-out
  122. ============================================================================= -->
  123. <!--
  124. The functionality of the checkout procedure for the group package is
  125. indentical to the standard one, thus there is not need to override the
  126. '-checkout' target, whosew default implementation is present in
  127. common.xml.
  128. -->
  129. <!-- ============================================================================
  130. Build
  131. ============================================================================= -->
  132. <!--
  133. Builds the group package.
  134. This target overrides the '-build' target in common.xml, providing the
  135. custom functionality that is required for correctly building the group
  136. package.
  137. The build process for the grup package consists of four steps.
  138. 1) The group's icon is copied from its location to the group's package
  139. directory structure and some metadata is calculated
  140. 2) The group's localizing bundle is loaded and the group package
  141. descriptor is generated
  142. 3) The manifest for the group package is generated
  143. 4) The package directory structure is jarred, digitally signed and moved
  144. to the distributives directory
  145. This target is not intended to be called directly.
  146. -->
  147. <target name="-build" depends=".build">
  148. <!-- copy the group's icon to the soon-to-be package directory
  149. structure and calculate some metadata for it -->
  150. <copy file="${group.icon}"
  151. tofile="${package.dir}/${group.icon.path}"/>
  152. <sizeof file="${package.dir}/${group.icon.path}"
  153. property="group.icon.size"/>
  154. <md5 file="${package.dir}/${group.icon.path}"
  155. property="group.icon.md5"/>
  156. <set
  157. property="group.icon.correct.uri"
  158. value="${group.icon.uri}"/>
  159. <!-- load the group's localizing bundle and store the locales list to
  160. ${group.locales.list} -->
  161. <load-locales basename="${group.bundle}" list="group.locales.list"/>
  162. <!-- generate the group package descriptor -->
  163. <group-descriptor file="${package.dir}/${package.descriptor.path}"/>
  164. <!-- create the package jar file and sign it -->
  165. <jar basedir="${package.dir}"
  166. destfile="${work.dir}/${group.dist.file.name}"
  167. compress="true">
  168. <manifest>
  169. <attribute
  170. name="Product-Descriptor"
  171. value="${package.descriptor.path}"/>
  172. </manifest>
  173. </jar>
  174. <!-- copy the distributive to the distributives directory -->
  175. <move file="${work.dir}/${group.dist.file.name}"
  176. todir="${dist.dir}"/>
  177. <if property="jarsigner.enabled" value="true">
  178. <signjar jar="${dist.dir}/${group.dist.file.name}"
  179. keystore="${jarsigner.keystore}"
  180. storepass="${jarsigner.storepass}"
  181. alias="${jarsigner.alias}"
  182. maxmemory="${jarsigner.xmx}"/>
  183. </if>
  184. </target>
  185. <!-- ============================================================================
  186. Release
  187. ============================================================================= -->
  188. <!--
  189. Releases the group package to the registries server.
  190. This target overrides the '-release' target in common.xml, providing the
  191. custom functionality that is required for correctly releasing the group
  192. package.
  193. It is assumed that the group package has already been built, but a
  194. dependency on the 'build' target is not defined, as it may be desirable
  195. to build once and then release several times to different registries
  196. servers.
  197. This target is not intended to be called directly.
  198. -->
  199. <target name="-release">
  200. <if property="release.to.server" value="true">
  201. <echo message="Release URL is ${release.url}"/>
  202. <echo message="Archive is ${dist.dir}/${group.dist.file.name}"/>
  203. <release-package-server
  204. url="${release.url}"
  205. registry="${release.registry}"
  206. uid="${release.parent.uid}"
  207. version="${release.parent.version}"
  208. archive="${dist.dir}/${group.dist.file.name}"/>
  209. </if>
  210. <if property="release.to.server" value="false">
  211. <echo message="Registry root is ${release.registry.dir}"/>
  212. <echo message="Archive is ${dist.dir}/${group.dist.file.name}"/>
  213. <release-package-filesystem
  214. root="${release.registry.dir}"
  215. uid="${release.parent.uid}"
  216. version="${release.parent.version}"
  217. archive="${dist.dir}/${group.dist.file.name}"/>
  218. </if>
  219. </target>
  220. <!-- ============================================================================
  221. Default
  222. ============================================================================= -->
  223. <!--
  224. The default target.
  225. Does nothing except printing the usage information.
  226. -->
  227. <target name="usage">
  228. <echo>
  229. This is the base build script for nbi group package and is not
  230. intended to be called directly. In order to create a derivative
  231. implementation script, see
  232. ${basedir}/.templates/group-template.xml
  233. </echo>
  234. </target>
  235. </project>