build.xml
author PGebauer <pgebauer@netbeans.org>
Mon, 19 Dec 2016 11:16:44 +0100
branchdonation_review
changeset 45 06a2bfb5d607
parent 37 e53c993c0d49
permissions -rw-r--r--
The donation_review branch created.
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!-- You may freely edit this file. See harness/README in the NetBeans platform -->
     3 <!-- for some information on what you could do (e.g. targets to override). -->
     4 <!-- If you delete this file and reopen the project it will be recreated. -->
     5 <project name="UML" basedir=".">
     6     <description>Builds the module suite UML.</description>
     7     <property name="zip.name" value="netbeans-7.3.1-201305291404-javase.zip"/>
     8     <property name="zip.url" value="http://download.netbeans.org/netbeans/7.3.1/final/zip/"/>
     9     <!--Delete old copies of platforms-->
    10     <delete>
    11         <fileset dir=".hg" includes="**/*.zip" excludes="${zip.name}"/>
    12     </delete>
    13     <get src="${zip.url}${zip.name}" dest=".hg" skipexisting="true" verbose="true"/>
    14     <!--Only overwrite if newer-->
    15     <unzip src=".hg/${zip.name}" dest=".hg" overwrite="false"/>
    16     <condition property="isNetbeans">
    17         <not>
    18             <isset property="Hudson"/>
    19         </not>
    20     </condition>
    21     <import file="nbproject/build-impl.xml"/>
    22     <property file="nbproject/project.properties"/>
    23 
    24     <target name="nbms">
    25         <antcall target="keystore"/>
    26         <antcall target="suite.nbms"/>
    27     </target>
    28     
    29     <target name="keystore" unless="isNetbeans">
    30         <!--Create/Update keystore-->
    31         <delete file="${keystore.location}${keystore.name}"/>
    32         <mkdir dir="${keystore.location}"/>
    33         <genkey alias="${keystore.alias}" storepass="${keystore.password}"
    34         dname="${keystore.dname}"
    35         keystore="${keystore.location}${keystore.name}"/>
    36         <!--Update keystore info in projects-->
    37         <antcall target="update-keystore-info"/>
    38     </target>
    39 
    40     <target name="update-keystore-info" depends="init-netbeans, init-hudson" unless="isNetbeans">
    41         <for list="${modules}" delimiter=":" param="cur" trim="true">
    42             <sequential>
    43                 <mkdir dir="@{cur}/nbproject/"/>
    44                 <!--Place the information in the properties file-->
    45                 <propertyfile file="@{cur}/nbproject/project.properties">
    46                     <entry  key="keystore" value="../${keystore.location}${keystore.name}"/>
    47                     <entry  key="nbm_alias" value="${keystore.alias}"/>
    48                 </propertyfile>
    49                 <mkdir dir="@{cur}/nbproject/private/"/>
    50                 <!--Place the password in the private properties file-->
    51                 <propertyfile file="@{cur}/nbproject/private/private.properties">
    52                     <entry  key="storepass" value="${keystore.password}"/>
    53                 </propertyfile>
    54             </sequential>
    55         </for>
    56     </target>
    57 
    58     <target name="getAntContribJar">
    59         <fileset id="ant-contrib-jar" dir="${suite.dir}/tools">
    60             <include name="ant-contrib-*.jar" />
    61         </fileset>
    62         <pathconvert property="ant-contrib-jar" refid="ant-contrib-jar" pathsep="," />
    63         <basename property="ant-contrib-filename" file="${ant-contrib-jar}"/>
    64     </target>
    65 
    66     <target name="init-netbeans" depends="getAntContribJar" if="isNetbeans">
    67         <echo>Configuring ant-contrib for Netbeans use...</echo>
    68         <property name="ant-contrib-loc" value="${suite.dir}/tools/${ant-contrib-filename}"/>
    69         <available file="${ant-contrib-loc}" property="ant-contrib.present"/>
    70         <fail unless="ant-contrib.present" message="The ant-contrib jar doesn't exist at: ${ant-contrib-loc}, can't build. Check your settings!" />
    71         <!--We are in not Hudson-->
    72         <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    73             <classpath>
    74                 <pathelement location="${ant-contrib-loc}"/>
    75             </classpath>
    76         </taskdef>
    77     </target>
    78 
    79     <target name="init-hudson" depends="getAntContribJar" unless="isNetbeans">
    80         <echo>Configuring ant-contrib for Hudson use...</echo>
    81         <!--Import Hudson environment variables-->
    82         <property environment="env"/>
    83         <copy file="${suite.dir}/tools/${ant-contrib-filename}" todir="${env.ANT_HOME}/lib/"/>
    84         <property name="ant-contrib-loc" value="${env.ANT_HOME}/lib/${ant-contrib-filename}"/>
    85         <available file="${ant-contrib-loc}" property="ant-contrib.present"/>
    86         <fail unless="ant-contrib.present" message="The ant-contrib jar doesn't exist at: ${ant-contrib-loc}, can't build. Check your settings!" />
    87         <!--Define it. For some reason the approach in init-netbeans doesn't work in Hudson.-->
    88         <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
    89             <classpath>
    90                 <pathelement location="${ant-contrib-loc}"/>
    91             </classpath>
    92         </taskdef>
    93         <taskdef name="propertyregex" classname="net.sf.antcontrib.property.RegexTask">
    94             <classpath>
    95                 <pathelement location="${ant-contrib-loc}"/>
    96             </classpath>
    97         </taskdef>
    98         <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask">
    99             <classpath>
   100                 <pathelement location="${ant-contrib-loc}"/>
   101             </classpath>
   102         </taskdef>
   103     </target>
   104 
   105     <target name="merge-javadoc" depends="init-hudson, init-netbeans" description="Merges javadocs from modules into one">
   106         <property name="merged.javadoc.dir" value="build/javadoc"/>
   107         <!--Creade merged javadoc folder-->
   108         <mkdir dir="${merged.javadoc.dir}"/>
   109         <!--Creade index file-->
   110         <echo file="${merged.javadoc.dir}/index.html">
   111             <![CDATA[
   112             <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   113             <html>
   114             <head>
   115                 <title>Main Index</title>
   116                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   117             </head>
   118             <body>
   119                 <h1>Index</h1>
   120                 <ol>]]>
   121         </echo>
   122         <for list="${modules}" delimiter=":" param="cur" trim="true">
   123             <sequential>
   124                 <echo>Checking @{cur}</echo>
   125                 <available file="@{cur}/build/javadoc/" property="@{cur}.javadoc.present"/>
   126                 <if>
   127                     <equals arg1="${@{cur}.javadoc.present}" arg2="true"/>
   128                     <then>
   129                         <copy todir="${merged.javadoc.dir}/@{cur}">
   130                             <fileset dir="@{cur}/build/javadoc/"/>
   131                         </copy>
   132                     </then>
   133                 </if>
   134             </sequential>
   135         </for>
   136         <dirset id="dist.contents" dir="build/javadoc" includes="*"/>
   137         <property name="prop.dist.contents" refid="dist.contents"/>
   138         <for list="${prop.dist.contents}" delimiter=";" param="cur" trim="true">
   139             <sequential>
   140                 <echo file="${merged.javadoc.dir}/index.html" append="true">
   141                             <![CDATA[<li><a href="]]>
   142                 </echo>
   143                 <!-- Extract from project.xml-->
   144                 <xmlproperty file="@{cur}/nbproject/project.xml" prefix="@{cur}"/>
   145                 <!--Replace dots for dashes-->
   146                 <propertyregex property="@{cur}.pack.name"
   147                     input="${@{cur}.project.configuration.data.code-name-base}"
   148                     regexp="\."
   149                     replace="-"
   150                     casesensitive="false" />
   151                 <!--If the package name has no dots the variable is not defined-->
   152                 <if>
   153                     <not>
   154                         <isset property="@{cur}.pack.name"/>
   155                     </not>
   156                     <then>
   157                         <property name="@{cur}.pack.name" value="@{cur}"/>
   158                     </then>
   159                 </if>
   160                 <echo file="${merged.javadoc.dir}/index.html" append="true">
   161                             @{cur}/${@{cur}.pack.name}/index.html"
   162                 </echo>
   163                 <echo file="${merged.javadoc.dir}/index.html" append="true">
   164                             <![CDATA[>]]>
   165                 </echo>
   166                 <echo file="${merged.javadoc.dir}/index.html" append="true">
   167                             @{cur}
   168                 </echo>
   169                 <echo file="${merged.javadoc.dir}/index.html" append="true">
   170                             <![CDATA[</a></li>]]>
   171                 </echo>
   172             </sequential>
   173         </for>
   174         <echo file="${merged.javadoc.dir}/index.html" append="true">
   175                     <![CDATA[</ol>
   176             </body>
   177             </html>
   178             ]]>
   179         </echo>
   180     </target>
   181     <target name="fix-dependencies" depends="-init">
   182         <subant target="fix-dependencies" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false"/>
   183     </target>
   184 </project>