Skip to content

Commit 6eb61f0

Browse files
authored
chore: upgrade to gradle 8 (#322)
Upgraded several plugins to support using gradle 8 - launch4j - shadow
1 parent ed09c64 commit 6eb61f0

File tree

14 files changed

+260
-197
lines changed

14 files changed

+260
-197
lines changed
+20-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
name: Java Build
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
branches: ["main", "master"]
6+
push:
7+
branches: ["main", "master"]
48

59
jobs:
610
build:
711
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
java: ["17"]
11-
name: Java ${{ matrix.java }} Build
12+
name: Java Build
1213
steps:
1314
- uses: actions/checkout@v4
1415

15-
- name: Set up JDK ${{ matrix.java }}
16+
- name: Setup Java
1617
uses: actions/setup-java@v4
1718
with:
18-
distribution: "zulu"
19-
java-version: ${{ matrix.java }}
20-
java-package: jdk+fx
21-
cache: "gradle"
19+
distribution: "temurin"
20+
java-version: 21
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v4
2223

23-
- name: <>-- Build --<>
24-
run: ./gradlew build createAllExecutables --no-daemon
24+
- name: <>-- Test --<>
25+
run: ./gradlew test
26+
27+
- name: <>-- Create Windows Executables --<>
28+
run: ./gradlew createExe
29+
30+
- name: <>-- Assemble --<>
31+
run: ./gradlew assembleGithubArtifacts
2532

2633
- uses: actions/upload-artifact@v4
2734
with:
2835
name: Executables
29-
path: build/launch4j
36+
path: publish/github

build-gui/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
plugins {
22
id "java"
33
id "application"
4-
id "edu.sc.seis.launch4j" version "2.5.4"
4+
id "edu.sc.seis.launch4j" version "3.0.6"
55
id "org.openjfx.javafxplugin" version "0.1.0"
6-
id "com.github.johnrengelman.shadow" version "7.1.2"
6+
id "com.gradleup.shadow" version "8.3.5"
77
}
88

99
group = ss_group
@@ -69,12 +69,12 @@ shadowJar {
6969
}
7070
}
7171

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

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

8989

@@ -108,7 +108,7 @@ distributions {
108108
tasks.register("assembleGithubArtifacts", Copy) {
109109
group = "distribution"
110110
dependsOn createExe
111-
from layout.buildDirectory.dir("launch4j/lib"), layout.buildDirectory.file("launch4j")
111+
from layout.buildDirectory.dir("libs"), layout.buildDirectory.file("launch4j")
112112
into file("$rootDir/publish/github")
113113
exclude "lib"
114114
}

build-server/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
22
id "java"
33
id "application"
4-
id "edu.sc.seis.launch4j" version "2.5.4"
5-
id "com.github.johnrengelman.shadow" version "7.1.2"
4+
id "edu.sc.seis.launch4j" version "3.0.6"
5+
id "com.gradleup.shadow" version "8.3.5"
66
}
77

88
group = ss_group
@@ -55,13 +55,13 @@ shadowJar {
5555
}
5656
}
5757

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

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

7676
distZip {
@@ -94,7 +94,7 @@ distributions {
9494
tasks.register("assembleGithubArtifacts", Copy) {
9595
group = "distribution"
9696
dependsOn createExe
97-
from layout.buildDirectory.dir("launch4j/lib"), layout.buildDirectory.file("launch4j")
97+
from layout.buildDirectory.dir("libs"), layout.buildDirectory.file("launch4j")
9898
into file("$rootDir/publish/github")
9999
exclude "lib"
100100
}

build-shared/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'java-library'
2+
id "java-library"
33
}
44

55
repositories {
@@ -10,13 +10,13 @@ group = ss_group
1010
version = "5.0.0"
1111

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

1616
// Use JUnit Jupiter API for testing.
17-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2', 'org.junit.jupiter:junit-jupiter-params:5.8.2'
17+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2", "org.junit.jupiter:junit-jupiter-params:5.8.2"
1818
// Use JUnit Jupiter Engine for testing.
19-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2', 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
19+
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"
2020
}
2121

2222
java {
@@ -26,8 +26,8 @@ java {
2626
}
2727

2828
jar {
29-
archiveBaseName = 'server-sync'
30-
archiveClassifier = 'shared'
29+
archiveBaseName = "server-sync"
30+
archiveClassifier = "shared"
3131
}
3232

3333
test {

build-shared/logs/serversync-testing.log.1

Whitespace-only changes.

build-shared/logs/serversync-testing.log.2

Whitespace-only changes.

build-shared/logs/serversync-testing.log.3

Whitespace-only changes.

build-shared/src/main/java/com/superzanti/serversync/config/SyncConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SyncConfig {
3131

3232
// SERVER //////////////////////////////
3333
public int SERVER_PORT = 38067;
34-
public Boolean PUSH_CLIENT_MODS = false;
34+
public boolean PUSH_CLIENT_MODS = false;
3535
public List<String> FILE_INCLUDE_LIST = Collections.singletonList("mods/**");
3636
public List<DirectoryEntry> DIRECTORY_INCLUDE_LIST = Collections.singletonList(new DirectoryEntry(
3737
"mods",
@@ -42,7 +42,7 @@ public class SyncConfig {
4242
////////////////////////////////////////
4343

4444
// CLIENT //////////////////////////////
45-
public Boolean REFUSE_CLIENT_MODS = false;
45+
public boolean REFUSE_CLIENT_MODS = false;
4646
////////////////////////////////////////
4747

4848
private static SyncConfig singleton;

build-shared/src/test/java/com/superzanti/serversync/server/ServerSetupTests.java

+13-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.junit.jupiter.api.DisplayName;
99
import org.junit.jupiter.api.Test;
1010

11-
import java.util.ArrayList;
11+
import java.util.List;
1212

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

29-
// @Test
30-
// @DisplayName("Construction")
31-
// void construction() {
32-
//// ServerSetup setup = new ServerSetup();
33-
// }
34-
3526
@Test
3627
@DisplayName("Questions")
37-
void shouldPushClientOnlyFiles() {
38-
config.PUSH_CLIENT_MODS = false;
28+
void shouldPushClientOnlyFilesWhenPushClientModsIsTrue() {
29+
SyncConfig.getConfig().DIRECTORY_INCLUDE_LIST = List.of();
30+
SyncConfig.getConfig().PUSH_CLIENT_MODS = true;
3931
ServerSetup setup = new ServerSetup();
4032

41-
assertFalse(setup.shouldPushClientOnlyFiles());
33+
assertTrue(setup.shouldPushClientOnlyFiles());
34+
}
4235

43-
config.PUSH_CLIENT_MODS = true;
44-
setup = new ServerSetup();
36+
@Test
37+
@DisplayName("Questions")
38+
void shouldNotPushClientOnlyFilesWhenPushClientModsIsFalse() {
39+
SyncConfig.getConfig().DIRECTORY_INCLUDE_LIST = List.of();
40+
SyncConfig.getConfig().PUSH_CLIENT_MODS = false;
41+
ServerSetup setupTrue = new ServerSetup();
4542

46-
assertTrue(setup.shouldPushClientOnlyFiles());
43+
assertFalse(setupTrue.shouldPushClientOnlyFiles());
4744
}
4845
}

gradle/wrapper/gradle-wrapper.jar

-11.9 KB
Binary file not shown.
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)