(SIGAR-214) properly adjust jni.javahome when JAVA_HOME is not set

This commit is contained in:
Doug MacEachern committed 2010-04-09 09:01:13 -07:00
1 parent 9ce6361973
commit 4227bf6ab9
2 files changed
+15 -9

No files matched your search

+4 -9
View File
@@ -54,15 +54,6 @@ USA.
<condition property="jni.javahome" value="${env.JAVA_HOME}">
<isset property="env.JAVA_HOME"/>
</condition>
<condition property="jni.javahome" value="${java.home}">
<not>
<isset property="jni.javahome"/>
</not>
</condition>
<echo>java.home=${jni.javahome}</echo>
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
<condition property="linux">
<equals arg1="${os.name}" arg2="Linux"/>
@@ -180,6 +171,10 @@ USA.
<libarch/>
<echo>java.home=${jni.javahome}</echo>
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
<property name="jni.project.archname"
value="${project.name}-${jni.libarch}"/>
@@ -138,6 +138,17 @@ public class ArchNameTask extends Task {
}
}
getProject().setProperty("jni.scmrev", getSourceRevision());
//jni.javahome required to find include/jni.h
String home = getProject().getProperty("jni.javahome");
if (home == null) {
home = System.getProperty("java.home");
}
File dir = new File(home);
if (!new File(dir, "include").exists()) {
dir = dir.getParentFile(); //was /jre
}
getProject().setProperty("jni.javahome", dir.getPath());
}
//XXX source rev stuff should be in another task