build.xml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <project name="build installers" default="build" basedir=".">
  2. <property file="${basedir}/build.properties"/>
  3. <property file="${basedir}/custom.properties"/>
  4. <target name="build" depends="init,-build,-generate-bundles,post-build"/>
  5. <target name="init" depends="-clean,-checkout,-init,-init-properties,-post-init-clean"/>
  6. <target name="-clean-cvs" unless="no.checkout">
  7. <delete dir="${nbi.all.dir}"/>
  8. </target>
  9. <target name="-clean" depends="-clean-cvs" unless="no.clean">
  10. <delete dir="${output.dir}"/>
  11. <delete dir="${nbi.ext.dir}/products/helloworld/build"/>
  12. <delete dir="${nbi.ext.dir}/products/helloworld/dist"/>
  13. <!--normen-->
  14. <delete dir="${nbi.ext.dir}/products/jdk/build"/>
  15. <delete dir="${nbi.ext.dir}/products/jdk/dist"/>
  16. <delete dir="${nbi.ext.dir}/engine/build"/>
  17. <delete dir="${nbi.ext.dir}/engine/dist"/>
  18. <!--<delete dir="${basedir}/cache"/>-->
  19. </target>
  20. <target name="post-build">
  21. <delete dir="${output.dir}/registry-temp"/>
  22. </target>
  23. <target name="-checkout">
  24. <copy todir="${nbi.all.dir}/.common">
  25. <fileset dir="${basedir}/.common"/>
  26. </copy>
  27. <copy todir="${nbi.ext.dir}">
  28. <fileset dir="${basedir}/ext">
  29. </fileset>
  30. </copy>
  31. </target>
  32. <target name="-init">
  33. <taskdef
  34. name="if"
  35. classpath="${custom.tasks.cls}"
  36. classname="org.netbeans.installer.infra.build.ant.If"/>
  37. <taskdef
  38. name="for-each"
  39. classpath="${custom.tasks.cls}"
  40. classname="org.netbeans.installer.infra.build.ant.ForEach"/>
  41. <taskdef
  42. name="set"
  43. classpath="${custom.tasks.cls}"
  44. classname="org.netbeans.installer.infra.build.ant.SetProperty"/>
  45. <taskdef
  46. name="create-bundle"
  47. classpath="${custom.tasks.cls}"
  48. classname="org.netbeans.installer.infra.build.ant.registries.CreateBundle"/>
  49. <delete file="${temp.file}"/>
  50. </target>
  51. <target name="-init-properties">
  52. <echo file="${nbi.all.dir}/environment.tmp" encoding="utf-8">
  53. checkout.sources=false
  54. sources.dir=${nbi.all.dir}
  55. cvs.module=ext
  56. release.to.server=false
  57. release.registry.dir=${output.dir}/registry-temp
  58. dont.build.custom.tasks=true
  59. custom.tasks.cls=${custom.tasks.cls}
  60. build.engine=false
  61. engine.dist.file.name=nbi-engine.jar
  62. engine.dist.file=${nbi.core.dir}/infra/build/engine/dist/nbi-engine.jar
  63. packaged.data.dir=${basedir}/cache/packaged
  64. downloads.cache.dir=${basedir}/cache/raw
  65. jarsigner.enabled=${jarsigner.enabled}
  66. </echo>
  67. <replace file="${nbi.all.dir}/environment.tmp" token="\" value="/" encoding="utf-8"/>
  68. <native2ascii src="${nbi.all.dir}" dest="${nbi.all.dir}" encoding="utf-8" includes="environment.tmp" ext=".properties"/>
  69. </target>
  70. <target name="-post-init-clean">
  71. <delete dir="${basedir}/cache/raw"/>
  72. </target>
  73. <target name="-build">
  74. <delete dir="${output.dir}"/>
  75. <mkdir dir="${output.dir}"/>
  76. <mkdir dir="${bundles.release.dir}"/>
  77. <mkdir dir="${output.dir}/components"/>
  78. <property name="engine.dist.file.name" value="nbi-engine.jar"/>
  79. <echo message="BUILDING HELLOWORLD EXT ENGINE =================================="/>
  80. <ant dir="${nbi.ext.dir}/infra/build/engine" target="release-all">
  81. <property
  82. name="basedir"
  83. value="${nbi.ext.dir}/infra/build/engine"/>
  84. <property
  85. name="environment.properties"
  86. value="${environment.properties}"/>
  87. <property
  88. name="core.engine.dist.file"
  89. value="${nbi.engine.jar}"/>
  90. </ant>
  91. <echo message="BUILDING HELLOWORLD PRODUCT =================================="/>
  92. <ant dir="${nbi.ext.dir}/infra/build/products/helloworld" target="release-all">
  93. <property
  94. name="basedir"
  95. value="${nbi.ext.dir}/infra/build/products/helloworld"/>
  96. <property
  97. name="environment.properties"
  98. value="${environment.properties}"/>
  99. <property
  100. name="dist.dir"
  101. value="${output.dir}/components"/>
  102. <property
  103. name="release.parent.uid"
  104. value=""/>
  105. <property
  106. name="release.parent.version"
  107. value=""/>
  108. <property
  109. name="release.parent.platforms"
  110. value=""/>
  111. <property
  112. name="engine.dist.file"
  113. value="${output.dir}/registry-temp/engine.jar"/>
  114. </ant>
  115. <!--normen-->
  116. <for-each property="platform" list="${target.platforms}" separator=" ">
  117. <if property="platform" value="macosx">
  118. <echo message="BUILDING MAC JDK PRODUCT =================================="/>
  119. <ant dir="${nbi.ext.dir}/infra/build/products/jdk" target="release-all">
  120. <property name="basedir" value="${nbi.ext.dir}/infra/build/products/jdk"/>
  121. <property name="environment.properties" value="${environment.properties}"/>
  122. <property name="dist.dir" value="${output.dir}/components"/>
  123. <property name="release.parent.uid" value=""/>
  124. <property name="release.parent.version" value=""/>
  125. <property name="release.parent.platforms" value=""/>
  126. <property name="engine.dist.file" value="${output.dir}/registry-temp/engine.jar"/>
  127. </ant>
  128. </if>
  129. </for-each>
  130. </target>
  131. <target name="-generate-bundles">
  132. <for-each property="platform" list="${target.platforms}" separator=" ">
  133. <condition property="bundle.extention.${platform}" value="exe">
  134. <contains string="${platform}" substring="windows"/>
  135. </condition>
  136. <condition property="bundle.extention.${platform}" value="sh">
  137. <or>
  138. <contains string="${platform}" substring="linux"/>
  139. <contains string="${platform}" substring="solaris"/>
  140. </or>
  141. </condition>
  142. <condition property="bundle.extention.${platform}" value="zip">
  143. <contains string="${platform}" substring="macosx"/>
  144. </condition>
  145. <set property="bundle.extention" source="bundle.extention.${platform}"/>
  146. <!--normen-->
  147. <!-- Linux installers -->
  148. <if property="platform" value="linux-x64">
  149. <create-bundle root="${output.dir}/registry-temp" platform="${platform}"
  150. target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
  151. <component uid="${main.product.uid}" version="${main.product.version}"/>
  152. <property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.bin"/>
  153. </create-bundle>
  154. </if>
  155. <!-- Windows installers -->
  156. <if property="platform" value="windows-x86">
  157. <create-bundle root="${output.dir}/registry-temp" platform="${platform}"
  158. target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
  159. <component uid="${main.product.uid}" version="${main.product.version}"/>
  160. <property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.exe"/>
  161. </create-bundle>
  162. </if>
  163. <if property="platform" value="windows-x64">
  164. <create-bundle root="${output.dir}/registry-temp" platform="${platform}"
  165. target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
  166. <component uid="${main.product.uid}" version="${main.product.version}"/>
  167. <property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.exe"/>
  168. </create-bundle>
  169. </if>
  170. <!-- Mac installer -->
  171. <if property="platform" value="macosx">
  172. <create-bundle root="${output.dir}/registry-temp" platform="${platform}"
  173. target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
  174. <component uid="${main.product.uid}" version="${main.product.version}"/>
  175. <component uid="jdk" version="${main.product.version}"/>
  176. <!--property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/mac_jdk.bin"/-->
  177. </create-bundle>
  178. </if>
  179. <if property="bundle.extention" value="zip">
  180. <antcall target="zip-to-tgz">
  181. <param name="input.file" value="${bundles.release.dir}/${bundle.files.prefix}-${platform}.zip"/>
  182. <param name="output.file" value="${bundles.release.dir}/${bundle.files.prefix}-${platform}.tgz"/>
  183. </antcall>
  184. <delete file="${bundles.release.dir}/${bundle.files.prefix}-${platform}.zip"/>
  185. </if>
  186. </for-each>
  187. <echo>Installer(s) for [${target.platforms}] are available at ${bundles.release.dir}</echo>
  188. </target>
  189. <target name="zip-to-tgz">
  190. <set property="tar.tmpdir"
  191. value="${bundles.release.dir}/tempdir"/>
  192. <mkdir dir="${tar.tmpdir}"/>
  193. <unzip
  194. src="${input.file}"
  195. dest="${tar.tmpdir}"/>
  196. <tar tarfile="${output.file}"
  197. compression="gzip">
  198. <tarfileset dir="${tar.tmpdir}" mode="644">
  199. <include name="**/*.*"/>
  200. <exclude name="**/executable"/>
  201. </tarfileset>
  202. <tarfileset dir="${tar.tmpdir}" mode="755">
  203. <include name="**/executable"/>
  204. </tarfileset>
  205. </tar>
  206. <delete dir="${tar.tmpdir}"/>
  207. </target>
  208. </project>