You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/22 16:53:28 UTC
svn commit: r817684 - in /commons/sandbox/runtime/trunk: ./
src/main/java/org/apache/commons/runtime/
src/main/java/org/apache/commons/runtime/util/
src/task/org/apache/commons/runtime/
Author: mturk
Date: Tue Sep 22 14:53:27 2009
New Revision: 817684
URL: http://svn.apache.org/viewvc?rev=817684&view=rev
Log:
Use build stamp for windows tempdir name
Modified:
commons/sandbox/runtime/trunk/build.xml
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Default.properties
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Loader.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/UUID.java
commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java
Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Tue Sep 22 14:53:27 2009
@@ -135,9 +135,14 @@
<mkdir dir="${build.dest}/java"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.src}/java"/>
+ <delete>
+ <!-- Delete *.properties so that we always get the correct stamp -->
+ <fileset dir="${build.dest}/java" includes="**/*.properties"/>
+ </delete>
<tstamp>
<format property="TODAY" pattern="MMM d yyyy" locale="en"/>
- <format property="TSTAMP" pattern="hh:mm:ss"/>
+ <format property="TSTAMP" pattern="HH:mm:ss"/>
+ <format property="BSTAMP" pattern="yyyyMMddHHmmssSSS" timezone="GMT"/>
</tstamp>
<!-- Copy static resource files -->
<filter token="VERSION" value="${version}"/>
@@ -147,6 +152,7 @@
<filter token="VERSION_NUMBER" value="${version.number}"/>
<filter token="VERSION_PNAME" value="${final.name}"/>
<filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
+ <filter token="VERSION_STAMP" value="${BSTAMP}"/>
<copy todir="${build.src}/java" filtering="yes">
<fileset dir="${src.dir}/main/java">
<include name="**/*.java"/>
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Default.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Default.properties?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Default.properties (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Default.properties Tue Sep 22 14:53:27 2009
@@ -29,6 +29,8 @@
runtime.version.minor = @VERSION_MINOR@
runtime.version.patch = @VERSION_PATCH@
runtime.version.pname = @VERSION_PNAME@
+# Build stamp.
+runtime.version.build = @VERSION_STAMP@
# Indicates the caching policy for lookups on cpu object.
# The TTL is number of milliseconds between two counter lookups.
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Loader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Loader.java?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Loader.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Loader.java Tue Sep 22 14:53:27 2009
@@ -18,9 +18,10 @@
import org.apache.commons.runtime.exception.UnsupportedOperatingSystemException;
import org.apache.commons.runtime.util.Utils;
-
+import org.apache.commons.runtime.util.UUID;
import java.io.File;
import java.io.IOException;
+import java.security.MessageDigest;
import java.util.HashMap;
/**
@@ -55,12 +56,16 @@
if (path == null) {
try {
if (SystemId.getSysname().equals("windows")) {
- String acr = "ApacheCommonsRuntime_" +
- Properties.VERSION_MAJOR + "_" +
- Properties.VERSION_MINOR + "_" +
- Properties.VERSION_PATCH + "_" +
- SystemId.getProcessor() + "_libpath";
-
+ String acr;
+ try {
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ String sig = Properties.VERSION_BUILD + SystemId.getProcessor();
+ md.update(sig.getBytes());
+ UUID uuid = new UUID(md.digest());
+ acr = "_acr-" + uuid.toString();
+ } catch (Exception ex) {
+ acr = "_acr-" + Properties.VERSION_BUILD;
+ }
path = new File(Utils.getTempPath(), acr);
if (path.mkdir()) {
/* Delete on exit will work only if library load
@@ -74,7 +79,7 @@
path = Utils.createTempDirectory("loader-");
path.deleteOnExit();
}
- } catch (IOException io) {
+ } catch (Exception io) {
// Cannot create temp dir
return null;
}
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java Tue Sep 22 14:53:27 2009
@@ -186,6 +186,9 @@
/** Product name of the runtime library
*/
public static final String VERSION_PNAME = getS("runtime.version.pname");
+ /** Build timestamp
+ */
+ public static final String VERSION_BUILD = getS("runtime.version.build");
/** List of the native libraries to load.
*/
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/UUID.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/UUID.java?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/UUID.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/UUID.java Tue Sep 22 14:53:27 2009
@@ -35,6 +35,14 @@
uuid = getb0();
}
+ public UUID(byte[] uuid)
+ throws IllegalArgumentException
+ {
+ if (uuid.length < 16)
+ throw new IllegalArgumentException("Must be at least 16 bytes");
+ this.uuid = uuid;
+ }
+
private String hex(byte val)
{
String h = Integer.toHexString(val);
Modified: commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java?rev=817684&r1=817683&r2=817684&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java (original)
+++ commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java Tue Sep 22 14:53:27 2009
@@ -22,7 +22,7 @@
throw new BuildException("Missing system prefix");
getProject().setNewProperty(prefix + ".so", SystemId.getSoExtension());
getProject().setNewProperty(prefix + ".cpu", SystemId.getProcessor());
- getProject().setNewProperty(prefix + ".os", SystemId.getSysname());
+ getProject().setNewProperty(prefix + ".os", SystemId.getSysname());
}
}