Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermometer too many/few mercury #747

Merged
merged 18 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
40 changes: 40 additions & 0 deletions .github/workflows/java-autoformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Java Code Auto Format
on: pull_request

jobs:
format:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
ref: ${{ github.head_ref }}

- 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: Run spotless
run: ./gradlew :spotlessApply

- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT

- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Bram van Heuveln'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add .
git diff --cached --exit-code || git commit -am "Automated Java code formatting changes" && git push
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.

2 changes: 1 addition & 1 deletion bin/main/edu/rpi/legup/legup/config
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
<puzzle name="Skyscrapers"
qualifiedClassName="edu.rpi.legup.puzzle.skyscrapers.Skyscrapers"
fileType=".xml"
fileCreationDisabled="true"/>
fileCreationDisabled="false"/>
</puzzles>
</Legup>
75 changes: 69 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,50 @@ plugins {
id 'java'
id 'edu.sc.seis.launch4j' version '2.5.3'
id 'kr.motd.sphinx' version '2.10.0'
id 'com.diffplug.spotless' version '6.25.0'
}

version '2.0.0'
version '6.0.0'

apply plugin: 'java'
apply plugin: 'application'

spotless {
enforceCheck false

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}

java {
// Use the default importOrder configuration
importOrder()

// Cleanthat will refactor your code, but it may break your style: apply it before your formatter
cleanthat()

googleJavaFormat('1.19.2').aosp()

formatAnnotations()
}
}

apply plugin: 'checkstyle'
mainClassName = 'edu.rpi.legup.Legup'

sourceCompatibility = 11
application {
mainClass.set('edu.rpi.legup.Legup')
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

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

Expand All @@ -104,8 +138,37 @@ task buildNativeWindows(type: Exec, dependsOn: 'createExe') {
commandLine 'cmd', '/c', 'make_windows_installer.bat'
}


repositories {
mavenCentral()
}
targetCompatibility = JavaVersion.VERSION_11

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)
6 changes: 0 additions & 6 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
<module name="Checker">
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens"
value="LITERAL_IF, LITERAL_ELSE, LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, METHOD_DEF"/>
</module>
<module name="NeedBraces">
<property name="allowSingleLineStatement" value="true"/>
</module>
Expand Down
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
Loading