Skip to content

Commit da631ae

Browse files
author
mgricken
committed
Better version handling for research compilers.
git-svn-id: file:///tmp/test-svn/trunk@5403 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 5a2208c commit da631ae

File tree

26 files changed

+92
-11
lines changed

26 files changed

+92
-11
lines changed

drjava/lib/platform.jar

624 Bytes
Binary file not shown.

drjava/src/edu/rice/cs/drjava/model/JDKDescriptor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ public String getAdapterForDebugger(JavaVersion.FullVersion guessedVersion) {
106106
/** Return true if the file (jar file or directory) contains the compiler.
107107
* @return true if the file contains the compiler */
108108
public abstract boolean containsCompiler(File f);
109+
110+
/** Return the guessed version for the compiler in the specified file (jar file or directory).
111+
* Note that this is the Java version that this compiler is compatible to, not the internal compiler version.
112+
* For full (non-compound) JDKs, this is equal to the version, i.e. JDK6 should guess Java 6.0.
113+
* For compound JDKs, this is equal to the version of the full JDK that the compound JDK needs, i.e.
114+
* if a version of the HJ compiler requires JDK6, it should guess JDK6.
115+
* @return guessed version */
116+
public JavaVersion.FullVersion guessVersion(File f) {
117+
return edu.rice.cs.drjava.model.JarJDKToolsLibrary.guessVersion(f, this);
118+
}
109119

110120
/** Return the minimum Java version required to use this JDK.
111121
* @return minimum version */

drjava/src/edu/rice/cs/drjava/model/JarJDKToolsLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static JarJDKToolsLibrary makeFromFile(File f, GlobalModel model, JDKDesc
151151
Debugger debugger = NoDebuggerAvailable.ONLY;
152152
JavadocModel javadoc = new NoJavadocAvailable(model);
153153

154-
FullVersion version = guessVersion(f, desc);
154+
FullVersion version = desc.guessVersion(f);
155155
JDKToolsLibrary.msg("makeFromFile: "+f+" --> "+version+", vendor: "+version.vendor());
156156
JDKToolsLibrary.msg(" desc = "+desc);
157157

misc/drjava-hj/build.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,25 @@
8686
dest="${combine.jars.temp.dir}" overwrite="true"/>
8787

8888
<java classname="DrJavaHJPropertyFile"
89-
classpath="drjavaHJPropertyFile"
89+
classpath="drjavaHJPropertyFile:${input1}:${input2}:${input3}:${input4}:${input5}:${input6}:${input7}:${input8}:${drjava.jar}"
9090
fork="true"
9191
dir="."
9292
failonerror="true">
9393
<arg value="${combine.jars.temp.dir}/edu/rice/cs/drjava/config/options.properties"/>
9494
</java>
95+
96+
<java classname="DrJavaHJPropertyFile$GetFileName"
97+
classpath="drjavaHJPropertyFile:${input1}:${input2}:${input3}:${input4}:${input5}:${input6}:${input7}:${input8}:drjava.jar"
98+
fork="true"
99+
dir="."
100+
failonerror="true"
101+
outputproperty="drjava.hj.file"/>
95102

96-
<manifest file="${combine.jars.temp.dir}/META-INF/MANIFEST.MF" mode="update">
103+
<!-- <manifest file="${combine.jars.temp.dir}/META-INF/MANIFEST.MF" mode="update">
97104
<attribute name="Created-By" value="1.5.0-drjavahj"/>
98-
</manifest>
105+
</manifest> -->
99106

100-
<jar destfile="drjava-hj.jar" basedir="${combine.jars.temp.dir}"
107+
<jar destfile="${drjava.hj.file}" basedir="${combine.jars.temp.dir}"
101108
manifest="${combine.jars.temp.dir}/META-INF/MANIFEST.MF"/>
102109
<delete dir="${combine.jars.temp.dir}" failonerror="false"/>
103110
</target>
Binary file not shown.
326 Bytes
Binary file not shown.

misc/drjava-hj/drjavaHJPropertyFile/DrJavaHJPropertyFile.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public static void main(String[] args) throws IOException {
77
System.out.println("Appends the DrJava version string.");
88
System.out.println("Disables automatic updates in DrJava.");
99

10+
String hjVersion = polyglot.ext.hj.Version.getVersion();
11+
System.out.println("HJ version is "+hjVersion);
12+
1013
Properties p = new Properties();
1114
String fileName = "edu/rice/cs/drjava/config/options.properties";
1215
String versionAddition = "www.habanero.rice.edu";
@@ -29,9 +32,17 @@ public static void main(String[] args) throws IOException {
2932
p.setProperty("custom.drjava.jar.version.suffix", versionSuffix);
3033
p.setProperty("new.version.allowed", "false");
3134
p.setProperty("new.version.notification", "none (disabled)");
32-
p.setProperty("default.compiler.preference.control", "HJ 5.0-drjavahj");
33-
p.setProperty("default.compiler.preference", "HJ 5.0-drjavahj");
35+
p.setProperty("default.compiler.preference.control", "HJ "+hjVersion);
36+
p.setProperty("default.compiler.preference", "HJ "+hjVersion);
3437

3538
p.store(new FileOutputStream(fileName), "drjava.jar with Habanero Java file generated "+new Date());
3639
}
40+
41+
public static class GetFileName {
42+
public static void main(String[] args) throws IOException {
43+
int drjavaRev = edu.rice.cs.drjava.Version.getRevisionNumber();
44+
String hjVersion = polyglot.ext.hj.Version.getVersion();
45+
System.out.println("drjava-r"+drjavaRev+"-hj-"+hjVersion+".jar");
46+
}
47+
}
3748
}
0 Bytes
Binary file not shown.

misc/drjava-hj/input/hj.jar

463 Bytes
Binary file not shown.

misc/drjava-hj/input/hjc.jar

9.31 KB
Binary file not shown.

0 commit comments

Comments
 (0)