Skip to content

Commit

Permalink
FUSETOOLS-2249: Provide build and start tasks for a native build of C…
Browse files Browse the repository at this point in the history
…amel Quarkus application

Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek committed Nov 22, 2023
1 parent 421d9f3 commit b44a3b7
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to the "vscode-debug-adapter-apache-camel" extension will be
## 0.10.0

- Update default Camel version used for Camel JBang from 4.0.0 to 4.2.0
- Provide build and start tasks completion inside `.vscode/tasks.json` for a Camel Quarkus native application

## 0.9.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,46 @@ export class CamelApplicationLauncherTasksCompletionItemProvider implements vsco
"isBackground": true // Must be set as background as the Maven commands doesn't return until the Camel application stops.
}`
};

private mavenQuarkusBuildNativeCompletion: vscode.CompletionItem = {
label: 'Build a Camel Quarkus application as a Native executable debug-ready',
documentation: 'Build a native Quarkus application with JMX and Camel Debugger enabled. It provides extra-configuration required to combine with a Camel Debugger launch configuration as a preLaunchTask.',
insertText:
`{
"label": "Build a Camel Quarkus application as a Native executable debug-ready",
"detail": "This task will build Camel Quarkus application with JMX and Camel Debugger enabled using GraalVM",
"type": "shell",
"command": "./mvnw",
"args": [
"install",
"-Dnative",
"'-Dquarkus.native.monitoring=jmxserver,jmxclient'",
"'-Dquarkus.camel.debug.enabled=true'",
"'-Pcamel.debug'" // This depends on your project
],
"problemMatcher": [],
"presentation": {
"reveal": "always"
}
}`
};

private mavenQuarkusStartNativeCompletion: vscode.CompletionItem = {
label: 'Start Camel native application debug-ready',
documentation: 'Start Camel native application with Maven Quarkus Native and camel.debug profile. It provides extra-configuration required to combine with a Camel Debugger launch configuration as a preLaunchTask.',
insertText:
`{
"label": "Start Camel native application debug-ready",
"detail": "This task will start Camel native application with Maven Quarkus Native and camel.debug profile",
"type": "shell",
"command": "./target/*-runner",
"problemMatcher": "$camel.debug.problemMatcher",
"presentation": {
"reveal": "always"
},
"isBackground": true
}`
};

private jbangCompletion: vscode.CompletionItem = {
label: 'Run Camel application with JBang with camel-debug',
Expand Down Expand Up @@ -147,6 +187,8 @@ export class CamelApplicationLauncherTasksCompletionItemProvider implements vsco
completions.push(this.mavenCompletion);
completions.push(this.mavenQuarkusCompletion);
completions.push(this.mavenCompletionToLaunchTest);
completions.push(this.mavenQuarkusBuildNativeCompletion);
completions.push(this.mavenQuarkusStartNativeCompletion);
completions.push(this.jbangCompletion);
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/suite/completion.task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ suite('Should do completion in tasks.json', () => {
const expectedCompletion = { label: 'Run Camel application with JBang with camel-debug' };
await testCompletion(docURiTasksJson, new vscode.Position(3, 7), expectedCompletion);
}).timeout(20000);

test('Completion for Build a native Camel Quarkus application', async () => {
const docURiTasksJson = getDocUri('.vscode/tasks.json');
const expectedCompletion = { label: 'Build a Camel Quarkus application as a Native executable debug-ready' };
await testCompletion(docURiTasksJson, new vscode.Position(3, 7), expectedCompletion);
}).timeout(20000);

test('Completion for Start Camel native application', async () => {
const docURiTasksJson = getDocUri('.vscode/tasks.json');
const expectedCompletion = { label: 'Start Camel native application debug-ready' };
await testCompletion(docURiTasksJson, new vscode.Position(3, 7), expectedCompletion);
}).timeout(20000);
});

async function testCompletion(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "Build a Camel Quarkus application as a Native executable debug-ready",
"detail": "This task will build Camel Quarkus application with JMX and Camel Debugger enabled using GraalVM",
"type": "shell",
"command": "./mvnw",
"args": [
"install",
"-Dnative",
"'-Dquarkus.native.monitoring=jmxserver,jmxclient'",
"'-Dquarkus.camel.debug.enabled=true'",
"'-Pcamel.debug'" // This depends on your project
],
"problemMatcher": [],
"presentation": {
"reveal": "always"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Camel native application debug-ready",
"detail": "This task will start Camel native application with Maven Quarkus Native and camel.debug profile",
"type": "shell",
"command": "./target/*-runner",
"problemMatcher": "$camel.debug.problemMatcher",
"presentation": {
"reveal": "always"
},
"isBackground": true
}
]
}
11 changes: 8 additions & 3 deletions src/ui-test/tests/tasks.json.autocompletion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import { expect } from "chai";
import { activateEditor, closeEditor, getFileContent, openFileInEditor, selectFromCA } from "../utils";
import { ActivityBar, TextEditor, VSBrowser, WebDriver } from "vscode-uitests-tooling";
import { ActivityBar, TextEditor, VSBrowser, WebDriver, afterEach } from "vscode-uitests-tooling";
import * as path from "path";
import { RESOURCES_DIR, RESOURCES_TASK_EXAMPLES_DIR, TASKS_TEST_FILE } from "../variables";

Expand All @@ -32,13 +32,19 @@ describe('Completion inside tasks.json', function () {
await (await new ActivityBar().getViewControl('Explorer')).openView();
});

afterEach(async function () {
await closeEditor(TASKS_TEST_FILE, false);
});

const PARAMS = [
// command, filename
['Launch Camel test with Maven with camel.debug profile', '01_launch_camel_debug_profile.json'],
['Run Camel application with JBang with camel-debug', '02_run_jbang_w_camel_debug.json'],
['Start Camel application with camel:debug Maven goal', '03_start_mvn_camel_debug_goal.json'],
['Start Camel application with Maven Quarkus Dev with camel.debug profile', '04_start_mvn_quarkus_dev_debug_profile.json'],
['Start Camel application with Maven with camel.debug profile', '05_start_mvn_camel_debug_profile.json']
['Start Camel application with Maven with camel.debug profile', '05_start_mvn_camel_debug_profile.json'],
['Build a Camel Quarkus application as a Native executable debug-ready', '06_build_native_camel_quarkus_debug.json'],
['Start Camel native application debug-ready', '07_start_native_camel_quarkus_debug.json']
];

PARAMS.forEach(function (params) {
Expand All @@ -54,7 +60,6 @@ describe('Completion inside tasks.json', function () {
await selectFromCA(command);
const text = await textEditor?.getText();
expect(text).equals(getFileContent(file, RESOURCES_TASK_EXAMPLES_DIR));
await closeEditor(TASKS_TEST_FILE, false);
});
});
});

0 comments on commit b44a3b7

Please sign in to comment.