Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 476 lines (436 sloc) 23.183 kB
<?xml version="1.0"?>
<!-- ======================================================================
Ant build file for RACOB.
Created Feb 4, 2005 1:23:05 PM as part of migration from ANT
Last Modified March 24, 2007
Tested on Eclipse 3.3 with the Europa C++ plugins, Ant 1.7 and MS Visual C++ 8 (2005)
Eclipse users are pretty lucky because the whole project
can be built inside eclipse due to their built in ANT support.
The COM portion of this build requires MS Visual C++ 8.0. (2005)
The build proces defined in this build.xml file does not support
YOU MUST define a file named compilation_tools.properties!
The file for MS Visual C++ 8.0 building 32 and 64 bit
(releases up to 1.11 only supported 32 builds) looks something like:
JDK=c:\\dev\\jdk1.5.0_18
MSDEV_DIR=c:\\Program Files\\Microsoft Visual Studio 8\\VC
MSDEV_IDE_DIR=c:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE
version=1.15-M1
DO NOT check compilation_tools.properties into source control as the
values are specific to YOUR environment.
The version.properties file is now completely autogenerated
====================================================================== -->
<project name="racob" default="default" basedir=".">
<!-- ======================================================================
First handle the properties that come from property files
Sets a default for properties that were not in the file.
Relies on the fact that properties cannot be reset once set.
================================================================== -->
<property file="compilation_tools.properties" />
<property environment="env"/>
<echo message="Number of Processors = ${env.NUMBER_OF_PROCESSORS}"/>
<property name="JDK" value="JDK not set in compilation_tools properties file"/>
<!-- MSDEV_DIR is a required parameter so set to a message if its not set -->
<property name="MSDEV_DIR" value="MSDEV_DIR not set in compilation_tools properties file"/>
<echo message="executing with MSDEV_DIR=${MSDEV_DIR}" />
<!-- ======================================================================
Now build up all the derived properties
================================================================== -->
<property name="application.title" value="RACOB : Java COM Bridge" />
<property name="application.vendor" value="http://www.github.com/enebo/racob" />
<property name="src.java.mainpackage" value="org.racob" />
<property name="java.class.main" value="org.racob.com.Jacob" />
<property name="generated.filename.dll.x86" value="racob-x86.dll" />
<property name="generated.filename.dll.x64" value="racob-x64.dll" />
<property name="generated.filename.jar" value="racob.jar" />
<property name="generated.filename.zip" value="racob-${version}" />
<property name="generated.filename.version" value="version.properties" />
<property name="junit.jar" value="${basedir}\lib\junit3.8.1\junit.jar" />
<property name="src.java.mainroot" value="${basedir}/src" />
<property name="src.java.unittest" value="${basedir}/unittest" />
<property name="src.cpp" value="${basedir}/jni" />
<property name="release.dir" value="${basedir}\release" />
<property name="release.dir.x86" value="${release.dir}\x86" />
<property name="release.dir.x86.cpp" value="${release.dir.x86}\jni" />
<property name="release.file.x86.dll" value="${release.dir.x86}\${generated.filename.dll.x86}" />
<property name="release.dir.x64" value="${release.dir}\x64" />
<property name="release.dir.x64.cpp" value="${release.dir.x64}\jni" />
<property name="release.file.x64.dll" value="${release.dir.x64}\${generated.filename.dll.x64}" />
<property name="release.dir.java" value="${release.dir}\java" />
<property name="release.dir.java.meta.inf" value="${release.dir.java}\META-INF" />
<property name="release.file.jar" value="${release.dir.java}\${generated.filename.jar}" />
<property name="compiler.x86" value="${MSDEV_DIR}\bin\cl.exe" />
<property name="linker.x86" value="${MSDEV_DIR}\bin\link.exe" />
<property name="manifestool.x86" value="${MSSDK_DIR}\Bin\mt.exe" />
<property name="include.x86" value="${MSDEV_DIR}\include" />
<property name="include.x86.platformSDK" value="${MSSDK_DIR}\Include" />
<property name="include.x86.atl" value="${MSDEV_DIR}\atlmfc\include" />
<property name="library.x86" value="${MSDEV_DIR}\lib" />
<property name="library.x86.platformSDK" value="${MSSDK_DIR}\Lib" />
<property name="library.x86.atl" value="${MSDEV_DIR}\atlmfc\lib" />
<!-- You have to love the beautiful asymetry of the MS world -->
<!-- The platform SDK comes with 64 bit tools but not 32 bit tools -->
<property name="compiler.x64" value="${MSDEV_DIR}\bin\x86_amd64\cl.exe" />
<property name="linker.x64" value="${MSDEV_DIR}\bin\x86_amd64\link.exe" />
<property name="manifesttool.x64" value="${MSDEV_DIR}\bin\x86_amd64\mt.exe" />
<property name="include.x64" value="${MSDEV_DIR}\include" />
<property name="library.x64" value="${MSDEV_DIR}\lib\amd64" />
<property name="library.x64.platformSDK" value="${MSSDK_DIR}\Lib\x64" />
<property name="library.x64.atl" value="${MSDEV_DIR}\atlmfc\lib\amd64" />
<!-- ======================================================================
Create the necessary directory structure (does nothing if it
already there)
================================================================== -->
<mkdir dir="${release.dir.java}"/>
<mkdir dir="${release.dir.java.meta.inf}"/>
<mkdir dir="${release.dir.x86.cpp}"/>
<mkdir dir="${release.dir.x64.cpp}"/>
<mkdir dir="${release.dir}"/>
<!-- ======================================================================
Writes out a version file to be included in the jar
================================================================== -->
<property name="version" value="version not set in compilation_tools properties file"/>
<propertyfile file="${generated.filename.version}">
<entry key="version" type="string" value="${version}" />
<entry key="build.iteration" type="int" operation="+" value="1" pattern="00" />
<entry key="build.date" type="date" value="now" operation="=" pattern="dd-MMMM-yyyy HH:mm:ss" />
</propertyfile>
<property file="${generated.filename.version}" />
<!-- ======================================================================
32 bit X86 can only be built on 32 bit because of a JDK library issue.
arch=X86 true if on 32 bit, unset in all other cases.
This module used to rely on that. Now it just checks to see if we have
the right compilers.
================================================================== -->
<available file="${compiler.x86}" property="compilerAvailable.x86"/>
<echo message="compilerAvailable.x86=${compilerAvailable.x86}" />
<available file="${compiler.x64}" property="compilerAvailable.x64"/>
<echo message="compilerAvailable.x64=${compilerAvailable.x64}" />
<!-- ======================================================================
Compare the date/time of the DLL against that of the cpp source.
Up to date is only true if dll exists and is later than source
We should build if we can build and the dll is not up to date
================================================================== -->
<condition property="shouldBuild.x86">
<and>
<istrue value="${compilerAvailable.x86}"/>
<not>
<uptodate targetfile="${release.file.x86.dll}">
<srcfiles dir="${src.cpp}" includes="*.cpp" />
<srcfiles dir="${src.cpp}" includes="*.h" />
<!-- Check the build file itself as well -->
<srcfiles dir="${basedir}" includes="build.xml" />
</uptodate>
</not>
</and>
</condition>
<echo message="shouldBuild.x86= ${shouldBuild.x86}" />
<condition property="shouldBuild.x64">
<and>
<istrue value="${compilerAvailable.x64}"/>
<not>
<uptodate targetfile="${release.file.x64.dll}">
<srcfiles dir="${src.cpp}" includes="*.cpp" />
<srcfiles dir="${src.cpp}" includes="*.h" />
<!-- Check the build file itself as well -->
<srcfiles dir="${basedir}" includes="build.xml" />
</uptodate>
</not>
</and>
</condition>
<echo message="shouldBuild.x64= ${shouldBuild.x64}" />
<condition property="compile.flags" value="/Zi /D DEBUG">
<or><isset property="debug"/><isset property="DEBUG"/></or>
</condition>
<condition property="compile.flags" value="/D NDEBUG">
<not><or><isset property="debug"/><isset property="DEBUG"/></or></not>
</condition>
<echo message="compile.flags= ${compile.flags}"/>
<condition property="link.flags" value="/DLL /DEBUG /DEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcmt.lib">
<or><isset property="debug"/><isset property="DEBUG"/></or>
</condition>
<condition property="link.flags" value="/DLL">
<not><or><isset property="debug"/><isset property="DEBUG"/></or></not>
</condition>
<echo message="link.flags= ${link.flags}"/>
<!--=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v=v
START of TASKS
=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^ -->
<target name="default" depends="javaJarBin,makeDll.x86,makeDll.x64">
<echo message="${application.title} ${version} build ${build.iteration} : finished on ${build.date}" />
</target>
<target name="clean">
<delete dir="release" verbose="true"/>
</target>
<!-- ======================================================================
Compare the date/time of the JAR against that
of the java source
================================================================== -->
<target name="javaJarCheck">
<uptodate property="jarUpToDate" targetfile="${release.file.jar}">
<srcfiles dir="${src.java.mainroot}" includes="org/**/*.java" />
<!-- Check the build file itself as well -->
<srcfiles dir="${basedir}" includes="build.xml" />
</uptodate>
<echo message="javaJarCheck says jarUpToDate= ${jarUpToDate}" />
</target>
<!-- ======================================================================
Compile the java files and copy version.properties to be jar'd up
Relies on ant recognizing when a file needs to be compiled
Unit tests compiled seperately because of junit dependency
================================================================== -->
<target name="javaCompile" >
<echo>Building Racob classes in ${release.dir.java}</echo>
<javac srcdir="${src.java.mainroot}"
destdir="${release.dir.java}"
listfiles="true" debug="on" source="1.5" />
<echo>Building Racob test classes in ${release.dir.java} using junit jar ${junit.jar}</echo>
<javac srcdir="${src.java.unittest}"
destdir="${release.dir.java}"
classpath="${release.dir.java}:${junit.jar}"
listfiles="true" debug="on" source="1.5" />
<copy file="${generated.filename.version}" todir="${release.dir.java.meta.inf}"/>
</target>
<!-- ======================================================================
Package the classes into a JAR.
Put version.properties into the jar file so version retrieval method can find it
================================================================== -->
<target name="javaJarBin"
depends="javaCompile,javaJarCheck"
unless="jarUpToDate">
<echo>Removing old jars</echo>
<delete file="${release.file.jar}" />
<echo>Packaging java classes...</echo>
<echo>Version File is ${release.dir.java.meta.inf}/${generated.filename.version}</echo>
<jar destfile="${release.file.jar}" basedir="${release.dir.java}" update="false">
<exclude name="**/CVS" />
<!-- exclude all unit tests (ending in Test)
and everything in the test packages -->
<exclude name="org/**/*Test*.class"/>
<exclude name="org/racob/test/**"/>
<include name="org/**/*.class" />
<include name="META-INF/${generated.filename.version}" />
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${java.class.main}"/>
<section name="${src.java.mainpackage}">
<attribute name="Specification-Title" value="${application.title}" />
<attribute name="Specification-Vendor" value="${application.vendor}" />
<attribute name="Implementation-Title" value="${application.title} Java libraries" />
<attribute name="Implementation-Version" value="${version} build ${build.iteration} on ${build.date}" />
</section>
</manifest>
</jar>
</target>
<!-- ======================================================================
Compile the c source files.
================================================================== -->
<target name="compile.x86" if="shouldBuild.x86">
<echo>Clean up the (X86) target folders and file, for safety</echo>
<delete file="${release.dir.x86.cpp}/**/*.*" />
<echo>Compiling (X86) C++ classes with JDK JNI library ${JDK} ${compiler.x86}</echo>
<exec executable="${compiler.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<env key="include" value="${JDK}\include;${JDK}\include\win32;${include.x86.platformSDK};${include.x86};${include.x86.atl}"/>
<arg value="/nologo"/>
<arg value="/c"/>
<arg value="/D WIN32"/>
<arg line="${compile.flags}"/>
<arg value="/D _WINDOWS"/>
<arg value="/D _USRDLL"/>
<arg value="/D _WINDLL" />
<!-- create a multi threaded dll -->
<arg value="/MT"/>
<!-- raise the warning level from the default -->
<!-- <arg value="/Wp64"/> -->
<arg value="/W3" />
<!-- sets the exception model -->
<arg value="/EHsc" />
<!-- /O2 and /RCT1 are incompatible -->
<!-- optimize build for speed. (is this VC specific? -->
<arg value="/O2" />
<!-- next two wipe out a lot of deprecated warnings about strings when using VC++ 8.0 and SDK-->
<arg value="/D _CRT_SECURE_NO_DEPRECATE" />
<arg value="/D _CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D _STATIC_CPPLIB" />
<arg value="${src.cpp}/*.cpp"/>
</exec>
</target>
<target name="compile.x64" if="shouldBuild.x64">
<echo>Clean up the (x64) target folders and file, for safety</echo>
<delete file="${release.dir.x64.cpp}/**/*.*" />
<echo>Compiling C++ (x64) classes with JDK JNI library ${JDK}</echo>
<exec executable="${compiler.x64}" dir="${release.dir.x64.cpp}" failonerror="true">
<env key="include" value="${JDK}\include;${JDK}\include\win32;${include.x86.platformSDK};${include.x86};${include.x86.atl}"/>
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo"/>
<arg value="/c"/>
<arg value="/D WIN64"/>
<arg line="${compile.flags}"/>
<arg value="/D _WINDOWS"/>
<arg value="/D _USRDLL"/>
<arg value="/D _WINDLL" />
<!-- create a multi threaded dll -->
<arg value="/MT"/>
<!-- raise the warning level from the default -->
<!-- <arg value="/Wp64"/> -->
<arg value="/W3" />
<!-- sets the exception model -->
<arg value="/EHsc" />
<!-- /O2 and /RCT1 are incompatible -->
<!-- optimize build for speed. (is this VC specific? -->
<arg value="/O2" />
<!-- next two wipe out a lot of deprecated warnings about strings when using VC++ 8.0 and SDK-->
<arg value="/D _CRT_SECURE_NO_DEPRECATE" />
<arg value="/D _CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D _STATIC_CPPLIB" />
<arg value="${src.cpp}/*.cpp"/>
</exec>
</target>
<!-- ======================================================================
Link the obj files into a DLL.
DLL construction matrix (Yes=DLL can be built, No=DLL cannot)
_________________________________________________
Type of machine ANT is running on
32 bit 64 bit
32 bit target Yes No
64 bit target Yes Yes
================================================================== -->
<target name="makeDll.x86" depends="compile.x86" if="shouldBuild.x86">
<echo>Clean up the target folders and file, for safety</echo>
<echo>Using ${library.x86}</echo>
<delete file="${release.file.x86.dll}" />
<echo>Creating ${release.file.x86.dll}</echo>
<exec executable="${linker.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo" />
<arg value="/MANIFEST" />
<arg line="${link.flags}"/>
<arg value="/MANIFESTFILE:${release.dir.x86.cpp}/racob.dll.manifest" />
<arg value="/version:${version}" />
<arg value="/out:${release.file.x86.dll}" />
<arg value="/libpath:${library.x86}" />
<arg value="/libpath:${library.x86.platformSDK}" />
<arg value="/libpath:${library.x86.atl}" />
<arg value="${JDK}\lib\jvm.lib" />
<arg value="${release.dir.x86.cpp}/*obj"/>
</exec>
<exec executable="${manifestool.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="-outputresource:${release.file.x86.dll};2"/>
<arg value="-manifest"/>
<arg value="${release.dir.x86.cpp}\racob.dll.manifest" />
</exec>
</target>
<target name="makeDll.x64" depends="compile.x64" if="shouldBuild.x64">
<echo>Clean up the target folders and file, for safety</echo>
<delete file="${release.file.x64.dll}" />
<echo>Creating {$release.file.x64.dll}</echo>
<exec executable="${linker.x64}" dir="${release.dir.x64.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo" />
<arg value="/MANIFEST" />
<arg line="${link.flags}"/>
<arg value="/MANIFESTFILE:${release.dir.x64.cpp}/racob.dll.manifest" />
<arg value="/version:${version}" />
<arg value="/out:${release.file.x64.dll}" />
<arg value="/libpath:${library.x64}" />
<arg value="/libpath:${library.x64.platformSDK}" />
<arg value="/libpath:${library.x64.atl}" />
<arg value="${JDK}\lib\jvm.lib" />
<arg value="${release.dir.x64.cpp}/*.obj" />
</exec>
<exec executable="${manifestool.x86}" dir="${release.dir.x64.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="-outputresource:${release.file.x64.dll};2"/>
<arg value="-manifest"/>
<arg value="${release.dir.x64.cpp}\racob.dll.manifest" />
</exec>
</target>
<!-- ======================================================================
Use this target to create javadoc from ${src.java.mainpackage}/*
================================================================== -->
<target name="generateJavaDoc">
<defaultexcludes add="**/*Test*"/>
<javadoc
packagenames="${src.java.mainpackage}/**"
sourcepath="${src.java.mainroot}"
destdir="${release.dir.java}/docs/api"
author="true"
version="true"
use="true"
windowtitle="${application.title} API Docs">
<doctitle><![CDATA[<h1>${application.title}</h1>]]></doctitle>
<bottom><![CDATA[<i>${application.vendor}</i>]]></bottom>
<group title="Core COM Communication" packages="${src.java.mainpackage}.org/**"/>
<group title="Higher Level Active X" packages="${src.java.mainpackage}.activeX/**"/>
<group title="API Stub Generator" packages="${src.java.mainpackage}.jacobgen/**"/>
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="C:\tmp"/>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
<defaultexcludes default="true"/>
</target>
<!-- ======================================================================
Use this target to package all the files for a release
================================================================== -->
<target name="PackageRelease"
depends="makeDll.x86,makeDll.x64,javaJarBin,generateJavaDoc">
<echo>Packaging release... ${release.file.jar}</echo>
<zip
destfile="${release.dir}/${generated.filename.zip}.zip">
<exclude name="**/CVS" />
<exclude name="**/*.obj" />
<exclude name="**/*.class" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="LICENSE.* ${generated.filename.version} README.txt" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="docs/**" />
<zipfileset dir="${release.dir.x86}" prefix="${generated.filename.zip}" includes="${generated.filename.dll.x86}" />
<zipfileset dir="${release.dir.x64}" prefix="${generated.filename.zip}" includes="${generated.filename.dll.x64}" />
<zipfileset dir="${release.dir.java}" prefix="${generated.filename.zip}" includes="${generated.filename.jar}" />
<zipfileset dir="${release.dir.java}" prefix="${generated.filename.zip}" includes="docs/**"/>
</zip>
<zip
destfile="${release.dir}/${generated.filename.zip}_src.zip">
<exclude name="**/CVS" />
<exclude name="**/*.obj" />
<exclude name="**/*.class" />
<exclude name="**/*.dll" />
<exclude name="**/*.exp" />
<exclude name="**/*.jar" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="src/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="docs/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="jni/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="unittest/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="vstudio/jacob.vcproj" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="lib/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="build.xml, README.txt" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="LICENSE.* ${generated.filename.version}" />
</zip>
</target>
<!-- ======================================================================
JUnit testing
This should probably be dependent on dll also
This assumes we are always testing on X86
This assumes that ant-junit is available
================================================================== -->
<target name='test' depends='javaCompile' >
<junit printsummary="yes"
haltonfailure="yes"
fork="true"
dir="${release.dir.java}"
>
<sysproperty key="java.library.path" value="${release.dir.x86}" />
<classpath>
<pathelement location="${junit.jar}"/>
<pathelement location="${release.dir.java}"/>
<pathelement path="${src.java.unittest}"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<!-- use the source directory because it tries to run inner classes
if we use the release directory -->
<fileset dir="${src.java.unittest}">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.