Skip to content

Commit

Permalink
build.gradle: upgrade to use Java 9
Browse files Browse the repository at this point in the history
The project currently runs on Java 8.

We should ensure compatibility with the latest public version as soon
as it is out.

Let's upgrade the project to run on Java 9 and update the documentation
accordingly.

Some of the properties in gradle.properties are no longer supported.
As PermGen has been replaced with Metaspace, -XX:MaxPermSize=size has
ceased support [1] and has been replaced with -XX:MaxMetaspaceSize [2].
Also, -XX:CMSPermGenSweepingEnabled has been superseded by
-XX:+CMSClassUnloadingEnabled and removed in JDK 9 [3][4].
-XX:+CMSClassUnloadingEnabled however, is useless now. When PermGen was
used previously, this command line argument ensured that PermGen was
garbage collected [5]. However, Metaspace is automatically garbage
collected [6], therefore there's no replacement for this argument.
Let's remove or update these properties accordingly.

Travis & AppVeyor are building the project using JDK 8. Since we are
now running on Java 9, let's update them to build the project using
JDK 9.

To run tests using TestFX on Java 9, we have to update the dependencies
in build.gradle. Let's update it according to TestFX's
documentation [7].

Java 9 introduces a module system, causing internal packages such as
javax.* and com.sun.* packages to be inaccessible. As our project uses
these packages, our code is no longer compilable. Let's update
build.gradle to import these modules.

[1]: https://docs.oracle.com/javase/9/migrate/toc.htm
[2]: http://java-latte.blogspot.sg/2014/03/metaspace-in-java-8.html
[3]: http://www.oracle.com/technetwork/java/javase/9-removed-features-3745614.html
[4]: https://stackoverflow.com/questions/3717937/cmspermgensweepingenabled-vs-cmsclassunloadingenabled
[5]: https://stackoverflow.com/questions/3334911/what-does-jvm-flag-cmsclassunloadingenabled-actually-do
[6]: http://kkgulati.blogspot.sg/2014/09/java-8-memory-model-metaspace.html
[7]: https://github.com/TestFX/TestFX#java-9
  • Loading branch information
Zhiyuan-Amos committed Mar 17, 2018
1 parent e4ddf53 commit 889a105
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: java
matrix:
include:
- jdk: oraclejdk8
- jdk: oraclejdk9

script: >-
./config/travis/run-checks.sh &&
Expand All @@ -17,7 +17,7 @@ deploy:
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java9-installer

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_script:
- appveyor-retry gradlew.bat --no-daemon headless allTests

environment:
JAVA_HOME: C:\Program Files\Java\jdk1.8.0 # Use 64-bit Java
JAVA_HOME: C:\Program Files\Java\jdk9 # Use 64-bit Java

# Files/folders to preserve between builds to speed them up
cache:
Expand Down
20 changes: 14 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ plugins {
// Specifies the entry point of the application
mainClassName = 'seedu.address.MainApp'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9

repositories {
mavenCentral()
Expand All @@ -39,21 +39,29 @@ jacocoTestReport {
}

dependencies {
String testFxVersion = '4.0.7-alpha'
String testFxVersion = '4.0.12-alpha'

compile group: 'org.fxmisc.easybind', name: 'easybind', version: '1.0.3'
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.8'
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'
compile group: 'javax.activation', name: 'activation', version: '1.1.1'

testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion
testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion, {
exclude group: 'org.testfx', module: 'testfx-internal-java8'
}
testCompile group: 'org.testfx', name: 'testfx-junit', version: testFxVersion
testCompile group: 'org.testfx', name: 'testfx-legacy', version: testFxVersion, {
testCompile group: 'org.testfx', name: 'testfx-legacy', version: '4.0.8-alpha', {
exclude group: 'junit', module: 'junit'
}
testCompile group: 'org.testfx', name: 'openjfx-monocle', version: '1.8.0_20'

testRuntime group: 'org.testfx', name: 'testfx-internal-java9', version: testFxVersion
testRuntime group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181'
}

shadowJar {
Expand Down
10 changes: 2 additions & 8 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT`

=== Prerequisites

. *JDK `1.8.0_60`* or later
+
[NOTE]
Having any Java 8 version is not enough. +
This app will not work with earlier versions of Java 8.
+

. *JDK `9`* or later
. *IntelliJ* IDE
+
[NOTE]
Expand Down Expand Up @@ -849,7 +843,7 @@ _{More to be added}_
[appendix]
== Non Functional Requirements

. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `1.8.0_60` or higher installed.
. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `9` or higher installed.
. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.

Expand Down
7 changes: 1 addition & 6 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ AddressBook Level 4 (AB4) is for those who *prefer to use a desktop app for mana

== Quick Start

. Ensure you have Java version `1.8.0_60` or later installed in your Computer.
+
[NOTE]
Having any Java 8 version is not enough. +
This app will not work with earlier versions of Java 8.
+
. Ensure you have Java version `9` or later installed in your Computer.
. Download the latest `addressbook.jar` link:{repoURL}/releases[here].
. Copy the file to the folder you want to use as the home folder for your Address Book.
. Double-click the file to start the app. The GUI should appear in a few seconds.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8

0 comments on commit 889a105

Please sign in to comment.