2004-06-22 06:37:04 +08:00
|
|
|
<!DOCTYPE project [
|
|
|
|
<!ENTITY jni-build SYSTEM "hyperic_jni/jni-build.xml">
|
|
|
|
]>
|
|
|
|
|
|
|
|
<project name="Sigar" default="build" basedir=".">
|
|
|
|
|
2004-11-15 09:14:16 +08:00
|
|
|
<property name="sigar.version" value="1.1.10"/>
|
2004-07-24 01:36:17 +08:00
|
|
|
|
2004-06-22 06:37:04 +08:00
|
|
|
<property file="${user.home}/.sigar-build.properties"/>
|
|
|
|
<property name="project.name" value="sigar"/>
|
|
|
|
<property name="jni.define.name" value="SIGAR"/>
|
|
|
|
<property name="sigar-bin" location="sigar-bin"/>
|
2004-09-19 01:46:28 +08:00
|
|
|
<property name="sigar-bin-dir" location="${sigar-bin}"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
<property name="jni.bin" location="${sigar-bin}"/>
|
|
|
|
<property name="jni.source.dir" location="../.."/>
|
|
|
|
<property name="jni.src.java" value="hyperic_jni/src"/>
|
|
|
|
<property name="jni.libprefix" value=""/> <!-- drop "java" prefix -->
|
|
|
|
<property name="jni.werror" value="true"/>
|
|
|
|
<property name="cpptasks.jar"
|
|
|
|
location="hyperic_jni/lib/cpptasks.jar"/>
|
|
|
|
|
|
|
|
&jni-build;
|
|
|
|
|
|
|
|
<property name="src" location="src"/>
|
|
|
|
<property name="build" location="build"/>
|
2004-07-15 08:06:31 +08:00
|
|
|
<property name="build.javadoc" value="${build}/javadoc"/>
|
2004-07-24 01:36:17 +08:00
|
|
|
<property name="dist.name" value="hyperic-sigar-${sigar.version}"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
<property name="dist" location="${build}/${dist.name}"/>
|
|
|
|
<property name="perl" value="perl"/>
|
|
|
|
<!-- trick TestFQDN into passing with: ant test -Dsigar.fdqn=foo.bar -->
|
|
|
|
<property name="sigar.fqdn" value=""/>
|
|
|
|
|
|
|
|
<path id="libjars">
|
|
|
|
<fileset dir="lib" includes="*.jar"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<path id="alljars">
|
|
|
|
<path refid="libjars"/>
|
|
|
|
<fileset dir="${sigar-bin}/lib" includes="sigar.jar"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<target name="javadoc_check">
|
|
|
|
<uptodate property="javadoc.notrequired"
|
2004-07-15 08:06:31 +08:00
|
|
|
targetfile="${build.javadoc}/packages.html" >
|
2004-06-22 06:37:04 +08:00
|
|
|
<srcfiles dir="src" includes="**/*.java"/>
|
|
|
|
</uptodate>
|
|
|
|
</target>
|
|
|
|
|
2004-07-15 08:06:31 +08:00
|
|
|
<path id="javadoc.path">
|
2004-06-22 06:37:04 +08:00
|
|
|
<pathelement path="src"/>
|
|
|
|
<pathelement path="${build}/src"/>
|
2004-07-15 08:08:06 +08:00
|
|
|
<pathelement path="${jni.src.java}"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
</path>
|
|
|
|
|
2004-07-15 08:06:31 +08:00
|
|
|
<target name="javadoc" depends="javadoc_check">
|
|
|
|
<mkdir dir="${build.javadoc}"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
<javadoc packagenames="net.hyperic.sigar.*"
|
2004-07-22 07:15:12 +08:00
|
|
|
excludepackagenames="net.hyperic.sigar.test.*,net.hyperic.jni.*,net.hyperic.sigar.pager.*,net.hyperic.sigar.jmx.*"
|
2004-06-22 06:37:04 +08:00
|
|
|
useexternalfile="yes"
|
2004-07-15 08:06:31 +08:00
|
|
|
sourcepathref="javadoc.path"
|
|
|
|
destdir="${build.javadoc}"
|
2004-06-22 06:37:04 +08:00
|
|
|
author="false"
|
|
|
|
version="false"
|
|
|
|
windowtitle="Sigar API"
|
|
|
|
doctitle="Sigar">
|
|
|
|
<group title="Sigar" packages="net.hyperic.sigar" />
|
|
|
|
<classpath refid="libjars"/>
|
|
|
|
<classpath><path path="${env.ANT_HOME}/lib/ant.jar"/></classpath>
|
2004-10-04 23:52:01 +08:00
|
|
|
<bottom>Copyright © 2004 <![CDATA[<a target="_top" href="http://www.hyperic.net/">Hyperic, LLC</a>]]>. All Rights Reserved.</bottom>
|
2004-06-22 06:37:04 +08:00
|
|
|
</javadoc>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="compile">
|
|
|
|
<mkdir dir="${build}/classes"/>
|
|
|
|
<javac destdir="${build}/classes"
|
|
|
|
debug="true"
|
|
|
|
classpathref="libjars">
|
|
|
|
<src path="${src}"/>
|
|
|
|
<src path="${build}/src"/>
|
|
|
|
<src path="${jni.src.java}"/>
|
|
|
|
<include name="**/*.java"/>
|
|
|
|
</javac>
|
|
|
|
</target>
|
|
|
|
|
2004-07-24 01:36:17 +08:00
|
|
|
<target name="sigar-version">
|
|
|
|
<tstamp>
|
|
|
|
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
|
|
|
|
</tstamp>
|
|
|
|
|
|
|
|
<property name="version.file"
|
|
|
|
value="src/net/hyperic/sigar/SigarVersion.java"/>
|
|
|
|
|
|
|
|
<copy file="${version.file}.in"
|
|
|
|
tofile="${build}/${version.file}"/>
|
|
|
|
|
|
|
|
<replace file="${build}/${version.file}">
|
|
|
|
<replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/>
|
|
|
|
<replacefilter token="@@VERSION_STRING@@" value="${sigar.version}"/>
|
|
|
|
</replace>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="prepare-src" depends="sigar-version">
|
2004-06-22 06:37:04 +08:00
|
|
|
<mkdir dir="${build}/src"/>
|
|
|
|
|
|
|
|
<exec executable="${perl}" dir=".">
|
|
|
|
<arg value="src/jni/generate.pl"/>
|
|
|
|
<arg value="${build}/src"/>
|
|
|
|
</exec>
|
|
|
|
|
|
|
|
<!-- include sigar *.c files rather than link against libsigar -->
|
|
|
|
<patternset id="jni.source.files">
|
|
|
|
<include name="src/*.c"/>
|
|
|
|
<include name="src/os/${jni.src}/*.c"/>
|
|
|
|
<include name="bindings/java/src/jni/javasigar.c"/>
|
|
|
|
</patternset>
|
|
|
|
|
|
|
|
<path id="jni.include.dirs">
|
|
|
|
<path location="../../include"/>
|
|
|
|
<path location="../../src/os/${jni.src}"/>
|
|
|
|
<path location="${build}/src"/>
|
|
|
|
</path>
|
|
|
|
|
2004-07-03 06:56:33 +08:00
|
|
|
<!-- extra solaris libs -->
|
2004-06-22 06:37:04 +08:00
|
|
|
<condition property="jni.libset.dir" value="/usr/lib">
|
|
|
|
<isset property="solaris"/>
|
|
|
|
</condition>
|
|
|
|
|
|
|
|
<condition property="jni.libset.libs" value="kstat">
|
|
|
|
<isset property="solaris"/>
|
|
|
|
</condition>
|
2004-07-03 06:56:33 +08:00
|
|
|
|
|
|
|
<!-- extra aix libs -->
|
|
|
|
<condition property="jni.libset.dir" value="/usr/lib">
|
|
|
|
<isset property="aix"/>
|
|
|
|
</condition>
|
|
|
|
|
|
|
|
<condition property="jni.libset.libs" value="odm,cfg">
|
|
|
|
<isset property="aix"/>
|
|
|
|
</condition>
|
2004-06-22 06:37:04 +08:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="copy-includes">
|
|
|
|
<mkdir dir="${sigar-bin}/include"/>
|
|
|
|
<copy toDir="${sigar-bin}/include" overwrite="true">
|
|
|
|
<fileset dir="../../include">
|
|
|
|
<include name="sigar.h"/>
|
|
|
|
<include name="sigar_fileinfo.h"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="build-jni"
|
|
|
|
depends="jni-init,prepare-src,jni-compile,jni-lib-copy,copy-includes"
|
|
|
|
if="jni.libarch"/>
|
|
|
|
|
2004-07-09 08:52:14 +08:00
|
|
|
<target name="build-perfstat" depends="jni-init" if="aix">
|
|
|
|
<ant dir="../../src/os/aix/perfstat"/>
|
|
|
|
<copy toDir="${sigar-bin}/lib" overwrite="true">
|
|
|
|
<fileset dir="${build}">
|
|
|
|
<include name="libsigar_aixperfstat.so"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
|
2004-06-22 06:37:04 +08:00
|
|
|
<target name="pack-jar">
|
|
|
|
<jar jarfile="${sigar-bin}/lib/sigar.jar"
|
|
|
|
basedir="${build}/classes">
|
|
|
|
|
|
|
|
<manifest>
|
|
|
|
<attribute name="Main-Class"
|
|
|
|
value="net.hyperic.sigar.cmd.Runner"/>
|
|
|
|
</manifest>
|
|
|
|
</jar>
|
|
|
|
</target>
|
|
|
|
|
2004-07-09 08:52:14 +08:00
|
|
|
<target name="build" depends="build-jni,build-perfstat,compile,pack-jar"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
|
|
|
|
<target name="clean">
|
|
|
|
<delete dir="${build}"/>
|
|
|
|
<delete dir="${sigar-bin}"/>
|
|
|
|
<delete dir="testresults"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="xtest">
|
|
|
|
<mkdir dir="testresults"/>
|
|
|
|
|
|
|
|
<junit printsummary="yes" fork="yes"
|
|
|
|
haltonfailure="yes" showoutput="true">
|
|
|
|
<jvmarg value="-Dsigar.fqdn=${sigar.fqdn}"/>
|
|
|
|
|
|
|
|
<classpath refid="alljars"/>
|
|
|
|
<formatter type="plain"/>
|
|
|
|
|
|
|
|
<batchtest fork="yes" todir="testresults">
|
|
|
|
<fileset dir="${src}">
|
|
|
|
<include name="**/Test*.java"/>
|
|
|
|
<!-- slow; run by hand with bin/run_tests.sh Threads -->
|
|
|
|
<exclude name="**/TestThreads*.java"/>
|
|
|
|
</fileset>
|
|
|
|
</batchtest>
|
|
|
|
</junit>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="test" depends="build,xtest"/>
|
|
|
|
|
2004-07-22 01:12:16 +08:00
|
|
|
<target name="dist-pack">
|
|
|
|
<zip destfile="${dist}.zip"
|
|
|
|
basedir="${build}"
|
|
|
|
includes="${dist.name}/**/*"/>
|
|
|
|
|
|
|
|
<!-- Stupid ant tar task, doesn't preserve file permissions
|
|
|
|
without making you jump through some hoops -->
|
|
|
|
<tar tarfile="${dist}.tar.gz"
|
|
|
|
longfile="gnu"
|
|
|
|
compression="gzip">
|
|
|
|
<tarfileset dir="${dist}/.." mode="755">
|
|
|
|
<include name="${dist.name}/**/bin/*"/>
|
|
|
|
<include name="${dist.name}/**/*.sh"/>
|
|
|
|
<include name="${dist.name}/**/*.bat"/>
|
|
|
|
<include name="${dist.name}/**/*.cmd"/>
|
|
|
|
<include name="${dist.name}/**/*.sl"/>
|
|
|
|
</tarfileset>
|
|
|
|
<tarfileset dir="${dist}/..">
|
|
|
|
<exclude name="${dist.name}/**/bin/*"/>
|
|
|
|
<exclude name="${dist.name}/**/*.sh"/>
|
|
|
|
<exclude name="${dist.name}/**/*.bat"/>
|
|
|
|
<exclude name="${dist.name}/**/*.cmd"/>
|
|
|
|
<exclude name="${dist.name}/**/*.sl"/>
|
|
|
|
<include name="${dist.name}/**"/>
|
|
|
|
</tarfileset>
|
|
|
|
</tar>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="dist-bin">
|
|
|
|
<!-- binaries -->
|
|
|
|
<mkdir dir="${dist}/sigar-bin"/>
|
|
|
|
<copy toDir="${dist}/sigar-bin" overwrite="true">
|
2004-09-19 01:46:28 +08:00
|
|
|
<fileset dir="${sigar-bin-dir}">
|
2004-07-22 01:12:16 +08:00
|
|
|
<include name="lib/*.jar"/>
|
|
|
|
<include name="lib/*.dll"/>
|
|
|
|
<include name="lib/*.sl"/>
|
|
|
|
<include name="lib/*.so"/>
|
|
|
|
<include name="lib/*.dylib"/>
|
|
|
|
</fileset>
|
|
|
|
<fileset dir=".">
|
|
|
|
<include name="lib/*.jar"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="dist-support" depends="javadoc">
|
2004-07-22 02:39:58 +08:00
|
|
|
<copy toDir="${dist}" overwrite="true">
|
|
|
|
<fileset dir="../..">
|
|
|
|
<include name="README"/>
|
2004-09-22 00:44:53 +08:00
|
|
|
<include name="LICENSE"/>
|
2004-07-22 02:39:58 +08:00
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
2004-07-22 04:06:18 +08:00
|
|
|
<!-- bindings -->
|
|
|
|
<mkdir dir="${dist}/bindings/perl"/>
|
|
|
|
<copy toDir="${dist}/bindings/perl" overwrite="true">
|
|
|
|
<fileset dir="../perl">
|
|
|
|
<include name="Makefile.PL"/>
|
|
|
|
<include name="typemap"/>
|
|
|
|
<include name="*.xs"/>
|
|
|
|
<include name="*.pm"/>
|
|
|
|
<include name="lib/*.pm"/>
|
|
|
|
<include name="lib/Sigar/*.pm"/>
|
|
|
|
</fileset>
|
|
|
|
<fileset dir="${build}/src">
|
|
|
|
<include name="Sigar_generated.xs"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
2004-07-22 04:14:21 +08:00
|
|
|
<mkdir dir="${dist}/bindings/csharp"/>
|
|
|
|
<copy toDir="${dist}/bindings/csharp" overwrite="true">
|
|
|
|
<fileset dir="../dotnet">
|
|
|
|
<include name="default.build"/>
|
|
|
|
<include name="src/Sigar.cs"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
2004-07-15 08:23:34 +08:00
|
|
|
<!-- docs -->
|
2004-07-15 08:15:46 +08:00
|
|
|
<mkdir dir="${dist}/docs"/>
|
|
|
|
<copy toDir="${dist}/docs" overwrite="true">
|
|
|
|
<fileset dir="${build}">
|
|
|
|
<include name="javadoc/**"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
2004-07-15 08:23:34 +08:00
|
|
|
<!-- examples -->
|
|
|
|
<mkdir dir="${dist}/examples/java"/>
|
|
|
|
<mkdir dir="${dist}/examples/perl"/>
|
|
|
|
<mkdir dir="${dist}/examples/csharp"/>
|
|
|
|
|
|
|
|
<copy toDir="${dist}/examples/java" overwrite="true">
|
|
|
|
<fileset dir="src/net/hyperic/sigar/cmd">
|
|
|
|
<include name="*.java"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
|
|
|
<copy toDir="${dist}/examples/perl" overwrite="true">
|
|
|
|
<fileset dir="../perl/examples">
|
|
|
|
<include name="*.pl"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
|
|
|
<copy toDir="${dist}/examples/csharp" overwrite="true">
|
|
|
|
<fileset dir="../dotnet/examples">
|
|
|
|
<include name="*.cs"/>
|
2004-07-22 05:17:14 +08:00
|
|
|
<include name="default.build"/>
|
2004-07-15 08:23:34 +08:00
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
2004-07-22 01:12:16 +08:00
|
|
|
<!-- header files -->
|
2004-06-22 06:37:04 +08:00
|
|
|
<copy toDir="${dist}/sigar-bin" overwrite="true">
|
|
|
|
<fileset dir="${sigar-bin}">
|
2004-07-15 08:15:46 +08:00
|
|
|
<include name="include/*.h"/>
|
2004-06-22 06:37:04 +08:00
|
|
|
</fileset>
|
|
|
|
</copy>
|
2004-07-23 09:05:50 +08:00
|
|
|
|
|
|
|
<copy toDir="${dist}/sigar-bin/lib" overwrite="true">
|
|
|
|
<fileset dir=".">
|
|
|
|
<include name=".sigar_shellrc"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
2004-06-22 06:37:04 +08:00
|
|
|
</target>
|
|
|
|
|
2004-07-22 01:12:16 +08:00
|
|
|
<target name="dist" depends="dist-bin,dist-support,dist-pack"/>
|
|
|
|
|
2004-06-22 06:37:04 +08:00
|
|
|
</project>
|