Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable compile src code in drjava and platform in java10
  • Loading branch information
dapanghu committed Aug 28, 2018
commit f749f6baf166bf79b2b507dfb103f8c85a9368c9
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
*.new
*.mine
*.alt
*.DS_Store
*.backup
codecoverage
drjava/classes
drjava/drjava.jar
drjava/build.xml.*
drjava/coverage_report
scratch
platform/classes/lib/
platform/classes/test-mac/
scratch
60 changes: 57 additions & 3 deletions drjava/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<echo message="libs = ${toString:libs}" level="verbose" />
<echo message="jrelibs = ${toString:jrelibs}" level="verbose"/>
<fileset id="extlibs" dir="${java.home}/lib/ext" includes="*.jar" />
<echo message="extlibs = ${toString:extlibs}" level="verbose"/>
<!--echo message="extlibs = ${toString:extlibs}" level="verbose"/-->
<!-- ************
Help Targets
************ -->
Expand Down Expand Up @@ -187,10 +187,64 @@
******************* -->

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


<!--target name="do-compile-7-to-10" depends="resolve-java8-runtime, resolve-java8-tools"-->
<target name="do-compile-7-to-10">

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

<mkdir dir="classes/base" />
<mkdir dir="classes/test" />

<!-- Move any test classes back to base to prevent recompilation -->
<move todir="classes/base">
<fileset dir="classes/test" includes="**/*" />
</move>
<echo message="jrelibs=${toString:jrelibs}" />
<echo message="libs=${toString:libs}" />
<javac srcdir="src" destdir="classes/base" release="10"
sourcepath="" includeAntRuntime="no"
fork="yes" memoryMaximumSize="1024M"
debug="on" optimize="off" deprecation="on" >
<classpath>
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
debugger code into the "platform" module -->
<pathelement location="lib/buildlib/junit.jar" />
<fileset refid="libs" />
<fileset refid="jrelibs" />
<pathelement location="lib/buildlib/netbeans-memory-leak-utils.jar" />
<!-- <pathelement location="classes/base" /> THIS directory is typically empty at the start of this step -->
</classpath>
<compilerarg value="-Xlint" />
<!-- Ignore serial warnings, because they occur for every Throwable definition (among others) -->
<compilerarg value="-Xlint:-serial" />
<!-- Use the next line to compile against other sources, ignoring any unneeded classes.
This can be useful in creating a pruned version of a jar file for the lib directory.
(You must also clear the sourcepath="" option.)
<include name="${src-working-dir}/**/*.java" /> -->
</javac>

<mkdir dir="classes/test" /> <!-- May be deleted by the previous move -->
<move todir="classes/test">
<fileset dir="classes/base">
<include name="**/*Test.class" />
<include name="**/*Test$*.class" />
<include name="**/*TestCase.class" />
<include name="**/*TestCase$*.class" />
<!-- Additional test classes should be listed here -->
</fileset>
</move>

</target>





<target name="do-compile" depends="resolve-java8-runtime, resolve-java8-tools">

<echo message="Compiling src directory to classes/base and classes/test with command 'javac'" />
Expand Down Expand Up @@ -330,7 +384,7 @@
Testing Targets
*************** -->

<target name="test" depends="compile, resolve-current-tools" unless="skip-test"
<target name="test" depends="compile" unless="skip-test"
description="Run all tests (after compiling); use -Dtest-spec=... to filter">
<antcall target="iterate-tests">
<param name="test-jvm" value="java" />
Expand Down
Binary file modified drjava/lib/jacocoant.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions drjava/src/edu/rice/cs/drjava/ui/RegionsTreePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ public void addRegion(final R r) {
// }
// else {
@SuppressWarnings("unchecked")
Enumeration<DefaultMutableTreeNode> regionNodes = docNode.children();
Enumeration<TreeNode> regionNodes = docNode.children();

// Create a new region node in this document node list, where regions are sorted by start offset.
int startOffset = r.getStartOffset();
Expand All @@ -809,7 +809,7 @@ public void addRegion(final R r) {
// _cachedStartOffset = startOffset;
break;
}
DefaultMutableTreeNode node = regionNodes.nextElement();
DefaultMutableTreeNode node = (DefaultMutableTreeNode)regionNodes.nextElement();

@SuppressWarnings("unchecked")
RegionTreeUserObj<R> userObject = (RegionTreeUserObj<R>) node.getUserObject();
Expand Down
Empty file added platform/.bash_profile
Empty file.
72 changes: 63 additions & 9 deletions platform/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
<property name="error" value="stderr" />
<property name="plt.error.log" value="${error}" />
<property name="clean-can-fail" value="yes" />
<property name="drjava-jar" value="${env.DRJAVA_JAR}" />

<!-- *** Environment properties that are not needed may be removed *** -->
<property environment="env" />
<echo message="DRJAVA_JAR = ${env.DRJAVA_JAR}"/>
<property name="drjava-jar" value="${env.DRJAVA_JAR}" />
<property name="java5-home" value="${env.JAVA5_HOME}" />
<property name="java6-home" value="${env.JAVA6_HOME}" />
<property name="java7-home" value="${env.JAVA7_HOME}" />
Expand Down Expand Up @@ -231,13 +232,13 @@
</antcall>
</target>

<target name="compile-mac" depends="resolve-java5-runtime"
<target name="compile-mac" depends=""
description="Compile the 'mac' sources">
<antcall target="do-compile">
<antcall target="do-compile-10">
<param name="platform-tag" value="mac" />
<param name="source-version" value="1.5" />
<param name="runtime-jar" value="${java5-runtime}" />
<param name="extra-classpath" value="${java5-runtime}/../ui.jar" />
<!--param name="source-version" value="1.5" /-->
<!--param name="runtime-jar" value="${java5-runtime}" /-->
<!--param name="extra-classpath" value="${java5-runtime}/../ui.jar" /-->
</antcall>
</target>

Expand All @@ -251,8 +252,8 @@
</antcall>
</target>

<!-- Requires that the properties 'platform-tag', 'source-version', 'runtime-jar', and

<!-- Requires that the properties 'platform-tag', 'source-version', 'runtime-jar', and
'extra-classpath' be set -->
<target name="do-compile" depends="assert-drjava-jar-exists">

Expand All @@ -272,6 +273,59 @@
source="${source-version}" target="${source-version}"
bootclasspath="${runtime-jar}" sourcepath="" includeAntRuntime="no"
executable="javac" fork="yes" memoryMaximumSize="512M"
verbose = 'true' debug="on" optimize="off" deprecation="on">
<classpath>
<pathelement path="${extra-classpath}" />
<fileset refid="libs" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="classes/base-${platform-tag}" />
<pathelement location="${drjava-jar}" />
</classpath>
<compilerarg value="-Xlint" />
<!-- Ignore serial warnings, because they occur for every Throwable definition (among others) -->
<compilerarg value="-Xlint:-serial" />
<!-- Use the next line to compile against other sources, ignoring any unneeded classes.
This can be useful in creating a pruned version of a jar file for the lib directory.
(You must also clear the sourcepath="" option.)
<include name="${src-working-dir}/**/*.java" /> -->
</javac>

<move todir="classes/test-${platform-tag}">
<fileset dir="classes/base-${platform-tag}">
<include name="**/*Test.class" />
<include name="**/*Test$*.class" />
<include name="**/*TestCase.class" />
<include name="**/*TestCase$*.class" />
<!-- Additional test classes should be listed here -->
</fileset>
</move>

<antcall target="copy-resources" />
<antcall target="unjar-libs" />

</target>


<!-- Requires that the properties 'platform-tag', 'source-version', 'runtime-jar', and
'extra-classpath' be set -->
<target name="do-compile-10" depends="">

<echo message="Compiling src-${platform-tag} directory to classes/base-${platform-tag} and classes/test-${platform-tag}" />
<echo message="with command 'javac'" />

<!-- Make the directories if they don't already exist -->
<mkdir dir="classes/base-${platform-tag}" />
<mkdir dir="classes/test-${platform-tag}" />
<!-- To eliminate confusion, we force recompilation whenever this is invoked -->
<delete>
<fileset dir="classes/base-${platform-tag}" includes="**/*" />
<fileset dir="classes/test-${platform-tag}" includes="**/*" />
</delete>

<javac srcdir="src-${platform-tag}" destdir="classes/base-${platform-tag}"
source="${source-version}" target="${source-version}" release="10"
sourcepath="" includeAntRuntime="no"
executable="javac" fork="yes" memoryMaximumSize="512M"
debug="on" optimize="off" deprecation="on">
<classpath>
<pathelement path="${extra-classpath}" />
Expand Down Expand Up @@ -1067,7 +1121,7 @@

<target name="assert-drjava-jar-exists">
<available property="drjava-jar-exists" file="${drjava-jar}" />
<fail message="${drjava-jar} does not exist" unless="drjava-jar-exists" />
<fail message="${drjava-jar} does not exist, env is ${env} enviroment is ${environment}" unless="drjava-jar-exists" />
</target>

<target name="resolve-development-value">
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
100 changes: 73 additions & 27 deletions platform/src-mac/edu/rice/cs/drjava/platform/MacPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@

package edu.rice.cs.drjava.platform;

import java.awt.desktop.*;
import java.net.URL;
import com.apple.eawt.*;
//import com.apple.eawt.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.*;
Expand Down Expand Up @@ -96,18 +97,30 @@ public void beforeUISetup() {
System.setProperty("apple.laf.useScreenMenuBar","true");

// needs to be done here, otherwise the event gets lost
ApplicationListener appListener = new ApplicationAdapter() {
public void handleOpenFile(ApplicationEvent event) {
if (event.getFilename()!=null) {
edu.rice.cs.drjava.DrJavaRoot.handleRemoteOpenFile(new java.io.File(event.getFilename()), -1);
event.setHandled(true);
// ApplicationListener appListener = new ApplicationAdapter() {
// public void handleOpenFile(ApplicationEvent event) {
// if (event.getFilename()!=null) {
// edu.rice.cs.drjava.DrJavaRoot.handleRemoteOpenFile(new java.io.File(event.getFilename()), -1);
// event.setHandled(true);
// }
// }
// };
//
// // Register the ApplicationListener.
// Application appl = new Application();
// appl.addApplicationListener(appListener);

Desktop d = Desktop.getDesktop();
d.setOpenFileHandler(new OpenFilesHandler() {
@Override
public void openFiles(OpenFilesEvent e) {
if (e.getSearchTerm()!= null) {
edu.rice.cs.drjava.DrJavaRoot.handleRemoteOpenFile(new java.io.File(e.getSearchTerm()), -1);
}
}
};

// Register the ApplicationListener.
Application appl = new Application();
appl.addApplicationListener(appListener);
});


}

/**
Expand All @@ -118,36 +131,69 @@ public void handleOpenFile(ApplicationEvent event) {
* @param quit the Action associated with quitting the DrJava application
*/
public void afterUISetup(final Action about, final Action prefs, final Action quit) {
ApplicationListener appListener = new ApplicationAdapter() {
public void handleAbout(ApplicationEvent e) {
// ApplicationListener appListener = new ApplicationAdapter() {
// public void handleAbout(ApplicationEvent e) {
// about.actionPerformed(new ActionEvent(this, 0, "About DrJava"));
// e.setHandled(true);
// }
//
// public void handlePreferences(ApplicationEvent e) {
// prefs.actionPerformed(new ActionEvent(this, 0, "Preferences..."));
// e.setHandled(true);
// }
//
// public void handleQuit(ApplicationEvent e) {
// // Workaround for 2868805: show modal dialogs in a separate thread.
// // This encapsulation is not necessary in 10.2, but will not break either.
// final ApplicationEvent ae = e;
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// quit.actionPerformed(new ActionEvent(this, 0, "Quit DrJava"));
// ae.setHandled(true);
// }
// });
// }
// };
//
// // Register the ApplicationListener.
// Application appl = new Application();
// appl.setEnabledPreferencesMenu(true);
// appl.addApplicationListener(appListener);

Desktop d = Desktop.getDesktop();
d.setAboutHandler(new AboutHandler() {
@Override
public void handleAbout(AboutEvent e) {
about.actionPerformed(new ActionEvent(this, 0, "About DrJava"));
e.setHandled(true);
}

public void handlePreferences(ApplicationEvent e) {
});

d.setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(PreferencesEvent e) {
prefs.actionPerformed(new ActionEvent(this, 0, "Preferences..."));
e.setHandled(true);
}
});

d.setQuitHandler(new QuitHandler() {
@Override
public void handleQuitRequestWith(QuitEvent e, QuitResponse response) {

public void handleQuit(ApplicationEvent e) {
// Workaround for 2868805: show modal dialogs in a separate thread.
// This encapsulation is not necessary in 10.2, but will not break either.
final ApplicationEvent ae = e;
final QuitEvent ae = e;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
quit.actionPerformed(new ActionEvent(this, 0, "Quit DrJava"));
ae.setHandled(true);
}
});

}
};
});


// Register the ApplicationListener.
Application appl = new Application();
appl.setEnabledPreferencesMenu(true);
appl.addApplicationListener(appListener);

}


/**
* Returns whether this is a Mac platform.
*/
Expand Down