From 4464a2db3de5c0af08c6524561fe1319c1686e98 Mon Sep 17 00:00:00 2001
From: Alva Swanson <alvasw@protonmail.com>
Date: Sat, 5 Aug 2023 19:42:12 +0200
Subject: [PATCH 1/3] desktop: Move JVM args definition to build.gradle

---
 .../commons/src/main/groovy/bisq.application.gradle       | 8 --------
 desktop/build.gradle                                      | 7 +++++++
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/build-logic/commons/src/main/groovy/bisq.application.gradle b/build-logic/commons/src/main/groovy/bisq.application.gradle
index 232aae91e62..c0cafcb6aed 100644
--- a/build-logic/commons/src/main/groovy/bisq.application.gradle
+++ b/build-logic/commons/src/main/groovy/bisq.application.gradle
@@ -39,14 +39,6 @@ installDist {
         unixScriptFile.text = unixScriptFile.text.replace(
                 'APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit', 'APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit')
 
-        if (applicationName == 'desktop') {
-            def script = file("${rootProject.projectDir}/bisq-$applicationName")
-            script.text = script.text.replace(
-                    'DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-XX:MaxRAM=8g -Xss1280k -XX:+UseG1GC ' +
-                    '-XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:+UseStringDeduplication ' +
-                    '-Djava.net.preferIPv4Stack=true"')
-        }
-
         if (applicationName == 'apitest') {
             // Pass the logback config file as a system property to avoid chatty
             // logback startup due to multiple logback.xml files in the classpath
diff --git a/desktop/build.gradle b/desktop/build.gradle
index bb0fff3cf25..48d241d94e6 100644
--- a/desktop/build.gradle
+++ b/desktop/build.gradle
@@ -4,6 +4,13 @@ plugins {
     id "com.github.johnrengelman.shadow" version "5.2.0"
 }
 
+application {
+    mainClass = 'bisq.desktop.app.BisqAppMain'
+    applicationDefaultJvmArgs = ['-XX:MaxRAM=8g', '-Xss1280k', '-XX:+UseG1GC', '-XX:MaxHeapFreeRatio=10',
+                                 '-XX:MinHeapFreeRatio=5', '-XX:+UseStringDeduplication',
+                                 '-Djava.net.preferIPv4Stack=true']
+}
+
 apply from: 'package/package.gradle'
 
 shadowDistTar.enabled = false

From 55f113c7876ca6141b7f54ee218482f569a36b49 Mon Sep 17 00:00:00 2001
From: Alva Swanson <alvasw@protonmail.com>
Date: Sat, 5 Aug 2023 19:45:20 +0200
Subject: [PATCH 2/3] apitest: Define mainClass in application block

---
 apitest/build.gradle | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/apitest/build.gradle b/apitest/build.gradle
index 6f9c36ea207..ff8b65200b8 100644
--- a/apitest/build.gradle
+++ b/apitest/build.gradle
@@ -2,7 +2,9 @@ plugins {
     id 'bisq.application'
 }
 
-mainClassName = 'bisq.apitest.ApiTestMain'
+application {
+    mainClass = 'bisq.apitest.ApiTestMain'
+}
 
 // The external dao-setup.gradle file contains tasks to install and clean dao-setup
 // files downloaded from

From e999e8e3af8d4028bab045c623e6f0d3588d3e19 Mon Sep 17 00:00:00 2001
From: Alva Swanson <alvasw@protonmail.com>
Date: Sat, 5 Aug 2023 19:46:14 +0200
Subject: [PATCH 3/3] apitest: Move JVM args definition to build.gradle

---
 apitest/build.gradle                                   |  1 +
 .../commons/src/main/groovy/bisq.application.gradle    | 10 ----------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/apitest/build.gradle b/apitest/build.gradle
index ff8b65200b8..0b8a5da6b5d 100644
--- a/apitest/build.gradle
+++ b/apitest/build.gradle
@@ -4,6 +4,7 @@ plugins {
 
 application {
     mainClass = 'bisq.apitest.ApiTestMain'
+    applicationDefaultJvmArgs = ['-Dlogback.configurationFile=apitest/build/resources/main/logback.xml']
 }
 
 // The external dao-setup.gradle file contains tasks to install and clean dao-setup
diff --git a/build-logic/commons/src/main/groovy/bisq.application.gradle b/build-logic/commons/src/main/groovy/bisq.application.gradle
index c0cafcb6aed..9658c3f2ae7 100644
--- a/build-logic/commons/src/main/groovy/bisq.application.gradle
+++ b/build-logic/commons/src/main/groovy/bisq.application.gradle
@@ -38,16 +38,6 @@ installDist {
         def unixScriptFile = file("${rootProject.projectDir}/bisq-$applicationName")
         unixScriptFile.text = unixScriptFile.text.replace(
                 'APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit', 'APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit')
-
-        if (applicationName == 'apitest') {
-            // Pass the logback config file as a system property to avoid chatty
-            // logback startup due to multiple logback.xml files in the classpath
-            // (:daemon & :cli).
-            def script = file("${rootProject.projectDir}/bisq-$applicationName")
-            script.text = script.text.replace(
-                    'DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="' +
-                    '-Dlogback.configurationFile=apitest/build/resources/main/logback.xml"')
-        }
     }
 }