| <?xml version="1.0" encoding="utf-8" ?> |
| <!-- |
| * Licensed to the Apache Software Foundation (ASF) under one * |
| * or more contributor license agreements. See the NOTICE file * |
| * distributed with this work for additional information * |
| * regarding copyright ownership. The ASF licenses this file * |
| * to you under the Apache License, Version 2.0 (the * |
| * "License"); you may not use this file except in compliance * |
| * with the License. You may obtain a copy of the License at * |
| * * |
| * http://www.apache.org/licenses/LICENSE-2.0 * |
| * * |
| * Unless required by applicable law or agreed to in writing, * |
| * software distributed under the License is distributed on an * |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
| * KIND, either express or implied. See the License for the * |
| * specific language governing permissions and limitations * |
| * under the License. * |
| --> |
| <project name="etch.common" basedir="." > |
| |
| <!-- Static properties --> |
| <property name="Etch.copyrightNotice" |
| value="Copyright © Apache Software Foundation 2009" /> |
| |
| <!-- Load Environment --> |
| <property environment="env" /> |
| <property file="${Etch.basedir}/build.dependencies" prefix="file" /> |
| |
| <!-- Pull properties from commandline --> |
| <condition property="build.javacc.home" value="${javacc.home}" > |
| <isset property="javacc.home" /> |
| </condition> |
| |
| <condition property="build.junit.lib" value="${junit.lib}" > |
| <isset property="junit.lib" /> |
| </condition> |
| |
| <condition property="build.velocity.lib" value="${velocity.lib}" > |
| <isset property="velocity.lib" /> |
| </condition> |
| |
| <property file="${Etch.basedir}/build.dependencies" prefix="build" /> |
| |
| |
| <!-- Validate properties --> |
| |
| <!-- Compute top of tree --> |
| <condition property="Etch.basedir" value="${basedir}" > |
| <not><isset property="Etch.basedir" /></not> |
| </condition> |
| <property name="Etch.runtime.workspace" value="${Etch.basedir}" /> |
| |
| <!-- load runtime properties --> |
| <property prefix="Etch.property." file="${Etch.basedir}/etch.properties" /> |
| <property prefix="Etch.runtime." file="${Etch.basedir}/bamboo.properties" /> |
| |
| <!-- Compute version numbers --> |
| <condition property="Etch.property.majorVersion" value="0"> |
| <not><isset property="Etch.property.majorVersion" /></not> |
| </condition> |
| <condition property="Etch.property.minorVersion" value="0" > |
| <not><isset property="Etch.property.minorVersion" /></not> |
| </condition> |
| <condition property="Etch.property.patchVersion" value="0" > |
| <not><isset property="Etch.property.patchVersion" /></not> |
| </condition> |
| <condition property="Etch.runtime.buildKey" value="LOCAL" > |
| <not><isset property="Etch.runtime.buildKey" /></not> |
| </condition> |
| <condition property="Etch.runtime.buildNumber" value="0" > |
| <not><isset property="Etch.runtime.buildNumber" /></not> |
| </condition> |
| <condition property="Etch.runtime.revisionNumber" value="0" > |
| <not><isset property="Etch.runtime.revisionNumber" /></not> |
| </condition> |
| <condition property="Etch.property.suffix" value="" > |
| <not><isset property="Etch.property.suffix" /></not> |
| </condition> |
| |
| <property name="Etch.target" location="${Etch.basedir}/target" /> |
| <property name="Etch.dist" location="${Etch.target}/Installers/dist" /> |
| <property name="Etch.clover-dist" location="${Etch.target}/Installers/dist-clover" /> |
| <property name="Etch.support" location="${Etch.target}/Support/dist" /> |
| <property name="Etch.clover-support" location="${Etch.target}/Support/dist-clover" /> |
| |
| <property name="Etch.version" value="${Etch.property.majorVersion}.${Etch.property.minorVersion}.${Etch.property.patchVersion}" /> |
| <property name="Etch.longversion" value="${Etch.version}${Etch.property.suffix}" /> |
| <property name="Etch.longname" value="apache-etch-${Etch.longversion}" /> |
| <property name="Etch.shortversion" value="${Etch.property.majorVersion}.${Etch.property.minorVersion}" /> |
| <property name="Etch.buildTag" value="${Etch.runtime.buildKey}-${Etch.runtime.buildNumber}" /> |
| <property name="Etch.buildSupportDirectory" location="${Etch.basedir}/build-support" /> |
| <property name="Etch.logDirectory" location="${Etch.target}/BuildLogs" /> |
| <property name="Etch.installerDirectory" location="${Etch.target}/Installers" /> |
| |
| <condition property="Etch.runtime.tests.fail" value="${Etch.target}\fail"> |
| <isset property="build.publish" /> |
| </condition> |
| |
| <!-- define artifacts --> |
| <property name="etch-compiler.jar" value="apache-etch-compiler-${Etch.longversion}.jar" /> |
| <property name="etch-compiler-src.zip" value="apache-etch-compiler-${Etch.longversion}-src.zip" /> |
| <property name="etch-java-compiler.jar" value="apache-etch-java-compiler-${Etch.longversion}.jar" /> |
| <property name="etch-java-compiler-src.zip" value="apache-etch-java-compiler-${Etch.longversion}-src.zip" /> |
| <property name="etch-java-runtime.jar" value="apache-etch-java-runtime-${Etch.longversion}.jar" /> |
| <property name="etch-java-runtime-src.zip" value="apache-etch-java-runtime-${Etch.longversion}-src.zip" /> |
| <property name="etch-c-compiler.jar" value="apache-etch-c-compiler-${Etch.longversion}.jar" /> |
| <property name="etch-c-compiler-src.zip" value="apache-etch-c-compiler-${Etch.longversion}-src.zip" /> |
| <property name="etch-csharp-compiler.jar" value="apache-etch-csharp-compiler-${Etch.longversion}.jar" /> |
| <property name="etch-csharp-compiler-src.zip" value="apache-etch-csharp-compiler-${Etch.longversion}-src.zip" /> |
| <property name="etch-xml-compiler.jar" value="apache-etch-xml-compiler-${Etch.longversion}.jar" /> |
| <property name="etch-xml-compiler-src.zip" value="apache-etch-xml-compiler-${Etch.longversion}-src.zip" /> |
| <property name="etch-util.jar" value="apache-etch-util-${Etch.longversion}.jar" /> |
| <property name="etch-util-src.zip" value="apache-etch-util-${Etch.longversion}-src.zip" /> |
| <property name="etch-ant-task.jar" value="apache-etch-ant-plugin-${Etch.longversion}.jar" /> |
| <property name="etch-ant-task-src.zip" value="apache-etch-ant-plugin-${Etch.longversion}-src.zip" /> |
| |
| <property name="etch-csharp-runtime.dll" value="ApacheEtchCsharpIncubating.dll" /> |
| <property name="etch-csharp-runtime.pdb" value="ApacheEtchCsharpIncubating.pdb" /> |
| <property name="etch-csharp-runtime-src.zip" value="ApacheEtchCsharpIncubatingSrc.zip" /> |
| |
| <!-- Define filterset for build-time substitutions --> |
| <filterset id="Etch.buildTokens" > |
| <filter token="EtchVersion" value="${Etch.version}" /> |
| <filter token="EtchLongVersion" value="${Etch.longversion}" /> |
| <filter token="EtchLongName" value="${Etch.longname}" /> |
| <filter token="EtchBuildTag" value="${Etch.buildTag}" /> |
| <filter token="EtchRuntimeRevisionNumber" value="${Etch.runtime.revisionNumber}" /> |
| <filter token="EtchRuntimeBuildKey" value="${Etch.runtime.buildKey}" /> |
| <filter token="EtchRuntimeBuildNumber" value="${Etch.runtime.buildNumber}" /> |
| <filter token="EtchMajorVersion" value="${Etch.property.majorVersion}" /> |
| <filter token="EtchMinorVersion" value="${Etch.property.minorVersion}" /> |
| <filter token="EtchPatchVersion" value="${Etch.property.patchVersion}" /> |
| </filterset> |
| |
| <!-- TODO: Migrate to .NET tasks for ANT --> |
| <property name="tool.vs-2k5-task" value="${Etch.runtime.workspace}/scripts/vs-2k5-task.bat" /> |
| |
| <!-- NSIS installer support --> |
| <property name="tool.makensis" value="${build.nsis.home}\makensis.exe" /> |
| <condition property="NSIS.enabled"> |
| <and> |
| <os family="windows" /> |
| <available file="${tool.makensis}" /> |
| </and> |
| </condition> |
| |
| <tempfile property="Etch.build.tmpdir" destdir="/tmp" /> |
| |
| <property name="Etch.dependency.javacc.home" value="${build.javacc.home}" /> |
| <property name="Etch.dependency.junit.jar" location="${build.junit.lib}/junit-4.3.1.jar" /> |
| <property name="Etch.dependency.velocity.jar" value="${build.velocity.lib}/velocity-1.5.jar" /> |
| <property name="Etch.dependency.velocity-dep.jar" value="${build.velocity.lib}/velocity-dep-1.5.jar" /> |
| <property name="Etch.dependency.ant-dotnet-1.0.jar" value="${build.ant-dotnet.lib}/ant-dotnet-1.0.jar" /> |
| |
| <!-- Csharp Support --> |
| <condition property="USE.dotnet"> |
| <and> |
| <os family="windows" /> |
| <available file="${build.dotnet.home}/msbuild.exe" /> |
| </and> |
| </condition> |
| <condition property="USE.mono"> |
| <and> |
| <not><os family="windows" /></not> |
| <!-- TODO mono support is not fully baked, use -DUSE.mono to test --> |
| <!-- <available file="${build.mono.home}/bin/mdtool" /> --> |
| <isset property="USE.mono" /> |
| </and> |
| </condition> |
| <condition property="BUILD.csharp"> |
| <or> |
| <isset property="USE.dotnet" /> |
| <isset property="USE.mono" /> |
| </or> |
| </condition> |
| <property name="tool.mdtool" value="${build.mono.home}/bin/mdtool" /> |
| |
| <!-- clover support --> |
| <!-- TODO: make this toggle-able --> |
| <property name="With.clover" value="true" /> |
| <condition property="Clover.enabled" > |
| <and> |
| <available file="${build.clover.home}/lib/clover.jar" /> |
| <isset property="With.clover" /> |
| </and> |
| </condition> |
| <property name="Etch.dependency.clover.jar" value="${build.clover.home}/lib/clover.jar" /> |
| <taskdef resource="cloverlib.xml" classpath="${Etch.dependency.clover.jar}" /> |
| <!-- If Clover is enabled, use the clover version of the Etch build, this |
| allows code-coverage metrics to be collected throughout the build process --> |
| <condition property="Etch.HOME" value="${Etch.clover-dist}" > |
| <istrue value="${Clover.enabled}" /> |
| </condition> |
| <condition property="Etch.HOME" value="${Etch.dist}" > |
| <not><isset property="Etch.HOME" /></not> |
| </condition> |
| <condition property="Etch.SUPPORT" value="${Etch.clover-support}" > |
| <istrue value="${Clover.enabled}" /> |
| </condition> |
| <condition property="Etch.SUPPORT" value="${Etch.support}" > |
| <not><isset property="Etch.SUPPORT" /></not> |
| </condition> |
| <property name="Clover.path" location="${Etch.clover-dist}/clover" /> |
| <property name="Clover.db.path" location="${Clover.path}/db" /> |
| <property name="Clover.db" location="${Clover.db.path}/clover.master.db" /> |
| <property name="Clover.coverage" location="${Clover.path}/code-coverage-results" /> |
| |
| <!-- properties for examples --> |
| <property name="EXAMPLE.etch.home" value="${Etch.dist}" /> |
| <property name="EXAMPLE.etch.version" value="${Etch.version}" /> |
| <property name="EXAMPLE.etch.longversion" value="${Etch.longversion}" /> |
| <property name="EXAMPLE.ant.dotnet.jar" value="${Etch.dependency.ant-dotnet-1.0.jar}" /> |
| |
| <!-- csharp support --> |
| <taskdef onerror="report" resource="org/apache/ant/dotnet/antlib.xml" classpath="${Etch.dependency.ant-dotnet-1.0.jar}" /> |
| |
| <!-- dependencies --> |
| <!-- TODO: remove clover reference if clover-disabled --> |
| <path id="Etch.dependencies.jar.paths"> |
| <pathelement location="${Etch.dependency.velocity-dep.jar}" /> |
| <pathelement location="${Etch.dependency.junit.jar}" /> |
| <pathelement location="${Etch.dependency.clover.jar}" /> |
| </path> |
| |
| <!-- macros --> |
| <macrodef name="build_component" > |
| <attribute name="root" default="." /> |
| <attribute name="dir" /> |
| <attribute name="target" default="${Etch.build.target}" /> |
| <attribute name="script" default="build" /> |
| <attribute name="antfile" default="@{script}.xml" /> |
| <attribute name="loglabel" default="@{dir}" /> |
| <attribute name="output" default="${Etch.logDirectory}/@{loglabel}.@{target}.txt" /> |
| <element name="componentAntElements" optional="true" implicit="true" /> |
| <sequential> |
| <echo message="@{loglabel}.@{target}" /> |
| <ant dir="@{root}/@{dir}" antfile="@{antfile}" inheritAll="false" inheritRefs="false" output="@{output}" target="@{target}"> |
| <propertyset id="build-parameters"> |
| <propertyref name="DO.maven.install" /> |
| <propertyref name="build.tests.fail" /> |
| </propertyset> |
| <componentAntElements /> |
| </ant> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="build_example" > |
| <attribute name="root" default="." /> |
| <attribute name="dir" /> |
| <attribute name="script" default="build" /> |
| <attribute name="antfile" default="@{script}.xml" /> |
| <attribute name="loglabel" default="@{dir}" /> |
| <attribute name="logdir" default="logs" /> |
| <attribute name="target" default="${Etch.build.target}" /> |
| <attribute name="output" default="@{logdir}/@{loglabel}.txt" /> |
| <element name="componentAntElements" optional="true" implicit="true" /> |
| <sequential> |
| <mkdir dir="@{logdir}" /> |
| <echo message="@{loglabel}" /> |
| <ant dir="@{root}/@{dir}" antfile="@{antfile}" inheritAll="false" inheritRefs="false" output="@{output}" target="@{target}"> |
| <propertyset id="examples-parameters"> |
| <propertyref prefix="EXAMPLE" /> |
| <mapper type="glob" from="EXAMPLE.*" to="*" /> |
| </propertyset> |
| <componentAntElements /> |
| </ant> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- token filter macro --> |
| <macrodef name="update-tokens" > |
| <attribute name="filename" /> |
| <attribute name="template" default="@{filename}.tmpl" /> |
| <sequential> |
| <!-- Generate version info --> |
| <copy tofile="@{filename}" file="@{template}" overwrite="true"> |
| <filterset refid="Etch.buildTokens" /> |
| </copy> |
| </sequential> |
| </macrodef> |
| |
| <!-- NSIS macro --> |
| <macrodef name="makensis"> |
| <attribute name="root" default="." /> |
| <attribute name="dir" default="." /> |
| <attribute name="target" default="${Etch.build.target}" /> |
| <attribute name="script" default="myscript" /> |
| <attribute name="loglabel" default="@{script}" /> |
| <attribute name="destfile" default="@{script}-setup.exe" /> |
| <attribute name="version" default="${Etch.version}" /> |
| <attribute name="output" default="${Etch.logsDirectory}/@{loglabel}.@{target}.txt" /> |
| <attribute name="failonerror" default="false" /> |
| <sequential> |
| <exec executable="${tool.makensis}" dir="@{root}/@{dir}" failonerror="@{failonerror}" > |
| <arg value="/V4" /> |
| <arg value="/DPRODUCT_VERSION=@{version}" /> |
| <arg value="/DOUT_FILE=@{destfile}" /> |
| <arg value="@{script}.nsi" /> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| <!-- Clover macro --> |
| <macrodef name="initialize-clover" > |
| <attribute name="enabled" default="${Clover.enabled}" /> |
| <attribute name="suffix" default="none" /> |
| <element name="options" implicit="true" /> |
| <sequential> |
| <!-- TODO: do not make directories if clover is disabled --> |
| <mkdir dir="${Clover.db.path}/@{suffix}" /> |
| <clover-setup |
| initstring="${Clover.db.path}/@{suffix}/clover.db" |
| enabled="@{enabled}" |
| source="1.5" |
| flushpolicy="threaded" |
| flushinterval="90000" > |
| <options /> |
| </clover-setup> |
| </sequential> |
| </macrodef> |
| |
| <!-- MONO mdtool macro --> |
| <macrodef name="mdtool"> |
| <attribute name="dir" default="." /> |
| <attribute name="failonerror" default="false" /> |
| <attribute name="project" default="project.csproj" /> |
| <attribute name="target" default="${Etch.build.target}" /> |
| <sequential> |
| <exec executable="${tool.mdtool}" dir="@{dir}" failonerror="@{failonerror}" > |
| <arg value="build" /> |
| <arg value="--buildfile:@{project}" /> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| </project> |