Skip to content

Commit

Permalink
[#2177] Migrate to Java 11 Syntax and Features (#2183)
Browse files Browse the repository at this point in the history
* Migrate CI/CD to Java 11

* Update Docs to reflect Java 11

* Update CI JDK version

* Update checkstyle tool

* Revert "Update CI JDK version"

The updating of the Checkstyle tool will be deferred
to another PR to avoid causing dependency issues
arising from backwards compatibility.

* Reapply "Update CI JDK version"

Reapplying revert action as it was reverted on
the wrong commit.

* Revert "Update checkstyle tool"

The updating of the Checkstyle tool will be deferred
to another PR to avoid causing dependency issues
arising from backwards compatibility.

* Remove deprecated flags

---------

Co-authored-by: Ryan Poon <[email protected]>
  • Loading branch information
georgetayqy and sopa301 authored Apr 27, 2024
1 parent 693f17d commit a25630e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ on:
env:
NODE_VER: '18.x'
JAVA_DISTRIBUTION: 'zulu'
JAVA_VER: 8
JAVA_VER: 11

jobs:
mainbuild:
name: ${{ matrix.os }} JDK 8
name: ${{ matrix.os }} JDK 11
strategy:
fail-fast: false
matrix:
Expand All @@ -32,7 +32,7 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
Expand Down
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ mainClassName = 'reposense.RepoSense'

node.download = false // The Liferay Node Gradle Plugin will use the system PATH to find the Node/npm executable.

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
Expand Down Expand Up @@ -199,8 +199,6 @@ def serveTestReportInBackground = tasks.register('serveTestReportInBackground',
args = ['--config', './exampleconfig', '--since', 'd1', '--view']
String versionJvmArgs = '-Dversion=' + getRepoSenseVersion()
jvmArgs = [ versionJvmArgs ]
killDescendants = false // Kills descendants of started process using methods only found in Java 9 and beyond.
// Above flag is set to true by default but is incompatible with Java 8. It should be removed from this file if we fully migrate to Java 11.
waitForPort = 9000
}

Expand Down
4 changes: 2 additions & 2 deletions docs/dg/devOpsGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ This page documents the various components that form part of the DevOps infrastr

All three types of tests in the test suite are run in a single GitHub Actions workflow called "Continuous Integration". The steps are defined in [`integration.yml`](https://github.com/reposense/RepoSense/blob/master/.github/workflows/integration.yml) and are split into two types of jobs:

1. Ubuntu/macOS/Windows JDK 8 (`mainbuild`): Runs both unit tests and system tests on JDK 1.8 running on supported Ubuntu, macOS and Windows versions. For Ubuntu, this job also produces a RepoSense report and the MarkBind documentation website for previewing.
2. Cypress frontend tests (`cypress`): Runs only the frontend tests on JDK 1.8 running on Ubuntu.
1. Ubuntu/macOS/Windows JDK 11 (`mainbuild`): Runs both unit tests and system tests on JDK 11 running on supported Ubuntu, macOS and Windows versions. For Ubuntu, this job also produces a RepoSense report and the MarkBind documentation website for previewing.
2. Cypress frontend tests (`cypress`): Runs only the frontend tests on JDK 11 running on Ubuntu.

The list of supported OS versions are [available on the GitHub Docs website](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources). These jobs should be updated regularly whenever RepoSense supports newer versions of the Java Development Kit (JDK) as well as when new OS versions are made available (via the job OS matrix). Frontend tests are run separately to take advantage of parallel job execution.

Expand Down
4 changes: 2 additions & 2 deletions docs/dg/learningBasics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ The backend implementation of RepoSense is located in `src/main`.

{{ step(1) }} **Know Java**

The RepoSense backend is mostly written in `Java 8`.
The RepoSense backend is mostly written in `Java 11`.

1. You need to have a basic knowledge of Java before getting started, including its syntax, [API](https://docs.oracle.com/javase/8/docs/api/), and certain frameworks such as [JUnit](https://se-education.org/learningresources/contents/java/JUnit.html).
1. You need to have a basic knowledge of Java before getting started, including its syntax, [API](https://docs.oracle.com/javase/11/docs/api/), and certain frameworks such as [JUnit](https://se-education.org/learningresources/contents/java/JUnit.html).
1. Once you are familiar with the basic syntax, you may wish to learn more advanced topics such as [concurrency](https://se-education.org/learningresources/contents/java/JavaConcurrency.html), [synchronization](https://se-education.org/learningresources/contents/java/JavaSynchronization.html), and [streams](https://se-education.org/learningresources/contents/java/streams-an-introduction.html). These topics can help you to understand certain part of the backend implementation (concurrent cloning and analysis of multiple repositories, etc.). They are optional but you may find them useful when working on certain issues.

{{ step(2) }} **Learn the RepoSense backend architecture**
Expand Down
4 changes: 2 additions & 2 deletions docs/dg/projectManagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This page contains information about project management tasks. The target audien

Before making a release, please check the following prerequisites:

* Ensure that you have **JDK `1.8.0`** installed (==Not other major release versions such as **JDK `9`** or **JDK `11`**==).
* Ensure that you have **JDK `11`** installed (==Not other major release versions such as **JDK `12`** or **JDK `13`**==).
* Ensure that the `JAVA_HOME` environment variable is correctly set to your JDK installation directory. You can refer to the [JDK Installation Guide](https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html).
* Ensure that you have merged the [upstream](https://github.com/RepoSense/reposense) `master` branch into both the local and upstream `release` branch according to the following steps:
1. In your local repository, reset your `master` branch to be exactly the same as the upstream `master` branch.
Expand All @@ -43,7 +43,7 @@ Take note of the following when making the release according to the above guide:
* Before launching the release, generate the `RepoSense.jar` file and attach it to the release.
1. Switch to the `release` branch.
1. In the terminal, change the directory to the project root directory.
1. Run `gradlew --version` to check that the JDK version is 1.8.0.
1. Run `gradlew --version` to check that the JDK version is 11.
1. Run `gradlew shadowJar`, and the Jar file will be generated at `{buildDir}/jar/`.
1. Check that the Jar file is working. You may need to check that the report can be generated from the Jar file both locally and remotely by following the [Generating Reports Guide](../ug/generatingReports.html).

Expand Down
2 changes: 1 addition & 1 deletion docs/dg/settingUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h1 class="display-4"><md>{{ title }}</md></h1>

**Prerequisites:**
* **JDK `1.8.0_60`** up to **`17`** ([download :fas-download:](https://www.oracle.com/technetwork/java/javase/downloads/index.html)).
* **JDK `11.0.21+9`** up to **`17`** ([download :fas-download:](https://www.oracle.com/technetwork/java/javase/downloads/index.html)).
* **Node.js** **`18`** up to the latest minor version of **`19`** ([download :fas-download:](https://www.npmjs.com/get-npm)).
* **git `2.23`** or later ([download :fas-download:](https://git-scm.com/downloads)).

Expand Down
2 changes: 1 addition & 1 deletion docs/ug/generatingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For other types of repositories, external links are disabled.
## Generating reports locally

1. **Ensure you have the prerequisites**:
* **Java 8** (JRE `1.8.0_60`) or later ([download :fas-download:](https://www.java.com/en/)).
* **Java 11** or later ([download :fas-download:](https://www.java.com/en/)).
* **git `2.23`** or later on the command line. ([download :fas-download:](https://git-scm.com/downloads)).<br> run `git --version` in your OS terminal to confirm the version.

1. **Download the latest JAR file** from our [releases](https://github.com/reposense/RepoSense/releases/latest).
Expand Down

0 comments on commit a25630e

Please sign in to comment.