build.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. <delete dir="${nbi.ext.dir}/engine/build"/>
  14. <delete dir="${nbi.ext.dir}/engine/dist"/>
  15. <!--<delete dir="${basedir}/cache"/>-->
  16. </target>
  17. <target name="post-build">
  18. <delete dir="${output.dir}/registry-temp"/>
  19. </target>
  20. <target name="-checkout">
  21. <copy todir="${nbi.all.dir}/.common">
  22. <fileset dir="${basedir}/.common"/>
  23. </copy>
  24. <copy todir="${nbi.ext.dir}">
  25. <fileset dir="${basedir}/ext">
  26. </fileset>
  27. </copy>
  28. </target>
  29. <target name="-init">
  30. <taskdef
  31. name="if"
  32. classpath="${custom.tasks.cls}"
  33. classname="org.netbeans.installer.infra.build.ant.If"/>
  34. <taskdef
  35. name="for-each"
  36. classpath="${custom.tasks.cls}"
  37. classname="org.netbeans.installer.infra.build.ant.ForEach"/>
  38. <taskdef
  39. name="set"
  40. classpath="${custom.tasks.cls}"
  41. classname="org.netbeans.installer.infra.build.ant.SetProperty"/>
  42. <taskdef
  43. name="create-bundle"
  44. classpath="${custom.tasks.cls}"
  45. classname="org.netbeans.installer.infra.build.ant.registries.CreateBundle"/>
  46. <delete file="${temp.file}"/>
  47. </target>
  48. <target name="-init-properties">
  49. <echo file="${nbi.all.dir}/environment.tmp" encoding="utf-8">
  50. checkout.sources=false
  51. sources.dir=${nbi.all.dir}
  52. cvs.module=ext
  53. release.to.server=false
  54. release.registry.dir=${output.dir}/registry-temp
  55. dont.build.custom.tasks=true
  56. custom.tasks.cls=${custom.tasks.cls}
  57. build.engine=false
  58. engine.dist.file.name=nbi-engine.jar
  59. engine.dist.file=${nbi.core.dir}/infra/build/engine/dist/nbi-engine.jar
  60. packaged.data.dir=${basedir}/cache/packaged
  61. downloads.cache.dir=${basedir}/cache/raw
  62. jarsigner.enabled=${jarsigner.enabled}
  63. </echo>
  64. <replace file="${nbi.all.dir}/environment.tmp" token="\" value="/" encoding="utf-8"/>
  65. <native2ascii src="${nbi.all.dir}" dest="${nbi.all.dir}" encoding="utf-8" includes="environment.tmp" ext=".properties"/>
  66. </target>
  67. <target name="-post-init-clean">
  68. <delete dir="${basedir}/cache/raw"/>
  69. </target>
  70. <target name="-build">
  71. <delete dir="${output.dir}"/>
  72. <mkdir dir="${output.dir}"/>
  73. <mkdir dir="${bundles.release.dir}"/>
  74. <mkdir dir="${output.dir}/components"/>
  75. <property name="engine.dist.file.name" value="nbi-engine.jar"/>
  76. <echo message="BUILDING HELLOWORLD EXT ENGINE =================================="/>
  77. <ant dir="${nbi.ext.dir}/infra/build/engine" target="release-all">
  78. <property
  79. name="basedir"
  80. value="${nbi.ext.dir}/infra/build/engine"/>
  81. <property
  82. name="environment.properties"
  83. value="${environment.properties}"/>
  84. <property
  85. name="core.engine.dist.file"
  86. value="${nbi.engine.jar}"/>
  87. </ant>
  88. <echo message="BUILDING HELLOWORLD PRODUCT =================================="/>
  89. <ant dir="${nbi.ext.dir}/infra/build/products/helloworld" target="release-all">
  90. <property
  91. name="basedir"
  92. value="${nbi.ext.dir}/infra/build/products/helloworld"/>
  93. <property
  94. name="environment.properties"
  95. value="${environment.properties}"/>
  96. <property
  97. name="dist.dir"
  98. value="${output.dir}/components"/>
  99. <property
  100. name="release.parent.uid"
  101. value=""/>
  102. <property
  103. name="release.parent.version"
  104. value=""/>
  105. <property
  106. name="release.parent.platforms"
  107. value=""/>
  108. <property
  109. name="engine.dist.file"
  110. value="${output.dir}/registry-temp/engine.jar"/>
  111. </ant>
  112. </target>
  113. <target name="-generate-bundles">
  114. <for-each property="platform" list="${target.platforms}" separator=" ">
  115. <condition property="bundle.extention.${platform}" value="exe">
  116. <contains string="${platform}" substring="windows"/>
  117. </condition>
  118. <condition property="bundle.extention.${platform}" value="sh">
  119. <or>
  120. <contains string="${platform}" substring="linux"/>
  121. <contains string="${platform}" substring="solaris"/>
  122. </or>
  123. </condition>
  124. <condition property="bundle.extention.${platform}" value="zip">
  125. <contains string="${platform}" substring="macosx"/>
  126. </condition>
  127. <set property="bundle.extention" source="bundle.extention.${platform}"/>
  128. <create-bundle root="${output.dir}/registry-temp"
  129. platform="${platform}"
  130. target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
  131. <!--normen-->
  132. <component uid="${main.product.uid}" version="${main.product.version}"/><!--0.8.0.0.0-->
  133. </create-bundle>
  134. <if property="bundle.extention" value="zip">
  135. <antcall target="zip-to-tgz">
  136. <param name="input.file" value="${bundles.release.dir}/${bundle.files.prefix}-${platform}.zip"/>
  137. <param name="output.file" value="${bundles.release.dir}/${bundle.files.prefix}-${platform}.tgz"/>
  138. </antcall>
  139. <delete file="${bundles.release.dir}/${bundle.files.prefix}-${platform}.zip"/>
  140. </if>
  141. </for-each>
  142. <echo>Installer(s) for [${target.platforms}] are available at ${bundles.release.dir}</echo>
  143. </target>
  144. <target name="zip-to-tgz">
  145. <set property="tar.tmpdir"
  146. value="${bundles.release.dir}/tempdir"/>
  147. <mkdir dir="${tar.tmpdir}"/>
  148. <unzip
  149. src="${input.file}"
  150. dest="${tar.tmpdir}"/>
  151. <tar tarfile="${output.file}"
  152. compression="gzip">
  153. <tarfileset dir="${tar.tmpdir}" mode="644">
  154. <include name="**/*.*"/>
  155. <exclude name="**/executable"/>
  156. </tarfileset>
  157. <tarfileset dir="${tar.tmpdir}" mode="755">
  158. <include name="**/executable"/>
  159. </tarfileset>
  160. </tar>
  161. <delete dir="${tar.tmpdir}"/>
  162. </target>
  163. </project>