From 5f3d17604550e657a5e1252c0e27109803d59381 Mon Sep 17 00:00:00 2001 From: Jonas Tobias Hopusch Date: Fri, 28 Jan 2022 01:10:46 +0100 Subject: [PATCH 1/3] Stop excluding gradle directory --- .gitignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a1f8656..70a4e08 100644 --- a/.gitignore +++ b/.gitignore @@ -31,9 +31,8 @@ hs_err_pid* build # Ignore gradle wrapper -/gradle -/gradlew -/gradlew.bat +gradlew +gradlew.bat # Ignore manual compilation results /de/jotoho/ From 6b064eb80690dc3475d9ad12afdc839923f65381 Mon Sep 17 00:00:00 2001 From: Jonas Tobias Hopusch Date: Fri, 28 Jan 2022 01:13:46 +0100 Subject: [PATCH 2/3] Define gradle version in gradle-wrapper.properties --- gradle/wrapper/gradle-wrapper.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 gradle/wrapper/gradle-wrapper.properties diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..329f10c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip From 28a461b8fcdf72e970e61372b19e615317e989d0 Mon Sep 17 00:00:00 2001 From: Jonas Tobias Hopusch Date: Fri, 28 Jan 2022 02:06:45 +0100 Subject: [PATCH 3/3] Remove fat jar module and use java standard library Removes usage of org.apache.commons classes and instead relies on functionality of Java itself. It also removes the now-unnecessary plugin dependency for shadowJars. --- build.gradle.kts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c5bd21b..281b392 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,16 +1,24 @@ +import java.io.ByteArrayOutputStream +import java.io.OutputStream + plugins { // Apply the application plugin to add support for building a CLI application in Java. application + java +} - // For generating fat jars - id("com.github.johnrengelman.shadow") version "latest.release" +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() } fun versionBanner(): String { - val os = org.apache.commons.io.output.ByteArrayOutputStream() + val os = ByteArrayOutputStream() + val devNull = OutputStream.nullOutputStream() project.exec { - commandLine = "git describe --always --dirty".split(" ") + commandLine = "git describe --tags --always --dirty --abbrev".split(" ") standardOutput = os + errorOutput = devNull } return String(os.toByteArray()).trim() } @@ -18,11 +26,6 @@ fun versionBanner(): String { group = "de.jotoho" version = versionBanner() -repositories { - // Use Maven Central for resolving dependencies. - mavenCentral() -} - java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17