forked from aircrack-ng/aircrack-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for VS Code's devcontainers + pre-commit (aircrack-ng#2220)
This patch aims to make development a tad bit easier by providing a complete development environment inside of VS Code. Additionally, `pre-commit` is configured to ensure that source code is properly formatted, prior to commit. Signed-off-by: Joseph Benden <joe@benden.us>
- Loading branch information
Showing
11 changed files
with
265 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.154.2/containers/cpp/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Debian / Ubuntu version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04 | ||
ARG VARIANT="buster" | ||
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} | ||
|
||
ARG CLANGURL="https://releases.llvm.org/3.8.1/" | ||
ARG CLANGFILE="clang+llvm-3.8.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz" | ||
|
||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends \ | ||
build-essential autoconf automake libtool pkg-config libnl-3-dev libnl-genl-3-dev libssl-dev \ | ||
ethtool shtool rfkill zlib1g-dev libpcap-dev libsqlite3-dev libpcre3-dev libhwloc-dev \ | ||
libcmocka-dev hostapd wpasupplicant tcpdump screen iw usbutils expect gawk bear \ | ||
libtinfo5 \ | ||
clangd-10 \ | ||
clang-format-10 \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& /usr/bin/pip3 install pre-commit \ | ||
&& cd /tmp \ | ||
&& wget "${CLANGURL}/${CLANGFILE}" \ | ||
&& tar -x --strip-components=1 -C /usr/local -J -f ${CLANGFILE} \ | ||
&& rm -f ${CLANGFILE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.2/containers/cpp | ||
{ | ||
"name": "Aircrack-ng", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04 | ||
"args": { | ||
"VARIANT": "ubuntu-20.04" | ||
} | ||
}, | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined" | ||
], | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"editor.formatOnSave": true, | ||
"clang-format.executable": "/usr/local/bin/clang-format", | ||
"clang-format.fallbackStyle": "none", | ||
"clang-format.assumeFilename": "${file}", | ||
"clang-format.style": "file", | ||
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", | ||
"clangd.path": "/usr/bin/clangd-10", | ||
"C_Cpp.clang_format_fallbackStyle": "none", | ||
"C_Cpp.clang_format_path": "/usr/local/bin/clang-format", | ||
"C_Cpp.clang_format_style": "file", | ||
"C_Cpp.formatting": "clangFormat" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"xaver.clang-format", | ||
"llvm-vs-code-extensions.vscode-clangd" | ||
], | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pre-commit install --install-hooks", | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
exclude: > | ||
(?x)^( | ||
.github/|AUTHORS|ChangeLog|INSTALLING|LICENSE|README| | ||
appveyor.yml|build/airpcap.dll.def|contrib/|lib/csharp| | ||
lib/radiotap|include/aircrack-ng/third-party|patches/| | ||
test/|scripts/|manpages/|apparmor/ | ||
) | ||
fail_fast: false | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude_types: [asm] | ||
- id: check-added-large-files | ||
- id: mixed-line-ending | ||
exclude_types: [asm] | ||
- id: check-byte-order-marker | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
|
||
- repo: https://github.com/pocc/pre-commit-hooks | ||
rev: python | ||
hooks: | ||
- id: clang-format | ||
args: ["--version=3.8", "--style=file", "-i"] | ||
|
||
- repo: https://github.com/shellcheck-py/shellcheck-py | ||
rev: v0.7.1.1 | ||
hooks: | ||
- id: shellcheck | ||
files: 'test/|scripts/|build/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/local/bin/clang", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "clang-x64", | ||
"compileCommands": "${workspaceFolder}/compile_commands.json" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "(gdb) Launch aircrack-ng", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/.libs/aircrack-ng", | ||
"args": [], | ||
"stopAtEntry": true, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [ | ||
{ | ||
"name": "LD_LIBRARY_PATH", | ||
"value": "${workspaceFolder}/.libs" | ||
} | ||
], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build Incremental", | ||
"type": "shell", | ||
"command": "make -j6 && make -j6 check", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": "$gcc", | ||
"promptOnClose": false, | ||
"presentation": { | ||
"echo": true, | ||
"reveal": "silent", | ||
"focus": false, | ||
"panel": "dedicated", | ||
"showReuseMessage": false, | ||
"clear": false | ||
} | ||
},{ | ||
"label": "Build Full", | ||
"type": "shell", | ||
"command": "autoreconf -vif && env CC=clang-10 CXX=clang++-10 CPP=clang-cpp-10 CFLAGS=\"-Og -g\" CXXFLAGS=\"-Og -g\" ./configure --enable-maintainer-mode --with-experimental --without-opt && bear make -j6 && bear -a make -j6 check", | ||
"group": "build", | ||
"problemMatcher": "$gcc", | ||
"promptOnClose": false, | ||
"presentation": { | ||
"echo": true, | ||
"reveal": "always", | ||
"focus": true, | ||
"panel": "dedicated", | ||
"showReuseMessage": false, | ||
"clear": true | ||
} | ||
},{ | ||
"label": "Test", | ||
"type": "shell", | ||
"command": "make -j6 check", | ||
"group":{ | ||
"kind": "test", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": "$gcc", | ||
"promptOnClose": false, | ||
"presentation": { | ||
"echo": true, | ||
"reveal": "silent", | ||
"focus": false, | ||
"panel": "dedicated", | ||
"showReuseMessage": false, | ||
"clear": false | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.