include svn revision in version properties

This commit is contained in:
Doug MacEachern committed 2008-08-10 18:59:53 +00:00
1 parent 6e94034741
commit 34333d64e8
7 files changed
+58 -4

No files matched your search

+7
View File
@@ -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)
{
@@ -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.
@@ -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@@";
}
@@ -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();