From 690f2dd85c66eca58e5ca666d9a39c83439351c4 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Tue, 9 Apr 2024 17:05:55 -0400
Subject: [PATCH] misc: add vscode task/launch configurations

This is a good start, but will need to be adapted for other platforms and improved over time.

Change-Id: Ib64046e852c3aa9cc9b492d0af8cee33ee1ff5de
---
 .gitignore          | 13 ++++++--
 .vscode/launch.json | 75 +++++++++++++++++++++++++++++++++++++++++++++
 .vscode/tasks.json  | 52 +++++++++++++++++++++++++++++++
 3 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 .vscode/launch.json
 create mode 100644 .vscode/tasks.json

diff --git a/.gitignore b/.gitignore
index c067bf1a7..3f839901b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,18 @@
 *.user
 doc/Doxyfile
 
+### VisualStudioCode ###
+.vscode/**/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+
+### VisualStudioCode Patch ###
+# Ignore all local history of files
+**/.history
+
 GeneratedFiles/
-.vs/
-.vscode/
 x64/
 x86/
 [wW]in32/
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..138c71c17
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,75 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Jami-Tests-Run",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "/usr/bin/ctest",
+            "args": ["-V", "-R"],
+            "cwd": "${workspaceFolder}/build/tests",
+            "externalConsole": false,
+            "environment": [
+                {
+                    "name": "HOME",
+                    "value": "/tmp"
+                }
+            ]
+        },
+        {
+            "name": "Jami-Client",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "${workspaceFolder}/build/jami",
+            "args": [
+                "-d",
+            ],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}",
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "setupCommands": [
+                {
+                    "description": "Enable pretty-printing for gdb",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                }
+            ],
+            "preLaunchTask": "cmake-build",
+            "miDebuggerPath": "/usr/bin/gdb",
+        },
+        {
+            "name": "Jami-Daemon-Debug",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "${workspaceFolder}/daemon/bin/dbus/jamid",
+            "args": [
+                "-cdp",
+            ],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}",
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "setupCommands": [
+                {
+                    "description": "Enable pretty-printing for gdb",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                }
+            ],
+            "preLaunchTask": "cmake-build",
+            "miDebuggerPath": "/usr/bin/gdb",
+        }
+    ],
+    "compounds": [
+        {
+            "name": "Jami-Client-IPC",
+            "configurations": [
+                "Jami-Daemon-Debug",
+                "Jami-Client",
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 000000000..f31c8b32c
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,52 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "cmake-configure",
+            "type": "shell",
+            "command": "cmake",
+            "args": [
+                "-S", ".",
+                "-B", "build",
+                "-DCMAKE_BUILD_TYPE=Debug",
+                "-DCMAKE_PREFIX_PATH=\"/usr/lib64/qt-jami;/usr/lib/libqt-jami\"",
+                "-DBUILD_TESTING=True"
+            ],
+            "group": "build",
+            "problemMatcher": [],
+            "detail": "Generate the build system files with CMake."
+        },
+        {
+            "label": "cmake-build",
+            "type": "shell",
+            "command": "cmake",
+            "args": [
+                "--build", "build",
+                "-j$(nproc)",
+            ],
+            "group": {
+                "kind": "build",
+                "isDefault": true
+            },
+            "problemMatcher": [
+                "$gcc"
+            ],
+            "detail": "Compile the project using the generated build system.",
+            "dependsOn": [
+                "cmake-configure"
+            ]
+        },
+        {
+            "label": "cmake-clean",
+            "type": "shell",
+            "command": "rm",
+            "args": [
+                "-rf",
+                "build"
+            ],
+            "group": "build",
+            "problemMatcher": [],
+            "detail": "Clean the build directory."
+        }
+    ]
+}
\ No newline at end of file
-- 
GitLab