From 3a2435b1e8415daff633c746807b993e6672e59b Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 4 Jul 2023 19:19:11 +0200 Subject: [PATCH 1/3] Activate fabric-loom multi project optimisation --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9dcf69e..11f5772 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx3G - +fabric.loom.multiProjectOptimisation=true junit_version=5.9.0 minecraft_version=1.19.3 From 362de5e40dd8142a845a5660be144889ef86a911 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Thu, 20 Jul 2023 19:17:19 +0200 Subject: [PATCH 2/3] Finally, fix deploy task, it works --- .../DedicatedServerTask.java} | 17 +++++++++++------ Tasks/src/main/resources/fabric.mod.json | 4 ++-- build.gradle | 18 +++++++++++++++--- gradle.properties | 3 +-- 4 files changed, 29 insertions(+), 13 deletions(-) rename Tasks/src/main/java/fr/altarik/toolbox/task/{Task.java => server/DedicatedServerTask.java} (78%) diff --git a/Tasks/src/main/java/fr/altarik/toolbox/task/Task.java b/Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java similarity index 78% rename from Tasks/src/main/java/fr/altarik/toolbox/task/Task.java rename to Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java index f2d163a..29b4785 100644 --- a/Tasks/src/main/java/fr/altarik/toolbox/task/Task.java +++ b/Tasks/src/main/java/fr/altarik/toolbox/task/server/DedicatedServerTask.java @@ -1,22 +1,26 @@ -package fr.altarik.toolbox.task; +package fr.altarik.toolbox.task.server; +import fr.altarik.toolbox.task.PeriodicTaskI; +import fr.altarik.toolbox.task.TaskI; import fr.altarik.toolbox.task.async.AsyncPeriodicTasks; import fr.altarik.toolbox.task.async.AsyncTaskI; import fr.altarik.toolbox.task.async.AsyncTasks; import fr.altarik.toolbox.task.sync.PeriodicSyncTask; -import net.fabricmc.api.ModInitializer; +import net.fabricmc.api.DedicatedServerModInitializer; -public class Task implements ModInitializer { +public class DedicatedServerTask implements DedicatedServerModInitializer { + @SuppressWarnings("unused") public final TaskI asyncWorkers = AsyncTasks.initialize(); + @SuppressWarnings("unused") public final PeriodicTaskI periodicSyncTask = PeriodicSyncTask.initialize(); - + @SuppressWarnings("unused") public final AsyncTaskI asyncTasks = AsyncTasks.initialize(); - + @SuppressWarnings("unused") public final PeriodicTaskI periodicAsyncTask = AsyncPeriodicTasks.initialize(); @Override - public void onInitialize() { + public void onInitializeServer() { /* try { asyncWorkers.addTask(new AltarikRunnable() { @Override @@ -47,6 +51,7 @@ public class Task implements ModInitializer { } */ } + @SuppressWarnings("unused") public TaskI getAsyncWorkers() { return asyncWorkers; } diff --git a/Tasks/src/main/resources/fabric.mod.json b/Tasks/src/main/resources/fabric.mod.json index 853c737..a03be36 100644 --- a/Tasks/src/main/resources/fabric.mod.json +++ b/Tasks/src/main/resources/fabric.mod.json @@ -17,8 +17,8 @@ "icon": "assets/tasks/icon.png", "environment": "*", "entrypoints": { - "main": [ - "fr.altarik.toolbox.task.Task" + "server": [ + "fr.altarik.toolbox.task.server.DedicatedServerTask" ] }, "mixins": [ diff --git a/build.gradle b/build.gradle index 333cd5f..62577a5 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,10 @@ plugins { } Properties local = new Properties() -local.load(new FileInputStream(rootProject.file("local.properties"))) +try { + local.load(new FileInputStream(rootProject.file("local.properties"))) +} catch (IOException ignored) {} + allprojects { apply plugin: 'maven-publish' @@ -42,8 +45,8 @@ allprojects { name 'altarik' url 'https://repo.altarik.fr/'.concat(project.version.endsWith('SNAPSHOT') ? 'snapshots/' : 'releases/') credentials { - username = System.getProperty("REPO_USERNAME", local.getProperty("repo_username")) - password = System.getProperty("REPO_PASSWORD", local.getProperty("repo_password")) + username = getEnv("REPO_USERNAME", local.getProperty("repo_username")) + password = getEnv("REPO_PASSWORD", local.getProperty("repo_password")) } } } @@ -98,6 +101,15 @@ dependencies { implementation subprojects.collect { project -> project } } +static def getEnv(String envName, String defaultValue) { + String r = System.getenv(envName); + if(r != null) { + return r; + } else { + return defaultValue; + } +} + /*jar { dependsOn subprojects.jar subprojects.each { project -> diff --git a/gradle.properties b/gradle.properties index 11f5772..72cb25d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,5 +8,4 @@ loader_version=0.14.14 fabric_version=0.75.1+1.19.3 maven_group=fr.altarik.toolbox -maven_version=4.3.0-SNAPSHOT -repo_username=Altarik +maven_version=4.3.1-SNAPSHOT From 3ad8323085dcf0a7bae3829d672d664d6fe53a6e Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Thu, 20 Jul 2023 19:17:58 +0200 Subject: [PATCH 3/3] Remove unnecessary semicolon --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 62577a5..51d2d7b 100644 --- a/build.gradle +++ b/build.gradle @@ -102,11 +102,11 @@ dependencies { } static def getEnv(String envName, String defaultValue) { - String r = System.getenv(envName); + String r = System.getenv(envName) if(r != null) { - return r; + return r } else { - return defaultValue; + return defaultValue } }