diff --git a/bindings/java/build.xml b/bindings/java/build.xml index 58dda0b6..addedf88 100644 --- a/bindings/java/build.xml +++ b/bindings/java/build.xml @@ -111,11 +111,12 @@ cp ${version.file.srcdir}/${version.file}.in -> ${version.tofile} + tofile="${version.tofile}" overwrite="true"/> + @@ -127,11 +128,36 @@ - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bindings/java/src/jni/javasigar.c b/bindings/java/src/jni/javasigar.c index ce754745..ed0633dd 100644 --- a/bindings/java/src/jni/javasigar.c +++ b/bindings/java/src/jni/javasigar.c @@ -276,6 +276,13 @@ JNIEXPORT jstring SIGAR_JNIx(getNativeBuildDate) return JENV->NewStringUTF(env, version->build_date); } +JNIEXPORT jstring SIGAR_JNIx(getNativeScmRevision) +(JNIEnv *env, jclass cls) +{ + sigar_version_t *version = sigar_version_get(); + return JENV->NewStringUTF(env, version->scm_revision); +} + JNIEXPORT void SIGAR_JNIx(open) (JNIEnv *env, jobject obj) { diff --git a/bindings/java/src/org/hyperic/sigar/Sigar.java b/bindings/java/src/org/hyperic/sigar/Sigar.java index 17884cec..0a43bd54 100644 --- a/bindings/java/src/org/hyperic/sigar/Sigar.java +++ b/bindings/java/src/org/hyperic/sigar/Sigar.java @@ -55,6 +55,17 @@ public class Sigar implements SigarProxy { */ public static final String NATIVE_VERSION_STRING; + /** + * The scm (svn) revision from which sigar.jar was built. + */ + public static final String SCM_REVISION = + SigarVersion.SCM_REVISION; + + /** + * The scm (svn) revision from which the sigar native binary was built. + */ + public static final String NATIVE_SCM_REVISION; + /** * The date on which sigar.jar was built. */ @@ -85,11 +96,13 @@ public class Sigar implements SigarProxy { static { String nativeVersion = "unknown"; String nativeBuildDate = "unknown"; + String nativeScmRevision = "unknown"; try { loadLibrary(); nativeVersion = getNativeVersion(); nativeBuildDate = getNativeBuildDate(); + nativeScmRevision = getNativeScmRevision(); checkVersion(nativeVersion); } catch (SigarException e) { loadError = e.getMessage(); @@ -104,6 +117,7 @@ public class Sigar implements SigarProxy { NATIVE_VERSION_STRING = nativeVersion; NATIVE_BUILD_DATE = nativeBuildDate; + NATIVE_SCM_REVISION = nativeScmRevision; } private static void checkVersion(String nativeVersionString) @@ -175,6 +189,7 @@ public class Sigar implements SigarProxy { private static native String getNativeVersion(); private static native String getNativeBuildDate(); + private static native String getNativeScmRevision(); /** * Allocate and initialize the native Sigar object. diff --git a/bindings/java/src/org/hyperic/sigar/SigarVersion.java.in b/bindings/java/src/org/hyperic/sigar/SigarVersion.java.in index e3ad4b6d..de9ea078 100644 --- a/bindings/java/src/org/hyperic/sigar/SigarVersion.java.in +++ b/bindings/java/src/org/hyperic/sigar/SigarVersion.java.in @@ -4,5 +4,7 @@ class SigarVersion { static final String BUILD_DATE = "@@BUILD_DATE@@"; + static final String SCM_REVISION = "@@SCM_REVISION@@"; + static final String VERSION_STRING = "@@VERSION_STRING@@"; } diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Version.java b/bindings/java/src/org/hyperic/sigar/cmd/Version.java index 0243bade..9aa7607e 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Version.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Version.java @@ -62,13 +62,15 @@ public class Version extends SigarCommandBase { String build = "java=" + Sigar.BUILD_DATE + ", native=" + Sigar.NATIVE_BUILD_DATE; - + String scm = + "java=" + Sigar.SCM_REVISION + + ", native=" + Sigar.NATIVE_SCM_REVISION; String archlib = SigarLoader.getNativeLibraryName(); os.println("Sigar version......." + version); os.println("Build date.........." + build); - + os.println("SVN rev............." + scm); String host = getHostName(); String fqdn; Sigar sigar = new Sigar(); diff --git a/include/sigar.h b/include/sigar.h index 8d1d533e..2c6d9405 100644 --- a/include/sigar.h +++ b/include/sigar.h @@ -852,6 +852,7 @@ SIGAR_DECLARE(int) sigar_proc_port_get(sigar_t *sigar, typedef struct { const char *build_date; + const char *scm_revision; const char *version; const char *archname; const char *archlib; diff --git a/src/sigar_version.c.in b/src/sigar_version.c.in index f90d0a02..106b22ab 100644 --- a/src/sigar_version.c.in +++ b/src/sigar_version.c.in @@ -2,6 +2,7 @@ static sigar_version_t sigar_version = { "@@BUILD_DATE@@", + "@@SCM_REVISION@@", "@@VERSION_STRING@@", "@@ARCHNAME@@", "@@ARCHLIB@@",