diff options
Diffstat (limited to 'scripts/oe-setup-vscode')
| -rwxr-xr-x | scripts/oe-setup-vscode | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/scripts/oe-setup-vscode b/scripts/oe-setup-vscode new file mode 100755 index 0000000000..b8642780d5 --- /dev/null +++ b/scripts/oe-setup-vscode | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | usage() { | ||
| 4 | echo "$0 <OEINIT> <BUILDDIR>" | ||
| 5 | echo " OEINIT: path to directory where the .vscode folder is" | ||
| 6 | echo " BUILDDIR: directory passed to the oe-init-setup-env script" | ||
| 7 | } | ||
| 8 | |||
| 9 | if [ "$#" -ne 2 ]; then | ||
| 10 | usage | ||
| 11 | exit 1 | ||
| 12 | fi | ||
| 13 | |||
| 14 | OEINIT=$(readlink -f "$1") | ||
| 15 | BUILDDIR=$(readlink -f "$2") | ||
| 16 | VSCODEDIR=$OEINIT/.vscode | ||
| 17 | |||
| 18 | if [ ! -d "$OEINIT" ] || [ ! -d "$BUILDDIR" ]; then | ||
| 19 | echo "$OEINIT and/or $BUILDDIR directories are not present." | ||
| 20 | exit 1 | ||
| 21 | fi | ||
| 22 | |||
| 23 | VSCODE_SETTINGS=$VSCODEDIR/settings.json | ||
| 24 | ws_builddir="$(echo "$BUILDDIR" | sed -e "s|$OEINIT|\${workspaceFolder}|g")" | ||
| 25 | |||
| 26 | # If BUILDDIR is in scope of VSCode ensure VSCode does not try to index the build folder. | ||
| 27 | # This would lead to a busy CPU and finally to an OOM exception. | ||
| 28 | mkdir -p "$VSCODEDIR" | ||
| 29 | cat <<EOMsettings > "$VSCODE_SETTINGS" | ||
| 30 | { | ||
| 31 | "bitbake.pathToBitbakeFolder": "\${workspaceFolder}/bitbake", | ||
| 32 | "bitbake.pathToEnvScript": "\${workspaceFolder}/oe-init-build-env", | ||
| 33 | "bitbake.pathToBuildFolder": "$ws_builddir", | ||
| 34 | "bitbake.commandWrapper": "", | ||
| 35 | "bitbake.workingDirectory": "\${workspaceFolder}", | ||
| 36 | "files.exclude": { | ||
| 37 | "**/.git/**": true, | ||
| 38 | "**/_build/**": true, | ||
| 39 | "**/buildhistory/**": true, | ||
| 40 | "**/cache/**": true, | ||
| 41 | "**/downloads/**": true, | ||
| 42 | "**/node_modules/**": true, | ||
| 43 | "**/oe-logs/**": true, | ||
| 44 | "**/oe-workdir/**": true, | ||
| 45 | "**/sstate-cache/**": true, | ||
| 46 | "**/tmp*/**": true, | ||
| 47 | "**/workspace/attic/**": true, | ||
| 48 | "**/workspace/sources/**": true | ||
| 49 | }, | ||
| 50 | "files.watcherExclude": { | ||
| 51 | "**/.git/**": true, | ||
| 52 | "**/_build/**": true, | ||
| 53 | "**/buildhistory/**": true, | ||
| 54 | "**/cache/**": true, | ||
| 55 | "**/downloads/**": true, | ||
| 56 | "**/node_modules/**": true, | ||
| 57 | "**/oe-logs/**": true, | ||
| 58 | "**/oe-workdir/**": true, | ||
| 59 | "**/sstate-cache/**": true, | ||
| 60 | "**/tmp*/**": true, | ||
| 61 | "**/workspace/attic/**": true, | ||
| 62 | "**/workspace/sources/**": true | ||
| 63 | }, | ||
| 64 | "python.analysis.exclude": [ | ||
| 65 | "**/_build/**", | ||
| 66 | "**/.git/**", | ||
| 67 | "**/buildhistory/**", | ||
| 68 | "**/cache/**", | ||
| 69 | "**/downloads/**", | ||
| 70 | "**/node_modules/**", | ||
| 71 | "**/oe-logs/**", | ||
| 72 | "**/oe-workdir/**", | ||
| 73 | "**/sstate-cache/**", | ||
| 74 | "**/tmp*/**", | ||
| 75 | "**/workspace/attic/**", | ||
| 76 | "**/workspace/sources/**" | ||
| 77 | ] | ||
| 78 | } | ||
| 79 | EOMsettings | ||
| 80 | |||
| 81 | |||
| 82 | # Ask the user if the yocto-bitbake extension should be installed | ||
| 83 | VSCODE_EXTENSIONS=$VSCODEDIR/extensions.json | ||
| 84 | cat <<EOMextensions > "$VSCODE_EXTENSIONS" | ||
| 85 | { | ||
| 86 | "recommendations": [ | ||
| 87 | "yocto-project.yocto-bitbake" | ||
| 88 | ] | ||
| 89 | } | ||
| 90 | EOMextensions | ||
| 91 | |||
| 92 | echo "You had no $VSCODEDIR configuration." | ||
| 93 | echo "These configuration files have therefore been created for you." | ||
