281 lines
No EOL
10 KiB
JSON
281 lines
No EOL
10 KiB
JSON
{
|
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
// for the documentation about the tasks.json format
|
|
"version": "2.0.0",
|
|
"tasks": [
|
|
//
|
|
// 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/
|
|
// Add ' -fix ' to automatically fix errors
|
|
"label": "Checker: clang-tidy dry-run",
|
|
"type": "shell",
|
|
"command": [
|
|
"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",
|
|
" ${workspaceFolder}/examples ",
|
|
" ${workspaceFolder}/library/ ",
|
|
" ${workspaceFolder}/src/"
|
|
]
|
|
},
|
|
//
|
|
// Ejabberd tasks
|
|
//
|
|
{
|
|
"label": "Ejabberd: show logs",
|
|
"type": "shell",
|
|
"command": [
|
|
"sudo docker exec -it ejabberd tail -f logs/ejabberd.log"
|
|
]
|
|
},
|
|
{
|
|
"label": "Ejabberd: show localhost registered users",
|
|
"type": "shell",
|
|
"command": [
|
|
"sudo docker exec -it ejabberd ejabberdctl registered_users localhost"
|
|
]
|
|
},
|
|
{
|
|
"label": "Ejabberd: open shell",
|
|
"type": "shell",
|
|
"command": [
|
|
"printf 'Example cmd: ejabberdctl registered_users localhost\n\n';",
|
|
"sudo docker exec -it ejabberd sh"
|
|
]
|
|
},
|
|
//
|
|
// 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
|
|
},
|
|
{
|
|
"label": "GCC: Configure Debug",
|
|
"type": "shell",
|
|
"command": [
|
|
"cd ${workspaceFolder} &&",
|
|
"mkdir -p build && cd build &&",
|
|
"cmake cmake -Wno-dev ",
|
|
" -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 &&",
|
|
"cmake --build . --parallel `nproc`",
|
|
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
|
],
|
|
"presentation": {
|
|
"clear": true
|
|
},
|
|
"hide": true,
|
|
"group": {
|
|
"kind": "build"
|
|
}
|
|
},
|
|
{
|
|
"label": "GCC: Configure and build Debug",
|
|
"type": "shell",
|
|
"command": "echo Finished!",
|
|
"presentation": {
|
|
"clear": true
|
|
},
|
|
"dependsOrder": "sequence",
|
|
"dependsOn":[
|
|
"GCC: Clean build folder",
|
|
"GCC: Configure Debug",
|
|
"GCC: Build"
|
|
],
|
|
"group": {
|
|
"kind": "build",
|
|
"isDefault": true
|
|
}
|
|
},
|
|
//
|
|
// Clang build related tasks
|
|
//
|
|
{
|
|
"label": "Clang: Configure Debug",
|
|
"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++\"",
|
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++\" .."
|
|
],
|
|
"options": {
|
|
"env": {
|
|
"CC": "clang",
|
|
"CXX": "clang++"
|
|
}
|
|
},
|
|
"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 ",
|
|
//
|
|
// 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\"",
|
|
" .."
|
|
],
|
|
"options": {
|
|
"env": {
|
|
"CC": "clang",
|
|
"CXX": "clang++"
|
|
}
|
|
},
|
|
"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 &&",
|
|
"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: $?\"",
|
|
],
|
|
"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\" ..",
|
|
],
|
|
"options": {
|
|
"env": {
|
|
"CC": "clang",
|
|
"CXX": "clang++"
|
|
}
|
|
},
|
|
"presentation": {
|
|
"clear": true
|
|
},
|
|
"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 &&",
|
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
|
],
|
|
"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 &&",
|
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
|
],
|
|
"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
|
|
}
|
|
]
|
|
} |