From 4b4b7798e65fae598958afb4e33a1d9b0938be58 Mon Sep 17 00:00:00 2001
From: Johannes Mey <johannes.mey@tu-dresden.de>
Date: Thu, 28 Oct 2021 19:05:43 +0200
Subject: [PATCH] fix jar generation of derived projects

---
 build.gradle | 46 ++++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8882de2..a607d9e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -29,15 +29,38 @@ sourceSets {
     }
 }
 
+def versionFile = 'src/main/resources/preprocessor.properties'
+def versionProps = new Properties()
+
+try {
+    file(versionFile).withInputStream { stream -> versionProps.load(stream) }
+    version = versionProps['version']
+} catch (e) {
+    // this happens, if either the properties file is not present, or cannot be read from
+    throw new GradleException("File ${versionFile} not found or unreadable. Aborting.", e)
+}
+
+task fatJar(type: Jar) {
+    group = "build"
+    archiveAppendix = "fatjar"
+    from sourceSets.main.output
+    from {
+        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+    }
+    manifest {
+        attributes "Main-Class": "${mainClassName}"
+    }
+}
+
 task modelJar(type: Jar) {
     group = "build"
-    archiveBaseName = 'model'
-    archiveVersion = ''
+    archiveAppendix = "model"
     from sourceSets.model.output
 }
 
 artifacts {
     archives modelJar
+    archives fatJar
 }
 
 dependencies {
@@ -64,25 +87,8 @@ dependencies {
     testFixturesApi group: 'commons-io', name: 'commons-io', version: '2.8.0'
 }
 
-def versionFile = 'src/main/resources/preprocessor.properties'
-def versionProps = new Properties()
-
-try {
-    file(versionFile).withInputStream { stream -> versionProps.load(stream) }
-    version = versionProps['version']
-} catch (e) {
-    // this happens, if either the properties file is not present, or cannot be read from
-    throw new GradleException("File ${versionFile} not found or unreadable. Aborting.", e)
-}
-
 jar {
-    manifest {
-        attributes "Main-Class": "${mainClassName}"
-    }
-
-    from {
-        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
-    }
+    archiveAppendix = "base"
 }
 
 test {
-- 
GitLab