2024-09-15 20:50:01 +00:00
|
|
|
{
|
|
|
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
|
|
// for the documentation about the tasks.json format
|
|
|
|
"version": "2.0.0",
|
|
|
|
"tasks": [
|
2024-10-18 07:44:15 +00:00
|
|
|
//
|
|
|
|
// Checkers/Analyzers tasks
|
|
|
|
//
|
|
|
|
{
|
|
|
|
"label": "Checker: clang-format dry-run",
|
|
|
|
"type": "shell",
|
|
|
|
"command": "for FILE in $(find . -type f \\( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \\) ! -path '*build*'); do clang-format -i $FILE --dry-run --Werror; done"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Checker: clang-format fix errors",
|
|
|
|
"type": "shell",
|
|
|
|
"command": "for FILE in $(find . -type f \\( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \\) ! -path '*build*'); do clang-format -i $FILE --Werror; done"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// https://clang.llvm.org/extra/clang-tidy/
|
2024-10-21 09:08:40 +00:00
|
|
|
// Add ' -fix ' to automatically fix errors
|
2024-10-18 07:44:15 +00:00
|
|
|
"label": "Checker: clang-tidy dry-run",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
2024-10-21 09:08:40 +00:00
|
|
|
"python /home/tools/run-clang-tidy.py -exclude-header-filter .*build.* -use-color -warnings-as-errors all -header-filter .hpp -p ${workspaceFolder}/build_clang/ -config-file ${workspaceFolder}/.clang-tidy",
|
2024-10-18 07:44:15 +00:00
|
|
|
" ${workspaceFolder}/examples ",
|
|
|
|
" ${workspaceFolder}/library/ ",
|
|
|
|
" ${workspaceFolder}/src/"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
//
|
|
|
|
// Ejabberd tasks
|
|
|
|
//
|
2024-09-25 16:16:34 +00:00
|
|
|
{
|
|
|
|
"label": "Ejabberd: show logs",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"sudo docker exec -it ejabberd tail -f logs/ejabberd.log"
|
|
|
|
]
|
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
{
|
|
|
|
"label": "Ejabberd: show localhost registered users",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"sudo docker exec -it ejabberd ejabberdctl registered_users localhost"
|
|
|
|
]
|
|
|
|
},
|
2024-09-25 16:16:34 +00:00
|
|
|
{
|
|
|
|
"label": "Ejabberd: open shell",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
2024-10-18 07:44:15 +00:00
|
|
|
"printf 'Example cmd: ejabberdctl registered_users localhost\n\n';",
|
2024-09-25 16:16:34 +00:00
|
|
|
"sudo docker exec -it ejabberd sh"
|
|
|
|
]
|
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
//
|
|
|
|
// GCC build related tasks
|
|
|
|
//
|
|
|
|
{
|
|
|
|
"label": "GCC: Clean build folder",
|
|
|
|
"type": "shell",
|
|
|
|
"command": "if [ -n \"$(ls -A ${workspaceFolder}/build)\" ]; then rm -rf ${workspaceFolder}/build/*; fi",
|
|
|
|
"hide": true
|
|
|
|
},
|
2024-09-15 20:50:01 +00:00
|
|
|
{
|
2024-10-18 07:44:15 +00:00
|
|
|
"label": "GCC: Configure Debug",
|
2024-09-15 20:50:01 +00:00
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build && cd build &&",
|
2024-10-21 09:08:40 +00:00
|
|
|
"cmake cmake -Wno-dev ",
|
2024-10-18 07:44:15 +00:00
|
|
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON .."
|
|
|
|
],
|
|
|
|
"options": {
|
|
|
|
"env": {
|
|
|
|
"CC": "/usr/sbin/gcc",
|
|
|
|
"CXX": "/usr/sbin/g++"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"hide": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "GCC: Build",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder}/build &&",
|
2024-09-15 20:50:01 +00:00
|
|
|
"cmake --build . --parallel `nproc`",
|
|
|
|
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
|
|
|
],
|
2024-10-18 07:44:15 +00:00
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
2024-09-15 20:50:01 +00:00
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
"hide": true,
|
|
|
|
"group": {
|
|
|
|
"kind": "build"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "GCC: Configure and build Debug",
|
|
|
|
"type": "shell",
|
|
|
|
"command": "echo Finished!",
|
2024-09-15 20:50:01 +00:00
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
"dependsOrder": "sequence",
|
|
|
|
"dependsOn":[
|
|
|
|
"GCC: Clean build folder",
|
|
|
|
"GCC: Configure Debug",
|
|
|
|
"GCC: Build"
|
|
|
|
],
|
2024-09-15 20:50:01 +00:00
|
|
|
"group": {
|
|
|
|
"kind": "build",
|
|
|
|
"isDefault": true
|
|
|
|
}
|
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
//
|
|
|
|
// Clang build related tasks
|
|
|
|
//
|
2024-09-15 20:50:01 +00:00
|
|
|
{
|
2024-10-18 07:44:15 +00:00
|
|
|
"label": "Clang: Configure Debug",
|
2024-09-15 20:50:01 +00:00
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
2024-10-18 07:44:15 +00:00
|
|
|
"cmake -Wno-dev ",
|
|
|
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
|
|
|
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++\"",
|
|
|
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++\" .."
|
|
|
|
],
|
|
|
|
"options": {
|
|
|
|
"env": {
|
2024-10-21 09:08:40 +00:00
|
|
|
"CC": "clang",
|
|
|
|
"CXX": "clang++"
|
2024-10-18 07:44:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"hide": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Clang: Configure Debug with -fsanitize=address",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
|
|
|
"cmake -Wno-dev ",
|
|
|
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
2024-10-21 09:08:40 +00:00
|
|
|
//
|
|
|
|
// Uncomment for GCC standart library: libstdc++
|
|
|
|
//" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
|
|
|
//" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
|
|
|
//
|
|
|
|
" -DCMAKE_CXX_FLAGS=\"-stdlib=libc++ -I/home/LLVM-19.1.1/include/c++/v1 -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
|
|
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/home/LLVM-19.1.1/lib/ -Wl,-rpath,/home/LLVM-19.1.1/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -fuse-ld=lld -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
|
|
|
" .."
|
2024-10-18 07:44:15 +00:00
|
|
|
],
|
|
|
|
"options": {
|
|
|
|
"env": {
|
2024-10-21 09:08:40 +00:00
|
|
|
"CC": "clang",
|
|
|
|
"CXX": "clang++"
|
2024-10-18 07:44:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"hide": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Useful links:
|
|
|
|
// - https://github.com/google/sanitizers/wiki/addresssanitizerflags
|
|
|
|
// - https://clang.llvm.org/docs/AddressSanitizer.html
|
|
|
|
//
|
|
|
|
"label": "Clang: Exec gtest with -fsanitize=address",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
2024-10-21 09:08:40 +00:00
|
|
|
"ASAN_SYMBOLIZER_PATH=llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
2024-10-18 07:44:15 +00:00
|
|
|
],
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"dependsOrder": "sequence",
|
|
|
|
"dependsOn":[
|
|
|
|
"Clang: Clean build folder",
|
|
|
|
"Clang: Configure Debug with -fsanitize=address",
|
|
|
|
"Clang: Build"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Clang: Configure Debug with -fsanitize=memory",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
|
|
|
"cmake -Wno-dev ",
|
|
|
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
|
|
|
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\"",
|
|
|
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\" ..",
|
2024-09-15 20:50:01 +00:00
|
|
|
],
|
|
|
|
"options": {
|
|
|
|
"env": {
|
2024-10-21 09:08:40 +00:00
|
|
|
"CC": "clang",
|
|
|
|
"CXX": "clang++"
|
2024-09-15 20:50:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
2024-10-18 07:44:15 +00:00
|
|
|
"hide": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Useful links:
|
|
|
|
// - https://github.com/google/sanitizers/wiki/MemorySanitizer
|
|
|
|
// - https://clang.llvm.org/docs/MemorySanitizer.html
|
|
|
|
//
|
|
|
|
"label": "Clang: Exec gtest with -fsanitize=memory",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
2024-10-21 09:08:40 +00:00
|
|
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
2024-10-18 07:44:15 +00:00
|
|
|
],
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"dependsOrder": "sequence",
|
|
|
|
"dependsOn":[
|
|
|
|
"Clang: Clean build folder",
|
|
|
|
"Clang: Configure Debug with -fsanitize=memory",
|
|
|
|
"Clang: Build"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Clang: Build",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder}/build_clang &&",
|
|
|
|
"cmake --build . --parallel `nproc`",
|
|
|
|
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
|
|
|
],
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"group": {
|
|
|
|
"kind": "build"
|
|
|
|
},
|
|
|
|
"hide": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Clang: Configure and build Debug",
|
|
|
|
"type": "shell",
|
|
|
|
"command": [
|
|
|
|
"cd ${workspaceFolder} &&",
|
|
|
|
"mkdir -p build_clang && cd build_clang &&",
|
2024-10-21 09:08:40 +00:00
|
|
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
2024-10-18 07:44:15 +00:00
|
|
|
],
|
|
|
|
"presentation": {
|
|
|
|
"clear": true
|
|
|
|
},
|
|
|
|
"dependsOrder": "sequence",
|
|
|
|
"dependsOn":[
|
|
|
|
"Clang: Clean build folder",
|
|
|
|
"Clang: Configure Debug",
|
|
|
|
"Clang: Build"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Clang: Clean build folder",
|
|
|
|
"type": "shell",
|
|
|
|
"command": "if [ -n \"$(ls -A ${workspaceFolder}/build_clang)\" ]; then rm -rf ${workspaceFolder}/build_clang/*; fi",
|
|
|
|
"hide": true
|
2024-09-15 20:50:01 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|