From 747d08d354202dcd639644da7ec9094a68b0f737 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 3 Aug 2024 17:13:01 +0200 Subject: [PATCH] Rename git and gradle properties files Useful in case the application bundles it's own files to avoid engine crashes and file name conflicts --- base/build.gradle | 4 ++-- .../main/java/de/staropensource/sosengine/base/Engine.java | 1 - .../sosengine/base/data/information/EngineInformation.java | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/base/build.gradle b/base/build.gradle index 1a83580..b5e0a34 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -69,7 +69,7 @@ delombok.doLast { // for inclusion in final build tasks.register("copyGradleProperties") { doFirst { - File target = file("${project.projectDir}/src/main/resources/gradle.properties") + File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties") File source = file(project(":").projectDir.getPath() + "/gradle.properties") target.delete() Files.copy(source.toPath(), target.toPath()) @@ -92,7 +92,7 @@ gitProperties { tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build doLast { - File target = file("${project.projectDir}/src/main/resources/git.properties") + File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties") File source = file("${project.projectDir}/build/resources/main/git.properties") target.delete() diff --git a/base/src/main/java/de/staropensource/sosengine/base/Engine.java b/base/src/main/java/de/staropensource/sosengine/base/Engine.java index 1a9d1b9..39492b8 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/Engine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/Engine.java @@ -156,7 +156,6 @@ public final class Engine extends SubsystemClass { * @since v1-alpha0 */ public Engine() { - // Only allow one instance if (instance == null) instance = this; else diff --git a/base/src/main/java/de/staropensource/sosengine/base/data/information/EngineInformation.java b/base/src/main/java/de/staropensource/sosengine/base/data/information/EngineInformation.java index f51e3f8..8f8d5f7 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/data/information/EngineInformation.java +++ b/base/src/main/java/de/staropensource/sosengine/base/data/information/EngineInformation.java @@ -322,7 +322,7 @@ public final class EngineInformation { public static synchronized void updateVariables() { // Load properties from bundled gradle.properties Properties gradleProperties = new Properties(); - InputStream gradleStream = EngineInformation.class.getClassLoader().getResourceAsStream("gradle.properties"); + InputStream gradleStream = EngineInformation.class.getClassLoader().getResourceAsStream("sosengine-gradle.properties"); if (gradleStream == null) { System.out.println("Unable to load build information: The bundled gradle.properties file could not be found."); @@ -344,7 +344,7 @@ public final class EngineInformation { // Load properties from bundled git.properties // or fill in blank information if file missing Properties gitProperties = new Properties(); - InputStream gitStream = EngineInformation.class.getClassLoader().getResourceAsStream("git.properties"); + InputStream gitStream = EngineInformation.class.getClassLoader().getResourceAsStream("sosengine-git.properties"); if (gitStream == null) { logger.error("Unable to load build information: The bundled git.properties file could not be found. Did you download a tarball?");