build.xml
author chrislovsund@netbeans.org
Wed, 15 Aug 2012 19:43:54 +0200
branchrelease72
changeset 277 092b7a73a3ff
parent 43 88e04440a445
child 278 30a3cac5c474
permissions -rw-r--r--
Close release72 branch
     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="plsql support" basedir="." default="netbeans">
     6     <description>Builds the module suite plsql support.</description>
     7     
     8     <property file="nbproject/private/platform-private.properties"/>
     9     <property file="build.properties"/>
    10     <property file="nbproject/platform.properties"/>
    11     
    12     <property name="use.timestamp" value="true"/>
    13     <property name="timestamp.file" value=".lastModified"/>
    14     
    15     <property environment="env"/>
    16    <property name="env.BUILD_NUMBER" value="0" description="Set a fake value if not run from Jenkins"/>
    17    <property name="env.next_jira_release_version" value="8.72.0" description="Set a fake value if not run from Jenkins"/>
    18    <property name="new_version" value="${env.next_jira_release_version}.${env.BUILD_NUMBER}" description="Set a version number based on info from Jenkins"/>
    19 
    20     <condition property="build.id" value="${env.BUILD_ID}" else="dev">
    21         <isset property="env.BUILD_ID"/>
    22     </condition>
    23     
    24     <target name="calculate-netbeans-url" unless="skip.calculation">
    25         <get src="${netbeans.base.url}" dest="netbeans.html" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
    26         <loadfile srcfile="netbeans.html" property="netbeans.binaries.url">
    27             <filterchain>
    28                 <tokenfilter>
    29                     <containsregex pattern=".*href=&quot;(netbeans-[a-z0-9-.]*javaee\.zip)&quot;.*" replace="${netbeans.base.url}/\1" flags="im"/>
    30                 </tokenfilter>
    31             </filterchain>
    32         </loadfile>
    33     </target>
    34 
    35     <target name="download-binaries" depends="calculate-netbeans-url" unless="skip.download">
    36         <parallel>
    37             <get src="${netbeans.binaries.url}" dest="netbeans.zip" usetimestamp="${use.timestamp}" verbose="false" ignoreerrors="${offline}"/>
    38         </parallel>
    39      </target>
    40      
    41      <target name="check-binaries">
    42         <condition property="binaries.uptodate">
    43             <and>
    44                 <uptodate targetfile="${timestamp.file}">
    45                     <srcfiles dir="." includes="*.zip"/>
    46                 </uptodate>
    47             </and>            
    48         </condition>
    49      </target>     
    50 
    51      <target name="unzip-binaries" unless="binaries.uptodate">
    52         <echo message="New binaries downloaded - re-installing."/>
    53         <delete dir="ide"/>
    54         <unzip src="netbeans.zip" dest="ide"/>
    55         <touch file="${timestamp.file}"/>        
    56     </target>
    57     
    58     <target name="update-binaries" depends="download-binaries,check-binaries,unzip-binaries"/>
    59     
    60     <target name="check-harness">
    61         <echo>nbplatform.default.netbeans.dest.dir resolved to ${nbplatform.default.netbeans.dest.dir}</echo>
    62         <echo>nbplatform.default.harness.dir resolved to ${nbplatform.default.harness.dir}</echo>
    63         <fail message="Harness is missing. Specify nbplatform.default.netbeans.dest.dir={path-to-your-sources-root}/ide/netbeans in nbproject/private/platform-private.propetries">
    64             <condition>
    65                 <not>
    66                     <available file="${nbplatform.default.harness.dir}" type="dir"/>
    67                 </not>
    68             </condition>
    69         </fail>
    70     </target>
    71     
    72     <target name="build-suite" depends="check-harness">
    73         <ant antfile="build-suite.xml" target="build" inheritAll="false"/>
    74     </target>
    75     
    76     <target name="printinfo">
    77       <property environment="env" />
    78       <echo message="${env.BUILD_TAG}"/>
    79       <echo message="${env.JAVA_HOME}"/>
    80     </target>
    81     
    82     <target name="netbeans" depends="update-binaries,build-suite"/>
    83     <target name="build" depends="netbeans"/>
    84     
    85     <target name="clean">
    86         <echo>nbplatform.default.netbeans.dest.dir resolved to ${nbplatform.default.netbeans.dest.dir}</echo>
    87         <echo>nbplatform.default.harness.dir resolved to ${nbplatform.default.harness.dir}</echo>
    88         <ant antfile="build-suite.xml" target="clean" inheritAll="false"/>
    89     </target>
    90     
    91     <target name="real-clean" depends="clean">
    92         <echo message="Cleaning netbeans IDE"/>
    93         <delete dir="build"/>
    94         <delete dir="dist"/>
    95         <delete dir="ide"/>
    96         <delete>
    97             <fileset dir="." includes="*.zip"/>
    98         </delete>
    99         <delete>
   100             <fileset dir="." includes="*.html"/>
   101         </delete>
   102         <delete file="${timestamp.file}"/>
   103     </target>
   104 
   105     <target name="nbms" depends="update-binaries">
   106         <ant antfile="build-suite.xml" target="nbms" inheritAll="false"/>
   107     </target>
   108     
   109     <target name="daily" depends="update-binaries,build">
   110         <mkdir dir="dist"/>
   111         <zip destfile="dist/netbeans-701-${build.id}-plsql.zip" duplicate="add">
   112             <zipfileset dir="build/cluster" prefix="netbeans/extra"/>
   113             <zipfileset dir="ide/netbeans" prefix="netbeans"/>
   114         </zip>
   115     </target>
   116 
   117    <property name="ant.contrib.jar" value="${basedir}/Libraries/ThirdParty/ant/ant-contrib-1.0b3.jar" />
   118    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
   119       <classpath>
   120          <pathelement location="${ant.contrib.jar}"/>
   121       </classpath>
   122    </taskdef>
   123 
   124    <path id="manifest.file.paths">
   125       <fileset dir="${basedir}">
   126          <include name="**/manifest.mf"/>
   127 <!--            <exclude name="**/Libraries/ThirdParty/**"/>-->
   128       </fileset>
   129    </path>
   130 
   131    <target name="-find-modules-for-update" description="find all modules in suite that has changes since last release" >
   132       <loadproperties srcfile="nbproject/project.properties" />
   133       <mkdir dir="build"/>
   134       <delete file="build/nbms_update.properties" />
   135 
   136       <echo level="verbose">${modules}</echo>
   137 
   138       <foreach param="module.path" target="-vcs-log" list="${modules}" delimiter=":"/>
   139 <!--        <echoproperties srcfile="build/nbms_update.properties" />-->
   140    </target>
   141 
   142    <target name="-add-kit-module" description="add kit module to update" >
   143       <propertyfile  file="build/nbms_update.properties">
   144          <entry key="selected.modules" default="" operation="+" value="plsql-support.kit/manifest.mf:"/>
   145       </propertyfile>
   146    </target>
   147 
   148    <target name="-vcs-log" description="use mercurial to check if the last commit was a release commit">
   149       <echo level="info">module.path: ${module.path}</echo>
   150 
   151         <!-- find out revision number of HEAD, need svn.exe installed on local machine -->
   152       <exec executable="hg" outputproperty="hglog.out" >
   153          <arg line="log -l 1 --style compact '${module.path}'"/>
   154       </exec>
   155       <echo level="verbose">${hglog.out}</echo>
   156 
   157       <echo level="verbose">${force.increment}</echo>
   158       <condition property="nbm.update.needed">
   159          <or>
   160             <not>
   161                <contains string="${hglog.out}" substring="automated commit from "/>
   162             </not>
   163             <istrue value="${force.increment}" />
   164          </or>
   165       </condition>
   166       <echo level="verbose">nbm.update.needed=${nbm.update.needed}</echo>
   167       <antcall target="-concat-modules"  inheritall="true" />
   168    </target>
   169 
   170    <target name="-concat-modules" if="nbm.update.needed" description="Concatinate the selected module paths and put in .properties file">
   171       <echo>Module needs to be updated: ${nbm.update.needed}</echo>
   172       <echo level="info">module.path: ${module.path}</echo>
   173       <propertyfile  file="build/nbms_update.properties">
   174          <entry key="selected.modules" default="" operation="+" value="${module.path}/manifest.mf:"/>
   175       </propertyfile>
   176    </target>
   177 
   178    <target name="show-current-versions" description="show current specification versions for all modules">
   179       <foreach param="manifest.file" target="current-version" >
   180          <path refid="manifest.file.paths"/>
   181       </foreach>
   182    </target>
   183 
   184    <target name="current-version" depends="-read-version" description="show current specification.version">
   185    </target>
   186 
   187    <target name="update-version" depends="-find-modules-for-update, -add-kit-module"
   188            description="update version for all modules in suite that has changes since last release">
   189       <echo level="info">Updating modules to version: ${new_version}</echo>
   190       <loadproperties srcfile="build/nbms_update.properties" />
   191       <echo>selected.modules=${selected.modules}</echo>
   192       <foreach param="manifest.file" target="-update-meta-files" >
   193          <path path="${selected.modules}"/>
   194       </foreach>
   195    </target>
   196 
   197    <target name="-read-version">
   198       <echo level="verbose">manifest.file: ${manifest.file}</echo>
   199       <property file="${manifest.file}"></property>
   200       <property name="specification.version" value="${OpenIDE-Module-Specification-Version}"/>
   201       <echo>OpenIDE-Module: ${OpenIDE-Module}</echo>
   202       <echo>Current build number:${env.BUILD_NUMBER}</echo>
   203    </target>
   204 
   205    <target name="-update-meta-files" depends="-read-version">
   206       <manifest file="${manifest.file}" mode="update" >
   207          <attribute name="OpenIDE-Module-Specification-Version" value="${new_version}" />
   208       </manifest>
   209       <replaceregexp match="(dependency\D*code-name-base\W${OpenIDE-Module}\W/\D*)(\d+\.\d+\.\d+\.\d+)" byline="false"
   210                      file="plsql-support.kit/nbproject/project.xml" replace="\1${new_version}"/>
   211    </target>
   212 
   213    <target name="all">
   214       <propertyfile  file="build_info.properties">
   215          <entry key="build.major.number" type="int" operation="+" value="1" />
   216          <entry key="build.minor.number" type="int" operation="+" value="1" />
   217          <entry key="build.revision.number" type="int" operation="+" value="1" />
   218       </propertyfile>
   219    </target>
   220 
   221    <target name="echo-manifest" description="echo kit version that is found in manifest. Used by hudson" >
   222       <echoproperties srcfile="plsql-support.kit/manifest.mf"/>
   223    </target>
   224 
   225 </project>