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

chore: upgrade to gradle 8 #322

Merged
merged 19 commits into from
Jan 24, 2025
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions .github/workflows/serversync-build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
name: Java Build

on: [push]
on:
pull_request:
branches: ["main", "master"]
push:
branches: ["main", "master"]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ["17"]
name: Java ${{ matrix.java }} Build
name: Java Build
steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: ${{ matrix.java }}
java-package: jdk+fx
cache: "gradle"
distribution: "temurin"
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: <>-- Build --<>
run: ./gradlew build createAllExecutables --no-daemon
- name: <>-- Test --<>
run: ./gradlew test

- name: <>-- Create Windows Executables --<>
run: ./gradlew createExe

- name: <>-- Assemble --<>
run: ./gradlew assembleGithubArtifacts

- uses: actions/upload-artifact@v4
with:
name: Executables
path: build/launch4j
path: publish/github
14 changes: 7 additions & 7 deletions build-gui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id "java"
id "application"
id "edu.sc.seis.launch4j" version "2.5.4"
id "edu.sc.seis.launch4j" version "3.0.6"
id "org.openjfx.javafxplugin" version "0.1.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.gradleup.shadow" version "8.3.5"
}

group = ss_group
Expand Down Expand Up @@ -69,12 +69,12 @@ shadowJar {
}
}

createExe {
jarTask = shadowJar
launch4j {
jarTask = project.tasks.shadowJar
mainClassName = ss_main_class
outfile = "ServerSyncClient.exe"
icon = "${rootDir}/build-shared/src/main/resources/ServersyncLogo.ico"
copyConfigurable = shadowJar.outputs.files
copyConfigurable = []
supportUrl = "https://github.com/superzanti/ServerSync"
productName = "ServerSync - Client"
fileDescription = "The client side for users."
Expand All @@ -83,7 +83,7 @@ createExe {

startScripts {
dependsOn shadowJar
classpath = files(classpath = files("${buildDir}/libs/${project.name}-${project.version}.jar"))
classpath = files(classpath = files("${layout.buildDirectory.get()}/libs/${project.name}-${project.version}.jar"))
}


Expand All @@ -108,7 +108,7 @@ distributions {
tasks.register("assembleGithubArtifacts", Copy) {
group = "distribution"
dependsOn createExe
from layout.buildDirectory.dir("launch4j/lib"), layout.buildDirectory.file("launch4j")
from layout.buildDirectory.dir("libs"), layout.buildDirectory.file("launch4j")
into file("$rootDir/publish/github")
exclude "lib"
}
Expand Down
12 changes: 6 additions & 6 deletions build-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "java"
id "application"
id "edu.sc.seis.launch4j" version "2.5.4"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "edu.sc.seis.launch4j" version "3.0.6"
id "com.gradleup.shadow" version "8.3.5"
}

group = ss_group
Expand Down Expand Up @@ -55,13 +55,13 @@ shadowJar {
}
}

createExe {
launch4j {
jarTask = shadowJar
mainClassName = ss_main_class
outfile = "ServerSyncServer.exe"
headerType = "console"
icon = "${rootDir}/build-shared/src/main/resources/ServersyncLogoServer.ico"
copyConfigurable = shadowJar.outputs.files
copyConfigurable = []
supportUrl = "https://github.com/superzanti/ServerSync"
productName = "ServerSync - Server"
fileDescription = "The server side for admins."
Expand All @@ -70,7 +70,7 @@ createExe {

startScripts {
dependsOn shadowJar
classpath = files(classpath = files("${buildDir}/libs/${project.name}-${project.version}.jar"))
classpath = files(classpath = files("${layout.buildDirectory.get()}/libs/${project.name}-${project.version}.jar"))
}

distZip {
Expand All @@ -94,7 +94,7 @@ distributions {
tasks.register("assembleGithubArtifacts", Copy) {
group = "distribution"
dependsOn createExe
from layout.buildDirectory.dir("launch4j/lib"), layout.buildDirectory.file("launch4j")
from layout.buildDirectory.dir("libs"), layout.buildDirectory.file("launch4j")
into file("$rootDir/publish/github")
exclude "lib"
}
Expand Down
14 changes: 7 additions & 7 deletions build-shared/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'java-library'
id "java-library"
}

repositories {
Expand All @@ -10,13 +10,13 @@ group = ss_group
version = "5.0.0"

dependencies {
implementation 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
implementation fileTree(dir: 'libs', include: '*.jar')
implementation "com.eclipsesource.minimal-json:minimal-json:0.9.5"
implementation fileTree(dir: "libs", include: "*.jar")

// Use JUnit Jupiter API for testing.
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2', 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2", "org.junit.jupiter:junit-jupiter-params:5.8.2"
// Use JUnit Jupiter Engine for testing.
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2', 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2", "com.eclipsesource.minimal-json:minimal-json:0.9.5", "org.junit.platform:junit-platform-launcher"
}

java {
Expand All @@ -26,8 +26,8 @@ java {
}

jar {
archiveBaseName = 'server-sync'
archiveClassifier = 'shared'
archiveBaseName = "server-sync"
archiveClassifier = "shared"
}

test {
Expand Down
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class SyncConfig {

// SERVER //////////////////////////////
public int SERVER_PORT = 38067;
public Boolean PUSH_CLIENT_MODS = false;
public boolean PUSH_CLIENT_MODS = false;
public List<String> FILE_INCLUDE_LIST = Collections.singletonList("mods/**");
public List<DirectoryEntry> DIRECTORY_INCLUDE_LIST = Collections.singletonList(new DirectoryEntry(
"mods",
Expand All @@ -42,7 +42,7 @@ public class SyncConfig {
////////////////////////////////////////

// CLIENT //////////////////////////////
public Boolean REFUSE_CLIENT_MODS = false;
public boolean REFUSE_CLIENT_MODS = false;
////////////////////////////////////////

private static SyncConfig singleton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -21,28 +21,25 @@ public class ServerSetupTests {
void init() {
ServerSyncUtility.MODE = EServerMode.SERVER;
Logger.instantiate("testing");
config = SyncConfig.getConfig();
config.DIRECTORY_INCLUDE_LIST = new ArrayList<>();
config.PUSH_CLIENT_MODS = false;
}

// @Test
// @DisplayName("Construction")
// void construction() {
//// ServerSetup setup = new ServerSetup();
// }

@Test
@DisplayName("Questions")
void shouldPushClientOnlyFiles() {
config.PUSH_CLIENT_MODS = false;
void shouldPushClientOnlyFilesWhenPushClientModsIsTrue() {
SyncConfig.getConfig().DIRECTORY_INCLUDE_LIST = List.of();
SyncConfig.getConfig().PUSH_CLIENT_MODS = true;
ServerSetup setup = new ServerSetup();

assertFalse(setup.shouldPushClientOnlyFiles());
assertTrue(setup.shouldPushClientOnlyFiles());
}

config.PUSH_CLIENT_MODS = true;
setup = new ServerSetup();
@Test
@DisplayName("Questions")
void shouldNotPushClientOnlyFilesWhenPushClientModsIsFalse() {
SyncConfig.getConfig().DIRECTORY_INCLUDE_LIST = List.of();
SyncConfig.getConfig().PUSH_CLIENT_MODS = false;
ServerSetup setupTrue = new ServerSetup();

assertTrue(setup.shouldPushClientOnlyFiles());
assertFalse(setupTrue.shouldPushClientOnlyFiles());
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion 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.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading