309 lines
14 KiB
XML
309 lines
14 KiB
XML
<?xml version="1.0"?>
|
|
<!-- ======================================================================
|
|
Ant build file for JACOB.
|
|
|
|
Created Feb 4, 2005 1:23:05 PM as part of migration from ANT
|
|
Last Modified October 13, 2005
|
|
|
|
Tested on Eclipse 3.1.0 with the CDT plugin, Ant 1.6.1 and MS Visual C++ 6.0
|
|
Eclipse users are pretty lucky because the whole project
|
|
can be built inside eclipse due to their built in ANT support.
|
|
|
|
Developers will need to find a copy of MS Visual C++ 6.0.
|
|
The build proces defined in this build.xml file does support
|
|
MS Visual C++ 8.0 (Visual C++ 2005 Express) when combined with the M SDK.
|
|
The problem is that SafeArray.cpp will not compile
|
|
with that 64 bit aware environment.
|
|
|
|
====================================================================== -->
|
|
<project name="jacob" default="default" basedir=".">
|
|
<property file="compilation_tools.properties" />
|
|
<!-- sets a default for properties that were not in the file -->
|
|
<!-- relies on the fact that properties cannot be reset once set -->
|
|
<property name="JDK" value="JDK not set in compilation_tools properties file"/>
|
|
<property name="MSDEVDIR" value="MSDEVDIR not set in compilation_tools properties file"/>
|
|
<property name="MSSDKDIR" value="${MSDEVDIR}"/>
|
|
<echo message="MSDEVDIR=${MSDEVDIR} MSSDKDIR=${MSSDKDIR}"/>
|
|
<!-- =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=
|
|
YOU MUST define a file named compilation_tools.properties!
|
|
The file for MS Visual C++ 6.0 looks something like
|
|
|
|
JDK=d:/j2sdk1.4.2_09
|
|
MSDEVDIR=d:\\apps\\Microsoft Visual Studio\\VC98
|
|
version=1.11-pre1
|
|
|
|
The file for MS Visual Studio 8 Express with SDK looks something like:
|
|
|
|
JDK=d:/j2sdk1.4.2_09
|
|
MSDEVDIR=D:\\Apps\\Microsoft Visual Studio 8\\VC
|
|
MSSDKDIR=D:\\Apps\\Microsoft Platform SDK for Windows Server 2003 R2
|
|
version=1.11-pre1
|
|
|
|
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
|
|
|
|
=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^ -->
|
|
|
|
<property name="application.title" value="JACOB : Java COM Bridge" />
|
|
<property name="application.vendor" value="http://jacob-project.sourceforge.net" />
|
|
<property name="java.src.mainpackage" value="com.jacob" />
|
|
<property name="java.class.main" value="com.jacob.com.Jacob" />
|
|
<property name="generated_jar" value="jacob.jar" />
|
|
<property name="generated_dll" value="jacob.dll" />
|
|
<property name="generated_zip" value="jacob_${version}" />
|
|
|
|
<property name="install.dir" value="${basedir}\release" />
|
|
<property name="java.src" value="${basedir}/src" />
|
|
<property name="java.samples" value="${basedir}/samples" />
|
|
<property name="java.unittest" value="${basedir}/unittest" />
|
|
<property name="java.bin" value="${install.dir}" />
|
|
<property name="cpp.src" value="${basedir}/jni" />
|
|
<property name="cpp.bin" value="${install.dir}/jni" />
|
|
|
|
<property name="jarfile_fullpath" value="${install.dir}\${generated_jar}" />
|
|
<property name="dll_fullpath" value="${install.dir}\${generated_dll}" />
|
|
|
|
<property name="compiler" value="${MSDEVDIR}\bin\cl.exe" />
|
|
<property name="linker" value="${MSDEVDIR}\bin\link.exe" />
|
|
|
|
<!-- =================================
|
|
target: default
|
|
================================= -->
|
|
<target name="default" depends="createDirectoryStructure,java_jar_bin,c_dll">
|
|
|
|
<echo message="${application.title} ${version} build ${build.iteration} : finished on ${build.date}" />
|
|
</target>
|
|
|
|
<!-- ======================================================================
|
|
Writes out a version file to be included in the jar
|
|
================================================================== -->
|
|
<target name="IncrementBuildNumber">
|
|
<!-- sets a default for properties that were not in the file -->
|
|
<!-- relies on the fact that properties cannot be reset once set -->
|
|
<property name="version" value="version not set in compilation_tools properties file"/>
|
|
<propertyfile file="version.properties">
|
|
<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="version.properties" />
|
|
</target>
|
|
|
|
<!-- ======================================================================
|
|
Create the necessary directory structure (does nothing if it
|
|
already there)
|
|
================================================================== -->
|
|
<target name="createDirectoryStructure">
|
|
<mkdir dir="${java.bin}"/>
|
|
<mkdir dir="${cpp.bin}"/>
|
|
<mkdir dir="${install.dir}"/>
|
|
</target>
|
|
|
|
<!-- ======================================================================
|
|
Compare the date/time of the JAR against that
|
|
of the java source
|
|
================================================================== -->
|
|
<target name="java_jar_check">
|
|
<uptodate property="jarUpToDate" targetfile="${jarfile_fullpath}">
|
|
<srcfiles dir="${java.src}">
|
|
<include name="com/**/*.java" />
|
|
</srcfiles>
|
|
<!-- Check the build file itself as well -->
|
|
<srcfiles file="${basedir}/build.xml" />
|
|
</uptodate>
|
|
<echo message="java_jar_check result: ${jarUpToDate}" />
|
|
</target>
|
|
<!-- ======================================================================
|
|
Compile the java files
|
|
Relies on ant recognizing when a file needs to be compiled
|
|
================================================================== -->
|
|
<target name="java_compile" depends="createDirectoryStructure,IncrementBuildNumber">
|
|
<echo>Building java classes in ${java.bin}...</echo>
|
|
<javac srcdir="${java.src}"
|
|
destdir="${java.bin}"
|
|
listfiles="true" debug="on" source="1.4" />
|
|
<echo>Building java sample classes ...</echo>
|
|
<javac srcdir="${java.samples}"
|
|
destdir="${java.bin}"
|
|
listfiles="true" debug="on" source="1.4" />
|
|
<echo>Building java test classes...</echo>
|
|
<javac srcdir="${java.unittest}"
|
|
destdir="${java.bin}"
|
|
listfiles="true" debug="on" source="1.4" />
|
|
</target>
|
|
<!-- ======================================================================
|
|
Package the classes into a JAR.
|
|
Put version.propertes into the jar file so version retrieval method can find it
|
|
================================================================== -->
|
|
<target name="java_jar_bin" depends="createDirectoryStructure,java_compile,java_jar_check,IncrementBuildNumber" unless="jarUpToDate">
|
|
<echo>Removing old jars</echo>
|
|
<delete file="${jarfile_fullpath}" />
|
|
<echo>Packaging java classes...</echo>
|
|
<jar destfile="${jarfile_fullpath}" basedir="${java.bin}" update="false">
|
|
<exclude name="**/CVS" />
|
|
<exclude name="com/**/*Test.class"/>
|
|
<exclude name="com/**/samples/**"/>
|
|
<include name="com/**/*.class" />
|
|
<include name="version.properties" />
|
|
<manifest>
|
|
<attribute name="Built-By" value="${user.name}" />
|
|
<attribute name="Main-Class" value="${java.class.main}"/>
|
|
<section name="${java.src.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>
|
|
<!-- ======================================================================
|
|
Compare the date/time of the DLL against that
|
|
of the cpp source
|
|
================================================================== -->
|
|
<target name="c_check">
|
|
<uptodate property="dllUpToDate" targetfile="${dll_fullpath}">
|
|
<srcfiles dir="${cpp.src}">
|
|
<include name="*.cpp" />
|
|
<include name="*.h" />
|
|
</srcfiles>
|
|
<!-- Check the build file itself as well -->
|
|
<srcfiles file="${basedir}/build.xml" />
|
|
</uptodate>
|
|
<echo message="c_check result: ${dllUpToDate}" />
|
|
</target>
|
|
<!-- ======================================================================
|
|
Compile the c source files.
|
|
================================================================== -->
|
|
<target name="c_compile" depends="createDirectoryStructure,c_check,IncrementBuildNumber" unless="dllUpToDate">
|
|
<echo>Clean up the target folders and file, for safety</echo>
|
|
<delete file="${cpp.bin}/**/*.*" />
|
|
<echo>Compiling C++ classes with JDK JNI library ${JDK}</echo>
|
|
<apply executable="${compiler}" dir="${cpp.bin}" parallel="false" verbose="true" failonerror="true">
|
|
<arg value="-c" />
|
|
<arg value="/nologo" />
|
|
<!-- create a multi threaded library -->
|
|
<!-- <arg value="/MT" /> -->
|
|
<!-- raise the warning level from the default -->
|
|
<arg value="/W2" />
|
|
<!-- sets the exception model -->
|
|
<arg value="/EHsc" />
|
|
<!-- 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" />
|
|
<arg value="_CRT_SECURE_NO_DEPRECATE" />
|
|
<arg value="/D" />
|
|
<arg value="_CRT_NONSTDC_NO_DEPRECATE" />
|
|
<arg value="/D" />
|
|
<arg value="_STATIC_CPPLIB" />
|
|
<arg value="-I" />
|
|
<arg value="${JDK}\include" />
|
|
<arg value="-I" />
|
|
<arg value="${JDK}\include\win32" />
|
|
<arg value="-I" /> <!-- hopefully 6.0 won't barf including same dir twice -->
|
|
<arg value="${MSDEVDIR}\Include" />
|
|
<arg value="-I" />
|
|
<arg value="${MSSDKDIR}\Include" />
|
|
<arg value="-I" />
|
|
<arg value="${MSSDKDIR}\\Include\\ATL" />
|
|
<fileset dir="${cpp.src}">
|
|
<include name="*.cpp" />
|
|
</fileset>
|
|
</apply>
|
|
</target>
|
|
<!-- ======================================================================
|
|
Link the obj files into a DLL.
|
|
================================================================== -->
|
|
<target name="c_dll" depends="createDirectoryStructure,c_check,c_compile" unless="dllUpToDate">
|
|
<echo>Clean up the target folders and file, for safety</echo>
|
|
<delete file="${dll_fullpath}" />
|
|
<echo>Creating dll_fullpath</echo>
|
|
<apply executable="${linker}" dir="${cpp.bin}" parallel="true" verbose="true" failonerror="true">
|
|
<arg value="/nologo" />
|
|
<arg value="/dll" />
|
|
<arg value="/version:${version}" />
|
|
<arg value="/out:${dll_fullpath}" />
|
|
<arg value="/libpath:${MSSDKDIR}/lib" />
|
|
<srcfile />
|
|
<arg value="${JDK}\lib\jvm.lib" />
|
|
<arg value="oleaut32.lib" />
|
|
<arg value="ole32.lib" />
|
|
<arg value="uuid.lib" />
|
|
<arg value="kernel32.lib" />
|
|
<arg value="shell32.lib" />
|
|
<arg value="user32.lib" />
|
|
<fileset dir="${cpp.bin}">
|
|
<include name="*.obj" />
|
|
</fileset>
|
|
</apply>
|
|
</target>
|
|
|
|
<!-- ======================================================================
|
|
Use this target to create javadoc from ${java.src.mainpackage}/*
|
|
================================================================== -->
|
|
<target name="javadoc">
|
|
<defaultexcludes add="**/*Test*"/>
|
|
<javadoc
|
|
packagenames="${java.src.mainpackage}/**"
|
|
sourcepath="${java.src}"
|
|
destdir="${java.bin}/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>
|
|
<tag name="todo" scope="all" description="To do:" />
|
|
<group title="Core COM Communication" packages="${java.src.mainpackage}.com/**"/>
|
|
<group title="Higher Level Active X" packages="${java.src.mainpackage}.activeX/**"/>
|
|
<group title="API Stub Generator" packages="${java.src.mainpackage}.jacobgen/**"/>
|
|
<link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api/" packagelistLoc="C:\tmp"/>
|
|
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
|
|
</javadoc>
|
|
<defaultexcludes default="true"/>
|
|
</target>
|
|
|
|
<!-- ======================================================================
|
|
Use this target to package all the files for a release
|
|
================================================================== -->
|
|
<target name="PackageRelease" depends="createDirectoryStructure,c_dll,java_jar_bin,javadoc">
|
|
|
|
<echo>Packaging release... ${jarfile_fullpath}</echo>
|
|
<zip
|
|
destfile="${install.dir}/${generated_zip}.zip">
|
|
<exclude name="**/CVS" />
|
|
<exclude name="**/*.obj" />
|
|
<exclude name="**/*.class" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="LICENSE.* version.properties" />
|
|
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="${generated_jar}" />
|
|
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="${generated_dll}" />
|
|
<zipfileset dir="${basedir}/lib" prefix="${generated_zip}" includes="*.jar" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="docs/**" />
|
|
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="docs/**"/>
|
|
</zip>
|
|
<zip
|
|
destfile="${install.dir}/${generated_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_zip}" includes="src/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="docs/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="jni/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="samples/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="unittest/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="vstudio/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="lib/**" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="build.xml, README.txt" />
|
|
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="LICENSE.* version.properties" />
|
|
</zip>
|
|
</target>
|
|
</project>
|
|
|