| <project name="Construct Maven build command and run build" default="run"> |
| |
| <target name="init"> |
| <property environment="env" /> |
| <property name="tab" value=" " /> |
| </target> |
| |
| <target name="get-inputs"> |
| <echo>--------------------------------------------------------------</echo> |
| <echo>OSEE BUILD - Build Stage</echo> |
| <echo>--------------------------------------------------------------</echo> |
| <property name="input-arguments" value="all,all-ide,all-server,x-core,orcs,dispo,x-ats,x-server,runtime,ote,osee-client,ats-client,coverage,products" /> |
| <input message="${tab}[input] Select build to perform?" validargs="${input-arguments}" defaultvalue="${default-osee-build-stage}" addproperty="input-osee-build-stage"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-osee-build-stage}]" /> |
| |
| <switch value="${input-osee-build-stage}"> |
| <case value="all"> |
| <!--<property name="osee-build-stage" value="osee-all" />--> |
| <property name="osee-build-directory" value="org.eclipse.osee.parent" /> |
| </case> |
| <case value="all-ide"> |
| <property name="osee-build-stage" value="osee-all-ide" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.ide.parent" /> |
| </case> |
| <case value="all-server"> |
| <property name="osee-build-stage" value="osee-all-server" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.x.parent" /> |
| </case> |
| <case value="x-core"> |
| <property name="osee-build-stage" value="osee-x-core" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.core.server.parent" /> |
| </case> |
| <case value="orcs"> |
| <property name="osee-build-stage" value="osee-orcs" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.orcs.parent" /> |
| </case> |
| <case value="dispo"> |
| <property name="osee-build-stage" value="osee-disposition" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.disposition.parent" /> |
| </case> |
| <case value="x-ats"> |
| <property name="osee-build-stage" value="osee-x-ats" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.ats.server.parent" /> |
| </case> |
| <case value="x-server"> |
| <property name="osee-build-stage" value="osee-x-server" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.server.parent" /> |
| </case> |
| <case value="runtime"> |
| <property name="osee-build-stage" value="osee-client-runtime" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.runtime.parent" /> |
| </case> |
| <case value="ote"> |
| <property name="osee-build-stage" value="osee-ote-client" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.ote.rdt.parent" /> |
| </case> |
| <case value="osee-client"> |
| <property name="osee-build-stage" value="osee-client" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.client.parent" /> |
| </case> |
| <case value="ats-client"> |
| <property name="osee-build-stage" value="osee-ats-client" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.ats.ide.parent" /> |
| </case> |
| <case value="products"> |
| <property name="osee-build-stage" value="osee-client-products" /> |
| <property name="osee-build-directory" value="org.eclipse.osee.client.all.parent" /> |
| </case> |
| <default> |
| <echo message="Build stage[${input-osee-build-stage}] is not recognized." /> |
| </default> |
| </switch> |
| <var name="build-options" value=" " /> |
| <if> |
| <isset property="osee-build-stage" /> |
| <then> |
| <var name="build-options" value="${build-options}-Dosee-build-stage=${osee-build-stage}" /> |
| </then> |
| </if> |
| |
| <echo>--------------------------------------------------------------</echo> |
| <echo>OSEE BUILD - Build Options</echo> |
| <echo>--------------------------------------------------------------</echo> |
| |
| <!-- ORG.ECLIPSE.IP --> |
| <input message="${tab}[input] Build using REMOTE ORG.ECLIPSE.IP P2 Site?" validargs="y,n" defaultvalue="${default-build-with-remote-org-eclipse-ip}" addproperty="input-build-with-remote-org-eclipse-ip"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-build-with-remote-org-eclipse-ip}]" /> |
| <if> |
| <equals arg1="${input-build-with-remote-org-eclipse-ip}" arg2="y" /> |
| <then> |
| <input message="${tab}[input] Path to org.eclipse.ip P2 site?${line.separator}${tab}${tab}${tab}" defaultvalue="${default-org-eclipse-ip-site-path}" addproperty="input-org-eclipse-ip-site-path"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <var name="build-options" value="${build-options} -Declipse-ip-site="${input-org-eclipse-ip-site-path}"" /> |
| </then> |
| </if> |
| |
| <!-- SKIP HELP BUILD --> |
| <input message="${tab}[input] Build OSEE Help?" validargs="y,n" defaultvalue="${default-build-osee-help}" addproperty="input-build-osee-help"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-build-osee-help}]" /> |
| <if> |
| <equals arg1="${input-build-osee-help}" arg2="n" /> |
| <then> |
| <var name="build-options" value="${build-options} -Dosee-create-help-docs=false -Dskip-help-tests=true" /> |
| </then> |
| </if> |
| |
| <!-- SKIP PRODUCT BUILD --> |
| <input message="${tab}[input] Build OSEE RCP Product (slows down build)?" validargs="y,n" defaultvalue="${default-build-rcp-ide-product}" addproperty="input-build-rcp-ide-product"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-build-rcp-ide-product}]" /> |
| <if> |
| <equals arg1="${input-build-rcp-ide-product}" arg2="n" /> |
| <then> |
| <var name="build-options" value="${build-options} -Dskip-osee-client-all-product" /> |
| </then> |
| </if> |
| |
| <!-- STATIC ANALYSIS --> |
| <input message="${tab}[input] Perform Static Analysis?" validargs="y,n" defaultvalue="${default-static-analysis}" addproperty="input-static-analysis"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-static-analysis}]" /> |
| <if> |
| <equals arg1="${input-static-analysis}" arg2="y" /> |
| <then> |
| <var name="build-options" value="${build-options} -Dwith-static-analysis" /> |
| </then> |
| </if> |
| |
| <echo>--------------------------------------------------------------</echo> |
| <echo>OSEE BUILD - Maven Options</echo> |
| <echo>--------------------------------------------------------------</echo> |
| <!-- LIFECYCLE PHASE --> |
| <input message="${tab}[input] Maven lifecycle phase?" defaultvalue="${default-maven-lifecycle}" addproperty="input-maven-lifecycle"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <property name="maven-goal" value="${input-maven-lifecycle}" /> |
| |
| <echo message="${tab}${tab}Selected: [${maven-goal}]" /> |
| |
| <!-- DEBUG OPTIONS --> |
| <input message="${tab}[input] Maven options (-X -e)?" defaultvalue="${default-maven-options}" addproperty="input-maven-options"> |
| <handler classname="org.apache.tools.ant.input.DefaultInputHandler" /> |
| </input> |
| <echo message="${tab}${tab}Selected: [${input-maven-options}]" /> |
| <if> |
| <isset property="input-maven-options" /> |
| <then> |
| <var name="build-options" value="${input-maven-options} ${build-options}" /> |
| </then> |
| </if> |
| |
| <!-- UPDATE CODE QUALITY STATS --> |
| <!--<input message=" [input] Upload code quality data after build [default: n]?" validargs="y,n" addproperty="input-sonar-analysis" /> |
| SONAR: run-sonar --> |
| <!-- -Dmaven.test.skip=true --> |
| <!-- JAVADOC Generation: allow-javadoc --> |
| |
| <property name="maven-options" value="${build-options}" /> |
| <property name="pom-directory" value="${repository-base}/plugins/${osee-build-directory}" /> |
| </target> |
| |
| <target name="load-settings"> |
| <property name="custom-settings" value="${store-settings-dir}/custom-settings.properties" /> |
| <if> |
| <not> |
| <available file="${custom-settings}" /> |
| </not> |
| <then> |
| <mkdir dir="${store-settings-dir}" /> |
| <copy file="${default-settings-file}" tofile="${custom-settings}" /> |
| </then> |
| </if> |
| <loadproperties taskname="load-settings" srcfile="${custom-settings}" /> |
| </target> |
| |
| <target name="save-settings"> |
| <propertyfile taskname="save-settings" file="${custom-settings}" comment="OSEE Build Last Values Selected"> |
| <entry key="default-osee-build-stage" value="${input-osee-build-stage}" /> |
| <entry key="default-build-with-remote-org-eclipse-ip" value="${input-build-with-remote-org-eclipse-ip}" /> |
| <entry key="default-org-eclipse-ip-site-path" value="${input-org-eclipse-ip-site-path}" /> |
| <entry key="default-build-osee-help" value="${input-build-osee-help}" /> |
| <entry key="default-build-rcp-ide-product" value="${input-build-rcp-ide-product}" /> |
| <entry key="default-static-analysis" value="${input-static-analysis}" /> |
| <entry key="default-coverage-analysis" value="${input-coverage-analysis}" /> |
| <entry key="default-maven-lifecycle" value="${input-maven-lifecycle}" /> |
| <entry key="default-maven-options" value="${input-maven-options}" /> |
| </propertyfile> |
| </target> |
| |
| <target name="stages"> |
| <loadresource property="modules-server"> |
| <file file="modules-server.txt" /> |
| </loadresource> |
| <loadresource property="modules-client"> |
| <file file="modules-client.txt" /> |
| </loadresource> |
| <echo>--------------------------------------------------------------</echo> |
| <echo> OSEE ALL - [all] </echo> |
| <echo>--------------------------------------------------------------</echo> |
| <echo> SERVER - [all-server] </echo> |
| <echo/> |
| <echo>${modules-server}</echo> |
| <echo/> |
| <echo>--------------------------------------------------------------</echo> |
| <echo> CLIENT - [all-ide] </echo> |
| <echo/> |
| <echo>${modules-client}</echo> |
| <echo/> |
| <echo>--------------------------------------------------------------</echo> |
| </target> |
| |
| <target name="execute-build"> |
| <echo>--------------------------------------------------------------</echo> |
| <echo>OSEE BUILD - Execute</echo> |
| <echo>--------------------------------------------------------------</echo> |
| <echo>Maven Goal: [${maven-goal}]</echo> |
| <echo>Maven Options: [${maven-options}]</echo> |
| <echo>Maven Parent Directory: [${pom-directory}]</echo> |
| <echo>Maven Command: [mvn ${maven-goal}${maven-options}]</echo> |
| <echo>--------------------------------------------------------------</echo> |
| <echo /> |
| <maven basedir="${pom-directory}" options="${maven-options}" goal="${maven-goal}" resultproperty="maven.build.result" /> |
| </target> |
| |
| <!-- *************************************************************** --> |
| <!-- MAIN --> |
| <!-- *************************************************************** --> |
| <target name="run" depends="init,load-settings,stages,get-inputs,save-settings,execute-build" /> |
| |
| <!-- *************************************************************** --> |
| <!-- MAVEN MACRO --> |
| <!-- *************************************************************** --> |
| <macrodef name="maven"> |
| <attribute name="options" default="" /> |
| <attribute name="goal" /> |
| <attribute name="basedir" /> |
| <attribute name="resultproperty" default="maven.result" /> |
| <element name="args" implicit="true" optional="true" /> |
| <sequential> |
| <echo message="MAVEN HOME: [${maven.home}]" /> |
| <!--<echo message="MAVEN OPTS: [${env.MAVEN_OPTS}]" />--> |
| <echo message="POM Directory: [@{basedir}]" /> |
| |
| <java taskname="mvn" newenvironment="false" classname="org.codehaus.classworlds.Launcher" fork="true" dir="@{basedir}" resultproperty="@{resultproperty}"> |
| <syspropertyset> |
| <propertyref prefix="javax.net.ssl" /> |
| </syspropertyset> |
| <classpath> |
| <fileset dir="${maven.home}/boot"> |
| <include name="*.jar" /> |
| </fileset> |
| <fileset dir="${maven.home}/lib"> |
| <include name="*.jar" /> |
| </fileset> |
| </classpath> |
| <sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf" /> |
| <sysproperty key="maven.home" value="${maven.home}" /> |
| <arg line="--batch-mode @{options} @{goal}" /> |
| </java> |
| </sequential> |
| </macrodef> |
| |
| </project> |