refactor version replacement stuff to a single target

This commit is contained in:
Doug MacEachern 2005-12-14 23:42:22 +00:00
parent 4f428bddaf
commit 56b9152e93
1 changed files with 41 additions and 17 deletions

View File

@ -87,26 +87,21 @@
</javac> </javac>
</target> </target>
<target name="sigar-version"> <target name="version-file">
<tstamp> <property name="version.file.srcdir"
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/> value="."/>
</tstamp> <property name="version.file.dstdir"
value="."/>
<property name="version.tofile"
value="${build}/${version.file.dstdir}/${version.file}"/>
<property name="version.file" <copy file="${version.file.srcdir}/${version.file}.in"
value="src/net/hyperic/sigar/SigarVersion.java"/> tofile="${version.tofile}"/>
<copy file="${version.file}.in" <replace file="${version.tofile}">
tofile="${build}/${version.file}"/>
<replace file="${build}/${version.file}">
<replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/> <replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/>
<replacefilter token="@@VERSION_STRING@@" value="${sigar.version}"/> <replacefilter token="@@VERSION_STRING@@" value="${sigar.version}"/>
</replace> <replacefilter token="@@ARCHNAME@@" value="${jni.project.archname}"/>
<copy file="../../src/os/netware/sigar.def.in"
tofile="${build}/sigar.def"/>
<replace file="${build}/sigar.def">
<replacefilter token="@@VERSION_MAJOR@@" value="${version.major}"/> <replacefilter token="@@VERSION_MAJOR@@" value="${version.major}"/>
<replacefilter token="@@VERSION_MINOR@@" value="${version.minor}"/> <replacefilter token="@@VERSION_MINOR@@" value="${version.minor}"/>
<replacefilter token="@@VERSION_MAINT@@" value="${version.maint}"/> <replacefilter token="@@VERSION_MAINT@@" value="${version.maint}"/>
@ -114,6 +109,35 @@
</replace> </replace>
</target> </target>
<target name="sigar-version">
<tstamp>
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<antcall target="version-file">
<param name="version.file"
value="src/net/hyperic/sigar/SigarVersion.java"/>
</antcall>
<antcall target="version-file">
<param name="version.file.srcdir"
value="../.."/>
<param name="version.file.dstdir"
value="${jni.libarch}"/>
<param name="version.file"
value="src/sigar_version.c"/>
</antcall>
<antcall target="version-file">
<param name="version.file.srcdir"
value="../.."/>
<param name="version.file"
value="src/os/netware/sigar.def"/>
<param name="version.tofile"
value="${build}/src/sigar.def"/>
</antcall>
</target>
<target name="prepare-src" depends="sigar-version"> <target name="prepare-src" depends="sigar-version">
<mkdir dir="${build}/src"/> <mkdir dir="${build}/src"/>
@ -131,9 +155,9 @@
<include name="src/*.c"/> <include name="src/*.c"/>
<include name="src/os/${jni.src}/*.c"/> <include name="src/os/${jni.src}/*.c"/>
<include name="bindings/java/src/jni/*.c"/> <include name="bindings/java/src/jni/*.c"/>
<exclude name="bindings/java/src/jni/javasigar_generated.c"/>
<include name="bindings/java/src/${win32.jni}/*.cpp"/> <include name="bindings/java/src/${win32.jni}/*.cpp"/>
<include name="bindings/java/src/${win32.jni}/*.c"/> <include name="bindings/java/src/${win32.jni}/*.c"/>
<include name="bindings/java/build/${jni.libarch}/src/*.c"/>
</patternset> </patternset>
<path id="jni.include.dirs"> <path id="jni.include.dirs">