avatar-js/common.xml

229 lines
8.7 KiB
XML
Raw Normal View History

2013-09-27 23:05:37 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<project name="avatar-js-libs" basedir=".">
<target name="common-init">
<property file="${user.home}/.avatar-js.properties"/>
<property name="javac.debug" value="true"/>
<property name="javac.debuglevel" value="lines"/>
<property name="common.dir" location="${basedir}/.."/>
<property name="common.lib.dir" value="${common.dir}/lib"/>
<property name="common.dist.dir" value="${common.dir}/dist"/>
<property name="classes.dir" location="classes"/>
<property name="dist.dir" location="dist"/>
<property name="test.classes.dir" location="test-classes"/>
<property name="test.reports.dir" location="test-reports"/>
<property name="test.output.dir" location="test-output"/>
<condition property="isMacOSX">
<and>
<os family="unix"/>
<os family="mac"/>
</and>
</condition>
<condition property="isLinux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="isUnix">
<and>
<os family="unix"/>
<not>
<os family="windows"/>
</not>
</and>
</condition>
<condition property="isWindows">
<and>
<os family="windows"/>
<not>
<os family="unix"/>
</not>
</and>
</condition>
<!-- workaround for ant setting java.home to the jdk's jre -->
<condition property="is.jre">
<matches string="${java.home}" pattern="[/|\\]jre$"/>
</condition>
<condition property="jdk.home" value="${java.home}/..">
<isset property="is.jre"/>
</condition>
<condition property="jdk.home" value="${java.home}">
<not>
<isset property="is.jre"/>
</not>
</condition>
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath location="${testng.jar}"/>
</taskdef>
<tstamp/>
</target>
<target name="init-linux" depends="init" if="isLinux">
<property name="product.lib" value="${dist.dir}/${product.name}.so"/>
</target>
<target name="init-macos" depends="init" if="isMacOSX">
<property name="product.lib" value="${dist.dir}/${product.name}.dylib"/>
</target>
<target name="init-windows" depends="init" if="isWindows">
<property name="product.lib" value="${dist.dir}/${product.name}.dll"/>
</target>
<target name="config-gyp">
<property name="gypi" value="config.gypi"/>
<echo file="${gypi}" append="false"># Do not edit. Generated by 'ant configure'. ${line.separator}</echo>
<echo file="${gypi}" append="true">{ 'variables': { ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'JAVA_HOME%': '${jdk.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'SOURCE_HOME%': '${source.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> },${line.separator}</echo>
<echo file="${gypi}" append="true"> 'target_defaults': {'default_configuration': '${build.type}'}${line.separator}</echo>
<echo file="${gypi}" append="true">}${line.separator}</echo>
</target>
<macrodef name="gyp">
<attribute name="format"/>
<attribute name="library"/>
<attribute name="target"/>
<sequential>
<exec executable="python" dir="." failonerror="true">
<arg value="${source.home}/tools/gyp/gyp"/>
<arg value="--depth=."/>
<arg value="--format=@{format}"/>
<arg value="-Dtarget_arch=x64"/>
<arg value="-Dlibrary=@{library}"/>
<arg value="-Dtarget=@{target}"/>
<arg value="${product.name}.gyp"/>
</exec>
</sequential>
</macrodef>
<target name="configure" depends="init-linux, init-macos, init-windows, configure-unix, configure-mac, configure-windows">
<copy todir="${native.build.dir}">
<fileset dir="src/main/native" includes="**/*.cpp"/>
<fileset dir="src/main/native" includes="**/*.h"/>
</copy>
<uptodate property="product.lib.uptodate" targetfile="${product.lib}">
<srcfiles dir="${native.build.dir}" includes="**/*.h"/>
<srcfiles dir="${native.build.dir}" includes="**/*.cpp"/>
</uptodate>
</target>
<target name="compile" depends="init">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" debug="${javac.debug}" destdir="${classes.dir}" srcdir="${src.java.dir}">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-deprecation"/>
<compilerarg value="-Werror"/>
<classpath refid="javac.classpath.id"/>
</javac>
</target>
<target name="make" depends="configure, compile, javah, make-linux, make-macos, make-windows"
description="runs make to build native sources"/>
<target name="make-linux" if="isLinux" unless="product.lib.uptodate">
<exec executable="make" failonerror="true"/>
<copy todir="${dist.dir}">
<fileset dir="out/${build.type}/lib.target">
<include name="*.so"/>
</fileset>
<firstmatchmapper>
<globmapper from="libuv.so" to="libuv.so.0.10"/>
<globmapper from="*" to="*"/>
</firstmatchmapper>
</copy>
</target>
<target name="make-macos" if="isMacOSX" unless="product.lib.uptodate">
<exec executable="make" failonerror="true"/>
<copy todir="${dist.dir}">
<fileset dir="out/${build.type}">
<include name="*.dylib"/>
</fileset>
</copy>
</target>
<target name="make-windows" if="isWindows" unless="product.lib.uptodate">
<exec executable="msbuild" failonerror="true">
<arg value="${product.name}.sln"/>
<arg value="/p:Platform=x64"/>
<arg value="/p:Configuration=${build.type}"/>
</exec>
<copy todir="${dist.dir}">
<fileset dir="${build.type}">
<include name="*.dll"/>
</fileset>
<firstmatchmapper>
<globmapper from="libuv-java.dll" to="uv-java.dll"/>
<globmapper from="*" to="*"/>
</firstmatchmapper>
</copy>
</target>
<target name="clean" depends="init" description="clean output dirs">
<delete dir="out"/>
<delete dir="${classes.dir}"/>
<delete dir="${test.classes.dir}"/>
<delete dir="${test.reports.dir}"/>
<delete dir="${test.output.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${build.type}"/>
<delete dir="Debug"/>
<delete dir="Default"/>
<delete dir="Release"/>
<delete file="config.gypi"/>
<delete file="Makefile"/>
<delete file="${product.name}.Makefile"/>
<delete file="${product.name}.target.mk"/>
<delete file="${product.name}.sln"/>
<delete file="${product.name}.vcxproj"/>
<delete file="${product.name}.vcxproj.filters"/>
<delete file="gyp-mac-tool"/>
2013-10-17 19:08:05 +00:00
<delete>
<fileset dir="." includes="test*.txt"/>
<fileset dir="." includes="*.log"/>
</delete>
2013-09-27 23:05:37 +00:00
</target>
<target name="test" depends="compile-tests">
<testng outputdir="${test.reports.dir}" useDefaultListeners="true"
listener="org.testng.reporters.XMLReporter">
<classfileset dir="${test.classes.dir}" includes="**/*Test.class"/>
<classpath path="${classes.dir}"/>
<classpath path="${test.classes.dir}"/>
<classpath refid="javac.test.classpath.id"/>
<jvmarg value="-Xverify:all"/>
<jvmarg value="-Xcheck:jni"/>
<jvmarg value="-Xmx1g"/>
<sysproperty key="java.library.path" value="${dist.dir}"/>
</testng>
</target>
<target name="compile-tests" depends="jar">
<mkdir dir="${test.classes.dir}"/>
<javac includeantruntime="false" debug="true" destdir="${test.classes.dir}" srcdir="${test.java.dir}">
<classpath path="${classes.dir}"/>
<classpath path="${testng.jar}"/>
<classpath refid="javac.test.classpath.id"/>
</javac>
<copy todir="${test.classes.dir}" failonerror="false">
<fileset dir="${test.java.dir}/../js"/>
</copy>
</target>
</project>