From e6feeff0da997fdda4712beca15f6d99381b0d27 Mon Sep 17 00:00:00 2001 From: Geert Bevin Date: Sun, 25 Feb 2024 15:54:52 -0500 Subject: [PATCH] More vscode tweaks --- .../operations/AbstractCreateOperation.java | 11 +++++++++ .../templates/bld/app/vscode/launch.json | 24 +++++++++++++++++++ .../templates/bld/app/vscode/settings.json | 9 +++---- .../templates/bld/base/vscode/launch.json | 17 +++++++++++++ .../templates/bld/base/vscode/settings.json | 9 +++---- .../templates/bld/lib/vscode/launch.json | 11 +++++++++ .../templates/bld/lib/vscode/settings.json | 9 +++---- .../bld/rife2_hello/vscode/launch.json | 24 +++++++++++++++++++ .../bld/rife2_hello/vscode/settings.json | 10 +++----- .../operations/TestCreateAppOperation.java | 5 ++++ .../operations/TestCreateBaseOperation.java | 4 ++++ .../operations/TestCreateLibOperation.java | 2 ++ .../operations/TestCreateRife2Operation.java | 5 ++++ 13 files changed, 115 insertions(+), 25 deletions(-) create mode 100644 src/main/resources/templates/bld/app/vscode/launch.json create mode 100644 src/main/resources/templates/bld/base/vscode/launch.json create mode 100644 src/main/resources/templates/bld/lib/vscode/launch.json create mode 100644 src/main/resources/templates/bld/rife2_hello/vscode/launch.json diff --git a/src/main/java/rife/bld/operations/AbstractCreateOperation.java b/src/main/java/rife/bld/operations/AbstractCreateOperation.java index 945f922..b20c5d5 100644 --- a/src/main/java/rife/bld/operations/AbstractCreateOperation.java +++ b/src/main/java/rife/bld/operations/AbstractCreateOperation.java @@ -330,6 +330,17 @@ protected boolean createIdeaRunMain() { */ protected void executePopulateVscodeProject() throws FileUtilsErrorException { + var launch_template = TemplateFactory.JSON.get(templateBase_ + "vscode.launch"); + launch_template.setValue("package", project_.pkg()); + if (launch_template.hasValueId("projectMain")) { + launch_template.setValue("projectMain", projectMainName_); + } + if (launch_template.hasValueId("projectTest")) { + launch_template.setValue("projectTest", projectTestName_); + } + var launch_file = new File(vscodeDirectory_, "launch.json"); + FileUtils.writeString(launch_template.getContent(), launch_file); + var settings_template = TemplateFactory.JSON.get(templateBase_ + "vscode.settings"); if (settings_template.hasValueId("version")) { settings_template.setValue("version", BldVersion.getVersion()); diff --git a/src/main/resources/templates/bld/app/vscode/launch.json b/src/main/resources/templates/bld/app/vscode/launch.json new file mode 100644 index 0000000..ea955f1 --- /dev/null +++ b/src/main/resources/templates/bld/app/vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Main", + "request": "launch", + "mainClass": "{{v package/}}.{{v projectMain/}}" + }, + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "org.junit.platform.console.ConsoleLauncher", + "args": [ + "--details=verbose", + "--scan-classpath", + "--disable-banner", + "--disable-ansi-colors", + "--exclude-engine=junit-platform-suite", + "--exclude-engine=junit-vintage"] + } + ] +} diff --git a/src/main/resources/templates/bld/app/vscode/settings.json b/src/main/resources/templates/bld/app/vscode/settings.json index e09d0a3..1f0d9d2 100644 --- a/src/main/resources/templates/bld/app/vscode/settings.json +++ b/src/main/resources/templates/bld/app/vscode/settings.json @@ -3,15 +3,12 @@ "src/main/java", "src/main/resources", "src/test/java", - "src/bld/java" + "src/bld/java", + "src/bld/resources" ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ "${HOME}/.bld/dist/bld-{{v version/}}.jar", - "lib/bld/*.jar", - "lib/compile/*.jar", - "lib/provided/*.jar", - "lib/runtime/*.jar", - "lib/test/*.jar" + "lib/**/*.jar", ] } diff --git a/src/main/resources/templates/bld/base/vscode/launch.json b/src/main/resources/templates/bld/base/vscode/launch.json new file mode 100644 index 0000000..8e2d977 --- /dev/null +++ b/src/main/resources/templates/bld/base/vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Main", + "request": "launch", + "mainClass": "{{v package/}}.{{v projectMain/}}" + }, + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "{{v package/}}.{{v projectTest/}}" + } + ] +} diff --git a/src/main/resources/templates/bld/base/vscode/settings.json b/src/main/resources/templates/bld/base/vscode/settings.json index e09d0a3..1f0d9d2 100644 --- a/src/main/resources/templates/bld/base/vscode/settings.json +++ b/src/main/resources/templates/bld/base/vscode/settings.json @@ -3,15 +3,12 @@ "src/main/java", "src/main/resources", "src/test/java", - "src/bld/java" + "src/bld/java", + "src/bld/resources" ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ "${HOME}/.bld/dist/bld-{{v version/}}.jar", - "lib/bld/*.jar", - "lib/compile/*.jar", - "lib/provided/*.jar", - "lib/runtime/*.jar", - "lib/test/*.jar" + "lib/**/*.jar", ] } diff --git a/src/main/resources/templates/bld/lib/vscode/launch.json b/src/main/resources/templates/bld/lib/vscode/launch.json new file mode 100644 index 0000000..ca24818 --- /dev/null +++ b/src/main/resources/templates/bld/lib/vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "{{v package/}}.{{v projectTest/}}" + } + ] +} diff --git a/src/main/resources/templates/bld/lib/vscode/settings.json b/src/main/resources/templates/bld/lib/vscode/settings.json index e09d0a3..1f0d9d2 100644 --- a/src/main/resources/templates/bld/lib/vscode/settings.json +++ b/src/main/resources/templates/bld/lib/vscode/settings.json @@ -3,15 +3,12 @@ "src/main/java", "src/main/resources", "src/test/java", - "src/bld/java" + "src/bld/java", + "src/bld/resources" ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ "${HOME}/.bld/dist/bld-{{v version/}}.jar", - "lib/bld/*.jar", - "lib/compile/*.jar", - "lib/provided/*.jar", - "lib/runtime/*.jar", - "lib/test/*.jar" + "lib/**/*.jar", ] } diff --git a/src/main/resources/templates/bld/rife2_hello/vscode/launch.json b/src/main/resources/templates/bld/rife2_hello/vscode/launch.json new file mode 100644 index 0000000..ea955f1 --- /dev/null +++ b/src/main/resources/templates/bld/rife2_hello/vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Main", + "request": "launch", + "mainClass": "{{v package/}}.{{v projectMain/}}" + }, + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "org.junit.platform.console.ConsoleLauncher", + "args": [ + "--details=verbose", + "--scan-classpath", + "--disable-banner", + "--disable-ansi-colors", + "--exclude-engine=junit-platform-suite", + "--exclude-engine=junit-vintage"] + } + ] +} diff --git a/src/main/resources/templates/bld/rife2_hello/vscode/settings.json b/src/main/resources/templates/bld/rife2_hello/vscode/settings.json index e5b4dae..3222d22 100644 --- a/src/main/resources/templates/bld/rife2_hello/vscode/settings.json +++ b/src/main/resources/templates/bld/rife2_hello/vscode/settings.json @@ -4,16 +4,12 @@ "src/main/resources", "src/main/webapp", "src/test/java", - "src/bld/java" + "src/bld/java", + "src/bld/resources" ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ "${HOME}/.bld/dist/bld-{{v version/}}.jar", - "lib/bld/*.jar", - "lib/compile/*.jar", - "lib/provided/*.jar", - "lib/runtime/*.jar", - "lib/standalone/*.jar", - "lib/test/*.jar" + "lib/**/*.jar", ] } diff --git a/src/test/java/rife/bld/operations/TestCreateAppOperation.java b/src/test/java/rife/bld/operations/TestCreateAppOperation.java index b0e7cec..9b883c1 100644 --- a/src/test/java/rife/bld/operations/TestCreateAppOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateAppOperation.java @@ -86,6 +86,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -156,6 +157,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -257,6 +259,7 @@ void testExecuteNoDownload() /yourthing/.idea/runConfigurations/Run Main.xml /yourthing/.idea/runConfigurations/Run Tests.xml /yourthing/.vscode + /yourthing/.vscode/launch.json /yourthing/.vscode/settings.json /yourthing/bld /yourthing/bld.bat @@ -353,6 +356,7 @@ void testExecuteLocalDependencies() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -473,6 +477,7 @@ void testExecuteLocalDependenciesFolders() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat diff --git a/src/test/java/rife/bld/operations/TestCreateBaseOperation.java b/src/test/java/rife/bld/operations/TestCreateBaseOperation.java index 11e9baf..d410755 100644 --- a/src/test/java/rife/bld/operations/TestCreateBaseOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateBaseOperation.java @@ -79,6 +79,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -131,6 +132,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -214,6 +216,7 @@ void testExecuteNoDownload() /yourthing/.idea/runConfigurations/Run Main.xml /yourthing/.idea/runConfigurations/Run Tests.xml /yourthing/.vscode + /yourthing/.vscode/launch.json /yourthing/.vscode/settings.json /yourthing/bld /yourthing/bld.bat @@ -267,6 +270,7 @@ void testExecuteNoDownload() /yourthing/.idea/runConfigurations/Run Main.xml /yourthing/.idea/runConfigurations/Run Tests.xml /yourthing/.vscode + /yourthing/.vscode/launch.json /yourthing/.vscode/settings.json /yourthing/bld /yourthing/bld.bat diff --git a/src/test/java/rife/bld/operations/TestCreateLibOperation.java b/src/test/java/rife/bld/operations/TestCreateLibOperation.java index 7a380e6..caa9616 100644 --- a/src/test/java/rife/bld/operations/TestCreateLibOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateLibOperation.java @@ -78,6 +78,7 @@ void testExecute() /myapp/\\.idea/runConfigurations /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -147,6 +148,7 @@ void testExecute() /myapp/\\.idea/runConfigurations /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat diff --git a/src/test/java/rife/bld/operations/TestCreateRife2Operation.java b/src/test/java/rife/bld/operations/TestCreateRife2Operation.java index e1c3fee..6f2a2c1 100644 --- a/src/test/java/rife/bld/operations/TestCreateRife2Operation.java +++ b/src/test/java/rife/bld/operations/TestCreateRife2Operation.java @@ -91,6 +91,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -194,6 +195,7 @@ void testExecute() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -336,6 +338,7 @@ void testExecuteNoDownload() /yourthing/.idea/runConfigurations/Run Main.xml /yourthing/.idea/runConfigurations/Run Tests.xml /yourthing/.vscode + /yourthing/.vscode/launch.json /yourthing/.vscode/settings.json /yourthing/bld /yourthing/bld.bat @@ -446,6 +449,7 @@ void testExecuteLocalDependencies() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat @@ -613,6 +617,7 @@ void testExecuteLocalDependenciesFolders() /myapp/\\.idea/runConfigurations/Run Main\\.xml /myapp/\\.idea/runConfigurations/Run Tests\\.xml /myapp/\\.vscode + /myapp/\\.vscode/launch\\.json /myapp/\\.vscode/settings\\.json /myapp/bld /myapp/bld\\.bat