Skip to content

Commit

Permalink
Java21 (#714)
Browse files Browse the repository at this point in the history
* Fixed Short Truth Table case rule bug (#707)

* Revert "Bugfix 549 (#682)"

This reverts commit 5048ee6.

* Case rule test fix (#705)

Co-authored-by: Chase Grajeda <[email protected]>

* Rapid fix for STT case rules

Case rules broke at some point from legacy code or merge conflict. Provided is a quick fix in CaseRule and CaseRule_Generic

* Revert "Revert "Bugfix 549 (#682)"" (#706)

This reverts commit e9fe310.

---------

Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Change Java version to 21 and setup JPackage to bundle Java with the app

* Setup gradle action for java 21

* Fix distribution in gradle.yml

* Fix java version in tests

* Fix java distribution in tests

* Add jpackage task

* Add Linux to jpackage task

* Fix jpackage task

* Add java setup to jpackage tasks

* Separate build into separate tasks for different operating systems

* Fix mac jpackage not working and changed names of artifacts

* Potential macos installer build fix

* Potential macos installer build fix attempt 2

* Potential macos installer build fix attempt 3

* Add quotes around executable name for macos installer

* Add logo and shortcut prompt

* Update version in build.gradle

* Make installer name different to app (It's a weird way to do it, it renames the file in a gradle task).

* Update java-autoformat.yml

Added check to make sure the pull request is not from a fork

---------

Co-authored-by: Charles Tian <[email protected]>
Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>
Co-authored-by: charlestian23 <[email protected]>
  • Loading branch information
5 people authored Feb 21, 2024
1 parent 2190f7e commit b1e2f93
Show file tree
Hide file tree
Showing 10 changed files with 327 additions and 154 deletions.
62 changes: 57 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,82 @@ on:
pull_request:

jobs:
build:
build-ubuntu:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 21
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: JPackage
run: ./gradlew copyInstaller
- uses: actions/upload-artifact@v4
with:
name: Ubuntu-Artifact
path: installer

build-windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: JPackage
run: ./gradlew copyInstaller
- uses: actions/upload-artifact@v4
with:
name: Windows-Artifact
path: installer

build-macos:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: JPackage
run: ./gradlew copyInstaller
- uses: actions/upload-artifact@v4
with:
name: Mac Artifact
path: installer

checkstyle:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 21
distribution: temurin
- name: gradlew executable
run: chmod +x gradlew
- name: Run checkstyle
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/java-autoformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on: pull_request

jobs:
format:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ jobs:
- name: Check Out Code
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 21
distribution: temurin

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand All @@ -40,10 +41,11 @@ jobs:
- name: Check Out Code
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 21
distribution: temurin

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand All @@ -65,8 +67,8 @@ jobs:
- name: Set up JDK and Gradle on Windows
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
java-version: 21
distribution: temurin

- name: Run JUnit Tests on Windows
run: |
Expand Down
1 change: 1 addition & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 35 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ plugins {
id 'com.diffplug.spotless' version '6.25.0'
}


version '2.0.0'
version '5.3.2'

apply plugin: 'java'
apply plugin: 'application'
Expand Down Expand Up @@ -41,7 +40,7 @@ apply plugin: 'checkstyle'

mainClassName = 'edu.rpi.legup.Legup'

sourceCompatibility = 11
sourceCompatibility = 21

dependencies {
implementation 'org.jetbrains:annotations:20.1.0'
Expand Down Expand Up @@ -113,7 +112,7 @@ createExe() {
bundledJrePath = 'jre'
bundledJre64Bit = true
jdkPreference = 'preferJre'
jreMinVersion = '11'
jreMinVersion = '21'
jreRuntimeBits = '64/32'
}

Expand All @@ -138,4 +137,35 @@ task buildNativeWindows(type: Exec, dependsOn: 'createExe') {
repositories {
mavenCentral()
}
targetCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_21

tasks.register("jpackage") {
group("jpackage")
doLast {
var operatingSystem = System.getProperty("os.name").toLowerCase()
if (operatingSystem.contains("windows")) {
exec {
commandLine 'cmd', '/c', 'jpackage', '--input', 'build/libs', '--main-jar', 'Legup.jar', '--win-dir-chooser', '--win-shortcut-prompt', '--win-shortcut', '--dest', 'build/installer', '-n', "LEGUP", '--app-version', "${project.version}", '--icon', "src/main/resources/edu/rpi/legup/images/Legup/logo.ico"
}
} else if (operatingSystem.contains("linux")) {
exec {
commandLine 'sh', '-c', "jpackage --input build/libs --main-jar Legup.jar --dest build/installer -n LEGUP --icon src/main/resources/edu/rpi/legup/images/Legup/logo.ico --app-version ${project.version}"
}
} else if (operatingSystem.contains("mac")) {
exec {
commandLine 'bash', '-c', "jpackage --input build/libs --main-jar Legup.jar --dest build/installer -n \"LEGUP\" --icon src/main/resources/edu/rpi/legup/images/Legup/logo.ico --app-version ${project.version}"
}
} else {
println("JPackage task is not set up for " + System.getProperty("os.name"))
}
}
}

tasks.register('copyInstaller', Sync) {
group("jpackage")
from ("build/installer/")
into("installer")
rename("LEGUP-${project.version}", "LEGUP-installer-${project.version}")
}

copyInstaller.dependsOn(jpackage)
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 4 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Loading

0 comments on commit b1e2f93

Please sign in to comment.