From 3e5af064b0e502820dcf4dea1a89d1c9bf0d2b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 14:59:33 +0200 Subject: [PATCH] Add setup for Gradle debugging in VS Codium --- .vscode/launch.json | 128 ++++++++++++++++---------------------------- .vscode/tasks.json | 66 +++++++++++++++++++++++ build.gradle | 8 +++ 3 files changed, 119 insertions(+), 83 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 8310c621..d1cf813f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,84 +1,46 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Current File", - "request": "launch", - "mainClass": "${file}" - }, - { - "type": "java", - "name": "ImageInfo", - "request": "launch", - "mainClass": "helma.image.ImageInfo", - "projectName": "helma_" - }, - { - "type": "java", - "name": "CommandlineRunner", - "request": "launch", - "mainClass": "helma.main.CommandlineRunner", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Server", - "request": "launch", - "mainClass": "helma.main.Server", - "projectName": "helma_" - }, - { - "type": "java", - "name": "XmlConverter", - "request": "launch", - "mainClass": "helma.objectmodel.dom.XmlConverter", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Crypt", - "request": "launch", - "mainClass": "helma.util.Crypt", - "projectName": "helma_" - }, - { - "type": "java", - "name": "HtmlEncoder", - "request": "launch", - "mainClass": "helma.util.HtmlEncoder", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Logo", - "request": "launch", - "mainClass": "helma.util.Logo", - "projectName": "helma_" - }, - { - "type": "java", - "name": "MarkdownProcessor", - "request": "launch", - "mainClass": "helma.util.MarkdownProcessor", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Commandline", - "request": "launch", - "mainClass": "helma.main.launcher.Commandline", - "projectName": "launcher" - }, - { - "type": "java", - "name": "Main", - "request": "launch", - "mainClass": "helma.main.launcher.Main", - "projectName": "launcher" - } - ] -} \ No newline at end of file + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Current File", + "request": "launch", + "mainClass": "${file}" + }, + { + "type": "java", + "name": "Run with Gradle", + "request": "launch", + "mainClass": "helma.main.Server", + "projectName": "helma", + "preLaunchTask": "Run with Gradle", + "console": "internalConsole", + "stopOnEntry": false + }, + { + "name": "Debug with Gradle", + "type": "java", + "request": "attach", + "hostName": "localhost", + "port": 5005, + "preLaunchTask": "Debug with Gradle" + }, + { + "type": "java", + "name": "Commandline", + "request": "launch", + "mainClass": "helma.main.launcher.Commandline", + "projectName": "launcher" + }, + { + "type": "java", + "name": "Main", + "request": "launch", + "mainClass": "helma.main.launcher.Main", + "projectName": "launcher" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..78bedb1f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,66 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Run with Gradle", + "type": "shell", + "command": "./gradlew run", + "isBackground": true, + "group": { + "isDefault": true + }, + "problemMatcher": { + "owner": "java", + "fileLocation": "absolute", + "pattern": [ + { + // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) + "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", + "severity": 1, + "message": 2, + "file": 3, + "line": 4 + }, + { + // [2024/06/15 17:26:00] [INFO] [antville-1] INTERNAL:onStart done in 381 millis + "regexp": "^.+INTERNAL:onStart done in \\d+ millis", + "kind": "file", + "file": 0 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "^.+(INTERNAL):onStart done in \\d+ millis", + "endsPattern": "terminated with exit code" + } + } + }, + { + "label": "Debug with Gradle", + "type": "shell", + "command": "./gradlew debug", + "isBackground": true, + "problemMatcher": { + "owner": "custom", + "fileLocation": "absolute", + "pattern": [ + { + // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) + "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", + "severity": 1, + "message": 2, + "file": 3, + "line": 4 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "Listening for transport dt_socket at address", + "endsPattern": "terminated with exit code" + } + } + } + ] +} diff --git a/build.gradle b/build.gradle index e2ee6c4c..84ef732e 100644 --- a/build.gradle +++ b/build.gradle @@ -290,3 +290,11 @@ task commandLine(type: JavaExec) { mainClass = 'helma.main.launcher.Commandline' args '-h', projectDir, function } + +tasks.register('debug', JavaExec) { + group = 'application' + main = 'helma.main.Server' + classpath = sourceSets.main.runtimeClasspath + jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'] + classpath += fileTree(dir: 'lib/ext', include: '*.jar') +}