include svn revision in version properties
This commit is contained in:
parent
6e94034741
commit
34333d64e8
|
@ -111,11 +111,12 @@
|
||||||
|
|
||||||
<echo>cp ${version.file.srcdir}/${version.file}.in -> ${version.tofile}</echo>
|
<echo>cp ${version.file.srcdir}/${version.file}.in -> ${version.tofile}</echo>
|
||||||
<copy file="${version.file.srcdir}/${version.file}.in"
|
<copy file="${version.file.srcdir}/${version.file}.in"
|
||||||
tofile="${version.tofile}"/>
|
tofile="${version.tofile}" overwrite="true"/>
|
||||||
|
|
||||||
<replace file="${version.tofile}">
|
<replace file="${version.tofile}">
|
||||||
<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}"/>
|
||||||
|
<replacefilter token="@@SCM_REVISION@@" value="${sigar.scmrev}"/>
|
||||||
<replacefilter token="@@ARCHNAME@@" value="${jni.libarch}"/>
|
<replacefilter token="@@ARCHNAME@@" value="${jni.libarch}"/>
|
||||||
<replacefilter token="@@ARCHLIB@@" value="${jni.libname.full}"/>
|
<replacefilter token="@@ARCHLIB@@" value="${jni.libname.full}"/>
|
||||||
<replacefilter token="@@BINNAME@@" value="${jni.project.archname}"/>
|
<replacefilter token="@@BINNAME@@" value="${jni.project.archname}"/>
|
||||||
|
@ -127,11 +128,36 @@
|
||||||
</replace>
|
</replace>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="sigar-version">
|
<target name="check-svn">
|
||||||
|
<condition property="svn.available">
|
||||||
|
<and>
|
||||||
|
<available file=".svn" type="dir"/>
|
||||||
|
<available file="svn" type="file">
|
||||||
|
<filepath>
|
||||||
|
<pathelement path="${env.PATH}"/>
|
||||||
|
</filepath>
|
||||||
|
</available>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="scm-revision" if="svn.available">
|
||||||
|
<exec executable="svnversion" dir="."
|
||||||
|
outputproperty="sigar.scmrev"
|
||||||
|
failifexecutionfails="false">
|
||||||
|
<arg value="."/>
|
||||||
|
</exec>
|
||||||
|
<echo message="SIGAR svn revision #${sigar.scmrev}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="sigar-version" depends="check-svn,scm-revision">
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
|
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
|
||||||
</tstamp>
|
</tstamp>
|
||||||
|
|
||||||
|
<!-- in the case of release source builds -->
|
||||||
|
<property name="sigar.scmrev" value="exported"/>
|
||||||
|
|
||||||
<antcall target="version-file">
|
<antcall target="version-file">
|
||||||
<param name="version.file"
|
<param name="version.file"
|
||||||
value="src/org/hyperic/sigar/SigarVersion.java"/>
|
value="src/org/hyperic/sigar/SigarVersion.java"/>
|
||||||
|
|
|
@ -276,6 +276,13 @@ JNIEXPORT jstring SIGAR_JNIx(getNativeBuildDate)
|
||||||
return JENV->NewStringUTF(env, version->build_date);
|
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)
|
JNIEXPORT void SIGAR_JNIx(open)
|
||||||
(JNIEnv *env, jobject obj)
|
(JNIEnv *env, jobject obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,17 @@ public class Sigar implements SigarProxy {
|
||||||
*/
|
*/
|
||||||
public static final String NATIVE_VERSION_STRING;
|
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.
|
* The date on which sigar.jar was built.
|
||||||
*/
|
*/
|
||||||
|
@ -85,11 +96,13 @@ public class Sigar implements SigarProxy {
|
||||||
static {
|
static {
|
||||||
String nativeVersion = "unknown";
|
String nativeVersion = "unknown";
|
||||||
String nativeBuildDate = "unknown";
|
String nativeBuildDate = "unknown";
|
||||||
|
String nativeScmRevision = "unknown";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loadLibrary();
|
loadLibrary();
|
||||||
nativeVersion = getNativeVersion();
|
nativeVersion = getNativeVersion();
|
||||||
nativeBuildDate = getNativeBuildDate();
|
nativeBuildDate = getNativeBuildDate();
|
||||||
|
nativeScmRevision = getNativeScmRevision();
|
||||||
checkVersion(nativeVersion);
|
checkVersion(nativeVersion);
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
loadError = e.getMessage();
|
loadError = e.getMessage();
|
||||||
|
@ -104,6 +117,7 @@ public class Sigar implements SigarProxy {
|
||||||
|
|
||||||
NATIVE_VERSION_STRING = nativeVersion;
|
NATIVE_VERSION_STRING = nativeVersion;
|
||||||
NATIVE_BUILD_DATE = nativeBuildDate;
|
NATIVE_BUILD_DATE = nativeBuildDate;
|
||||||
|
NATIVE_SCM_REVISION = nativeScmRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVersion(String nativeVersionString)
|
private static void checkVersion(String nativeVersionString)
|
||||||
|
@ -175,6 +189,7 @@ public class Sigar implements SigarProxy {
|
||||||
|
|
||||||
private static native String getNativeVersion();
|
private static native String getNativeVersion();
|
||||||
private static native String getNativeBuildDate();
|
private static native String getNativeBuildDate();
|
||||||
|
private static native String getNativeScmRevision();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate and initialize the native Sigar object.
|
* Allocate and initialize the native Sigar object.
|
||||||
|
|
|
@ -4,5 +4,7 @@ class SigarVersion {
|
||||||
|
|
||||||
static final String BUILD_DATE = "@@BUILD_DATE@@";
|
static final String BUILD_DATE = "@@BUILD_DATE@@";
|
||||||
|
|
||||||
|
static final String SCM_REVISION = "@@SCM_REVISION@@";
|
||||||
|
|
||||||
static final String VERSION_STRING = "@@VERSION_STRING@@";
|
static final String VERSION_STRING = "@@VERSION_STRING@@";
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,13 +62,15 @@ public class Version extends SigarCommandBase {
|
||||||
String build =
|
String build =
|
||||||
"java=" + Sigar.BUILD_DATE +
|
"java=" + Sigar.BUILD_DATE +
|
||||||
", native=" + Sigar.NATIVE_BUILD_DATE;
|
", native=" + Sigar.NATIVE_BUILD_DATE;
|
||||||
|
String scm =
|
||||||
|
"java=" + Sigar.SCM_REVISION +
|
||||||
|
", native=" + Sigar.NATIVE_SCM_REVISION;
|
||||||
String archlib =
|
String archlib =
|
||||||
SigarLoader.getNativeLibraryName();
|
SigarLoader.getNativeLibraryName();
|
||||||
|
|
||||||
os.println("Sigar version......." + version);
|
os.println("Sigar version......." + version);
|
||||||
os.println("Build date.........." + build);
|
os.println("Build date.........." + build);
|
||||||
|
os.println("SVN rev............." + scm);
|
||||||
String host = getHostName();
|
String host = getHostName();
|
||||||
String fqdn;
|
String fqdn;
|
||||||
Sigar sigar = new Sigar();
|
Sigar sigar = new Sigar();
|
||||||
|
|
|
@ -852,6 +852,7 @@ SIGAR_DECLARE(int) sigar_proc_port_get(sigar_t *sigar,
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *build_date;
|
const char *build_date;
|
||||||
|
const char *scm_revision;
|
||||||
const char *version;
|
const char *version;
|
||||||
const char *archname;
|
const char *archname;
|
||||||
const char *archlib;
|
const char *archlib;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
static sigar_version_t sigar_version = {
|
static sigar_version_t sigar_version = {
|
||||||
"@@BUILD_DATE@@",
|
"@@BUILD_DATE@@",
|
||||||
|
"@@SCM_REVISION@@",
|
||||||
"@@VERSION_STRING@@",
|
"@@VERSION_STRING@@",
|
||||||
"@@ARCHNAME@@",
|
"@@ARCHNAME@@",
|
||||||
"@@ARCHLIB@@",
|
"@@ARCHLIB@@",
|
||||||
|
|
Loading…
Reference in New Issue