Skip to content

Commit 3ed3053

Browse files
author
rcartwright
committed
This is an experimental commit. The files were created in the Windows
NTFS file system using WUBI Linux but commited from Windows. The primary changes are to build.xml in an attempt to support compiling and testing in Java 6, 7, and 8. Compilation is typically done using Java but with 1.6 as a target so that class files version tags are compatible with Java 6. The only changes are small formatting corrections. The following files were modified: M build.xml M src/edu/rice/cs/drjava/model/repl/InteractionsDJDocument.java M src/edu/rice/cs/drjava/model/repl/JavaInterpreterTest.java git-svn-id: file:///tmp/test-svn/trunk@5760 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent c3a494e commit 3ed3053

File tree

3 files changed

+265
-88
lines changed

3 files changed

+265
-88
lines changed

drjava/build.xml

Lines changed: 185 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<property name="drjava.test.config" value="testFiles/drjava.basic.config" />
4141

4242
<property environment="env" />
43+
<property name="java8-home" value="${env.JAVA8_HOME}" />
4344
<property name="java7-home" value="${env.JAVA7_HOME}" />
4445
<property name="java6-home" value="${env.JAVA6_HOME}" />
4546
<property name="java5-home" value="${env.JAVA5_HOME}" />
@@ -107,6 +108,8 @@
107108
<echo message=" '-6' targets)" />
108109
<echo message="JAVA7_HOME: Home folder of the Java 7 JRE or JDK (required for" />
109110
<echo message=" '-7' targets)" />
111+
<echo message="JAVA8_HOME: Home folder of the Java 8 JRE or JDK (required for" />
112+
<echo message=" '-8' targets)" />
110113
<echo message="LAUNCH4J_HOME: Location of the Launch4j installation (used to " />
111114
<echo message=" release a Windows application)" />
112115
<echo message="CLOVER_JAR: Location of the Clover jar file" />
@@ -215,11 +218,12 @@
215218
Compilation Targets
216219
******************* -->
217220

221+
<!-- The following target assumes that javac resolves a Java 8 compiler -->
218222
<target name="compile" depends="generate-source, do-compile, copy-resources, unjar-libs"
219223
description="Compile all source files (after generating the source)">
220224
</target>
221225

222-
<target name="do-compile" depends="resolve-java7-runtime, resolve-java7-tools">
226+
<target name="do-compile" depends="resolve-java8-runtime, resolve-java8-tools">
223227

224228
<echo message="Compiling src directory to classes/base and classes/test with command 'javac'" />
225229

@@ -231,14 +235,14 @@
231235
<fileset dir="classes/test" includes="**/*" />
232236
</move>
233237

234-
<javac srcdir="src" destdir="classes/base" source="1.5" target="1.5"
235-
bootclasspath="${java7-runtime}" sourcepath="" includeAntRuntime="no"
236-
executable="javac" fork="yes" memoryMaximumSize="512M"
238+
<javac srcdir="src" destdir="classes/base" source="1.6" target="1.6"
239+
bootclasspath="${java8-runtime}" sourcepath="" includeAntRuntime="no"
240+
executable="javac" fork="yes" memoryMaximumSize="1024M"
237241
debug="on" optimize="off" deprecation="on" >
238242
<classpath>
239243
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
240244
debugger code into the "platform" module -->
241-
<pathelement location="${java7-tools}" />
245+
<pathelement location="${java8-tools}" />
242246
<fileset refid="libs" />
243247
<pathelement location="lib/buildlib/junit.jar" />
244248
<pathelement location="lib/buildlib/netbeans-memory-leak-utils.jar" />
@@ -265,8 +269,111 @@
265269
</move>
266270

267271
</target>
272+
273+
<!-- The following target assumes that javac resolves to a Java 6 javac compiler -->
274+
<target name="compile-6" depends="generate-source, do-compile-6, copy-resources, unjar-libs"
275+
description="Compile all source files (after generating the source)">
276+
</target>
268277

278+
<target name="do-compile-6" depends="resolve-java6-runtime, resolve-java6-tools">
269279

280+
<echo message="Compiling src directory to classes/base and classes/test with command 'javac'" />
281+
282+
<mkdir dir="classes/base" />
283+
<mkdir dir="classes/test" />
284+
285+
<!-- Move any test classes back to base to prevent recompilation -->
286+
<move todir="classes/base">
287+
<fileset dir="classes/test" includes="**/*" />
288+
</move>
289+
290+
<javac srcdir="src" destdir="classes/base" source="1.6" target="1.6"
291+
bootclasspath="${java6-runtime}" sourcepath="" includeAntRuntime="no"
292+
executable="javac" fork="yes" memoryMaximumSize="1024M"
293+
debug="on" optimize="off" deprecation="on" >
294+
<classpath>
295+
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
296+
debugger code into the "platform" module -->
297+
<pathelement location="${java6-tools}" />
298+
<fileset refid="libs" />
299+
<pathelement location="lib/buildlib/junit.jar" />
300+
<pathelement location="lib/buildlib/netbeans-memory-leak-utils.jar" />
301+
<pathelement location="classes/base" />
302+
</classpath>
303+
<compilerarg value="-Xlint" />
304+
<!-- Ignore serial warnings, because they occur for every Throwable definition (among others) -->
305+
<compilerarg value="-Xlint:-serial" />
306+
<!-- Use the next line to compile against other sources, ignoring any unneeded classes.
307+
This can be useful in creating a pruned version of a jar file for the lib directory.
308+
(You must also clear the sourcepath="" option.)
309+
<include name="${src-working-dir}/**/*.java" /> -->
310+
</javac>
311+
312+
<mkdir dir="classes/test" /> <!-- May be deleted by the previous move -->
313+
<move todir="classes/test">
314+
<fileset dir="classes/base">
315+
<include name="**/*Test.class" />
316+
<include name="**/*Test$*.class" />
317+
<include name="**/*TestCase.class" />
318+
<include name="**/*TestCase$*.class" />
319+
<!-- Additional test classes should be listed here -->
320+
</fileset>
321+
</move>
322+
323+
</target>
324+
325+
<!-- The following target assumes that javac resolves to a Java 7 javac compiler -->
326+
<target name="compile-7" depends="generate-source, do-compile-7, copy-resources, unjar-libs"
327+
description="Compile all source files (after generating the source)">
328+
</target>
329+
330+
<target name="do-compile-7" depends="resolve-java7-runtime, resolve-java7-tools">
331+
332+
<echo message="Compiling src directory to classes/base and classes/test with command 'javac'" />
333+
334+
<mkdir dir="classes/base" />
335+
<mkdir dir="classes/test" />
336+
337+
<!-- Move any test classes back to base to prevent recompilation -->
338+
<move todir="classes/base">
339+
<fileset dir="classes/test" includes="**/*" />
340+
</move>
341+
342+
<javac srcdir="src" destdir="classes/base" source="1.6" target="1.6"
343+
bootclasspath="${java7-runtime}" sourcepath="" includeAntRuntime="no"
344+
executable="javac" fork="yes" memoryMaximumSize="1024M"
345+
debug="on" optimize="off" deprecation="on" >
346+
<classpath>
347+
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
348+
debugger code into the "platform" module -->
349+
<pathelement location="${java7-tools}" />
350+
<fileset refid="libs" />
351+
<pathelement location="lib/buildlib/junit.jar" />
352+
<pathelement location="lib/buildlib/netbeans-memory-leak-utils.jar" />
353+
<pathelement location="classes/base" />
354+
</classpath>
355+
<compilerarg value="-Xlint" />
356+
<!-- Ignore serial warnings, because they occur for every Throwable definition (among others) -->
357+
<compilerarg value="-Xlint:-serial" />
358+
<!-- Use the next line to compile against other sources, ignoring any unneeded classes.
359+
This can be useful in creating a pruned version of a jar file for the lib directory.
360+
(You must also clear the sourcepath="" option.)
361+
<include name="${src-working-dir}/**/*.java" /> -->
362+
</javac>
363+
364+
<mkdir dir="classes/test" /> <!-- May be deleted by the previous move -->
365+
<move todir="classes/test">
366+
<fileset dir="classes/base">
367+
<include name="**/*Test.class" />
368+
<include name="**/*Test$*.class" />
369+
<include name="**/*TestCase.class" />
370+
<include name="**/*TestCase$*.class" />
371+
<!-- Additional test classes should be listed here -->
372+
</fileset>
373+
</move>
374+
375+
</target>
376+
270377
<target name="copy-resources">
271378
<copy todir="classes/base">
272379
<fileset dir="src">
@@ -301,7 +408,6 @@
301408
</unjar>
302409
</target>
303410

304-
305411

306412
<!-- ***************
307413
Testing Targets
@@ -316,6 +422,16 @@
316422
</antcall>
317423
</target>
318424

425+
<target name="test-8" depends="compile, resolve-java8-exec, resolve-java8-tools" unless="skip-test"
426+
description="Run all tests under Java 8 (after compiling); use -Dtest-spec=... to filter">
427+
<echo message="ConcJUnit is currently incompatible with Java 7."/>
428+
<antcall target="iterate-tests">
429+
<param name="test-jvm" value="${java8-exec}" />
430+
<param name="test-tools" value="${java8-tools}" />
431+
<param name="test-force-disable-concjunit" value="true" />
432+
</antcall>
433+
</target>
434+
319435
<target name="test-7" depends="compile, resolve-java7-exec, resolve-java7-tools" unless="skip-test"
320436
description="Run all tests under Java 7 (after compiling); use -Dtest-spec=... to filter">
321437
<echo message="ConcJUnit is currently incompatible with Java 7."/>
@@ -433,7 +549,7 @@
433549
<echo message="Running all tests matching '${test-filter-string}' with command '${test-jvm}', using '${junit-jar}' and '${test-tools}'" />
434550
<extendclasspath path="${junit-jar}" />
435551
<junit haltonfailure="${test-halt}" failureproperty="test-failed"
436-
fork="yes" forkmode="perTest" maxmemory="1G" jvm="${test-jvm}" dir="${basedir}">
552+
fork="yes" forkmode="perTest" maxmemory="2G" jvm="${test-jvm}" dir="${basedir}">
437553
<classpath>
438554
<pathelement location="${test-tools}" />
439555
<pathelement location="${junit-jar}" />
@@ -471,6 +587,13 @@
471587
</antcall>
472588
</target>
473589

590+
<target name="run-8" depends="compile, resolve-java8-exec"
591+
description="Run the main class under Java 8 (after compiling)">
592+
<antcall target="do-run">
593+
<param name="run-jvm" value="${java8-exec}" />
594+
</antcall>
595+
</target>
596+
474597
<target name="run-7" depends="compile, resolve-java7-exec"
475598
description="Run the main class under Java 7 (after compiling)">
476599
<antcall target="do-run">
@@ -517,6 +640,13 @@
517640
</antcall>
518641
</target>
519642

643+
<target name="run-jar-8" depends="jar, resolve-java8-exec"
644+
description="Run the jar file under Java 7 (after building it)">
645+
<antcall target="do-run-jar">
646+
<param name="run-jvm" value="${java8-exec}" />
647+
</antcall>
648+
</target>
649+
520650
<target name="run-jar-7" depends="jar, resolve-java7-exec"
521651
description="Run the jar file under Java 7 (after building it)">
522652
<antcall target="do-run-jar">
@@ -1255,6 +1385,24 @@
12551385
Property-resolution Targets
12561386
*************************** -->
12571387

1388+
<target name="resolve-java8-runtime">
1389+
<!-- We rely on "location" to generate a platform-specific path; note that properties
1390+
are immutable and so java8-runtime will only be set the *first* time. -->
1391+
1392+
<property name="java8-runtime-1" location="${java8-home}/lib/rt.jar" />
1393+
<available property="java8-runtime" value="${java8-runtime-1}" file="${java8-runtime-1}" />
1394+
1395+
<property name="java8-runtime-2" location="${java8-home}/jre/lib/rt.jar" />
1396+
<available property="java8-runtime" value="${java8-runtime-2}" file="${java8-runtime-2}" />
1397+
1398+
<property name="java8-runtime-3" location="${java8-home}/../Classes/classes.jar" />
1399+
<available property="java8-runtime" value="${java8-runtime-3}" file="${java8-runtime-3}" />
1400+
1401+
<echo message="java8-runtime = ${java8-runtime}" />
1402+
1403+
<fail message="Can't find rt.jar in the Java 8 home: ${java8-home}" unless="java8-runtime" />
1404+
</target>
1405+
12581406
<target name="resolve-java7-runtime">
12591407
<!-- We rely on "location" to generate a platform-specific path; note that properties
12601408
are immutable and so java7-runtime will only be set the *first* time. -->
@@ -1273,6 +1421,23 @@
12731421
<fail message="Can't find rt.jar in the Java 7 home: ${java7-home}" unless="java7-runtime" />
12741422
</target>
12751423

1424+
<target name="resolve-java8-exec">
1425+
<!-- We rely on "location" to generate a platform-specific path -->
1426+
1427+
<property name="java8-exec-1" location="${java8-home}/bin/java.exe" />
1428+
<condition property="java8-exec" value="${java8-exec-1}">
1429+
<and>
1430+
<available file="${java8-exec-1}" />
1431+
<os family="windows" />
1432+
</and>
1433+
</condition>
1434+
1435+
<property name="java8-exec-2" location="${java8-home}/bin/java" />
1436+
<available property="java8-exec" value="${java8-exec-2}" file="${java8-exec-2}" />
1437+
1438+
<fail message="Can't find the java executable in the Java 8 home: ${java8-home}" unless="java8-exec" />
1439+
</target>
1440+
12761441
<target name="resolve-java7-exec">
12771442
<!-- We rely on "location" to generate a platform-specific path -->
12781443

@@ -1360,6 +1525,19 @@
13601525
<fail message="Can't find the java executable in the Java 5 home: ${java5-home}" unless="java5-exec" />
13611526
</target>
13621527

1528+
<target name="resolve-java8-tools">
1529+
<property name="java8-tools-1" location="${java8-home}/lib/tools.jar" />
1530+
<available property="java8-tools" value="${java8-tools-1}" file="${java8-tools-1}" />
1531+
1532+
<property name="java8-tools-2" location="${java8-home}/../lib/tools.jar" />
1533+
<available property="java8-tools" value="${java8-tools-2}" file="${java8-tools-2}" />
1534+
1535+
<property name="java8-tools-3" location="${java8-home}/../Classes/classes.jar" />
1536+
<available property="java8-tools" value="${java8-tools-3}" file="${java8-tools-3}" />
1537+
1538+
<fail message="Can't find tools.jar in the Java 8 home: ${java8-home}" unless="java8-tools" />
1539+
</target>
1540+
13631541
<target name="resolve-java7-tools">
13641542
<property name="java7-tools-1" location="${java7-home}/lib/tools.jar" />
13651543
<available property="java7-tools" value="${java7-tools-1}" file="${java7-tools-1}" />

drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDJDocument.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ public void addColoring(int start, int end, String style) {
223223
/** Accessor method used to copy contents of _stylesList to an array. Used in test cases. */
224224
public Pair<Pair<Integer, Integer>, String>[] getStyles() {
225225
synchronized(_stylesList) {
226-
// TODO: file javac bug report concerning placement of @SuppressWarnings. Fails if rhs of result binding is used as body of return statement.
226+
// TODO: file javac bug report concerning placement of @SuppressWarnings. Fails if rhs of result binding is used as body of
227+
// return statement.
227228
@SuppressWarnings({"unchecked", "rawtypes"})
228229
Pair<Pair<Integer, Integer>, String>[] result = _stylesList.toArray(new Pair[0]);
229230
return result;

0 commit comments

Comments
 (0)