Auto Build for Visual Studio Code (#11014)
2
buildroot/share/vscode/AutoBuildMarlin/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
out
|
||||||
|
node_modules
|
9
buildroot/share/vscode/AutoBuildMarlin/.vscodeignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.vscode/**
|
||||||
|
.vscode-test/**
|
||||||
|
out/test/**
|
||||||
|
test/**
|
||||||
|
src/**
|
||||||
|
**/*.map
|
||||||
|
.gitignore
|
||||||
|
tsconfig.json
|
||||||
|
vsc-extension-quickstart.md
|
52
buildroot/share/vscode/AutoBuildMarlin/README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Auto Build support for Visual Studio Code
|
||||||
|
This `Visual Studio Code` extension provides access to the `Auto Build` script.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Get the MarlinFirmware repository from GitHub. Open the directory `buildroot/share/vscode` and copy the `AutoBuildMarlin` folder to the `Visual Studio Code` extension directory. Relaunch `Visual Studio Code` to complete the installation.
|
||||||
|
|
||||||
|
To find the `Visual Studio Code` extension directory:
|
||||||
|
|
||||||
|
- Windows - Use Windows Explorer's address bar to open `C:/Users/USERNAME/.vscode/extensions`.
|
||||||
|
- Mac - Use the Finder's `Go` menu to open `~/.vscode/extensions`.
|
||||||
|
- Linux - In the Terminal type `open ~/.vscode/extensions`.
|
||||||
|
|
||||||
|
### 3. Install the PlatformIO extension
|
||||||
|
Click on `View` > `Command Palette...`
|
||||||
|
|
||||||
|
![](./resources/view_command_palette.png)
|
||||||
|
|
||||||
|
Find and click on `Extensions: Install Extensions`
|
||||||
|
|
||||||
|
![](./resources/install_extensions.png)
|
||||||
|
|
||||||
|
Type `platformio` into the search box and click on `Install` under `PlatformIO IDE`.
|
||||||
|
|
||||||
|
![](./resources/platformio_install.png)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
This extension adds the Auto Build icon ![](./media/AB.svg) to the Activities bar.
|
||||||
|
|
||||||
|
### 1. Open the Marlin folder
|
||||||
|
Click on `File` > `Open Folder...`
|
||||||
|
|
||||||
|
![](./resources/Open_Folder.png)
|
||||||
|
|
||||||
|
This brings up the `Open Folder` dialog. Select the folder that has the `platformio.ini` file in it.
|
||||||
|
|
||||||
|
![](./resources/Open_Marlin.png)
|
||||||
|
|
||||||
|
You should see something like the following. If not, click on the Explorer icon in the Activities bar.
|
||||||
|
|
||||||
|
![](./resources/Activity_bar.png)
|
||||||
|
|
||||||
|
### 2. Click on the Auto Build Icon ![](./media/AB.svg)
|
||||||
|
This brings up the Auto Build menu icon bar.
|
||||||
|
![](./resources/AB_menu.png)
|
||||||
|
|
||||||
|
### 3. Click on one of the four icons
|
||||||
|
- ![](./resources/B_small.svg) - Clicking on it starts `PIO Build`
|
||||||
|
- ![](./resources/C_small.svg) - Clicking on it starts `PIO Clean`
|
||||||
|
- ![](./resources/U_small.svg) - Clicking on it starts `PIO Upload`
|
||||||
|
- ![](./resources/Ut_small.svg) - Clicking on it starts `PIO Upload (traceback)`
|
37
buildroot/share/vscode/AutoBuildMarlin/extension.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var vscode = require('vscode');
|
||||||
|
|
||||||
|
function activate(context) {
|
||||||
|
|
||||||
|
console.log('Extension "AutoBuildMarlin" is now active!');
|
||||||
|
|
||||||
|
var NEXT_TERM_ID = 1;
|
||||||
|
var pio_build = vscode.commands.registerCommand('piobuild', function () {
|
||||||
|
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
|
||||||
|
terminal.sendText("python buildroot/share/atom/auto_build.py build");
|
||||||
|
});
|
||||||
|
var pio_clean = vscode.commands.registerCommand('pioclean', function () {
|
||||||
|
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
|
||||||
|
terminal.sendText("python buildroot/share/atom/auto_build.py clean");
|
||||||
|
});
|
||||||
|
var pio_upload = vscode.commands.registerCommand('pioupload', function () {
|
||||||
|
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
|
||||||
|
terminal.sendText("python buildroot/share/atom/auto_build.py upload");
|
||||||
|
});
|
||||||
|
var pio_traceback = vscode.commands.registerCommand('piotraceback', function () {
|
||||||
|
const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
|
||||||
|
terminal.sendText("python buildroot/share/atom/auto_build.py traceback");
|
||||||
|
});
|
||||||
|
|
||||||
|
context.subscriptions.push(pio_build);
|
||||||
|
context.subscriptions.push(pio_clean);
|
||||||
|
context.subscriptions.push(pio_upload);
|
||||||
|
context.subscriptions.push(pio_traceback);
|
||||||
|
}
|
||||||
|
exports.activate = activate;
|
||||||
|
|
||||||
|
// this method is called when your extension is deactivated
|
||||||
|
function deactivate() {
|
||||||
|
}
|
||||||
|
exports.deactivate = deactivate;
|
12
buildroot/share/vscode/AutoBuildMarlin/media/AB.svg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<svg width="50" height="40" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
|
||||||
|
<title>VScode view icon</title>
|
||||||
|
<g stroke="null">
|
||||||
|
<title>Layer 2</title>
|
||||||
|
<text stroke="#000000" transform="matrix(0.8130887717336464,0,0,1,5.526016946709532,0) " xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" id="svg_2" y="28.27701" x="24.48401" stroke-width="0" fill="#ffffff">AB</text>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<rect fill-opacity="0" id="svg_1" height="28" width="28" y="6" x="11" stroke-width="0.5" stroke="#ffffff" fill="#000000"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 666 B |
3323
buildroot/share/vscode/AutoBuildMarlin/package-lock.json
generated
Normal file
96
buildroot/share/vscode/AutoBuildMarlin/package.json
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
{
|
||||||
|
"name": "auto-build",
|
||||||
|
"displayName": "Auto Build Marlin",
|
||||||
|
"description": "Auto Build Marlin for VS code",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"publisher": "marlinfirmware",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.23.0"
|
||||||
|
},
|
||||||
|
"enableProposedApi": true,
|
||||||
|
"categories": [
|
||||||
|
"Other"
|
||||||
|
],
|
||||||
|
"activationEvents": [
|
||||||
|
"onCommand:piobuild",
|
||||||
|
"onCommand:pioclean",
|
||||||
|
"onCommand:pioupload",
|
||||||
|
"onCommand:piotraceback"
|
||||||
|
],
|
||||||
|
"main": "./extension",
|
||||||
|
"contributes": {
|
||||||
|
"viewsContainers": {
|
||||||
|
"activitybar": [
|
||||||
|
{
|
||||||
|
"id": "auto-build",
|
||||||
|
"title": "Auto Build Marlin",
|
||||||
|
"icon": "media/AB.svg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"views": {
|
||||||
|
"auto-build": [
|
||||||
|
{
|
||||||
|
"id": "autobuild",
|
||||||
|
"name": " "
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"command": "piobuild",
|
||||||
|
"title": "PIO Build",
|
||||||
|
"icon": "resources/B32x32_white.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "pioclean",
|
||||||
|
"title": "PIO Clean",
|
||||||
|
"icon": "resources/C32x32_white.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "pioupload",
|
||||||
|
"title": "PIO Upload",
|
||||||
|
"icon": "resources/U32x32_white.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "piotraceback",
|
||||||
|
"title": "PIO Upload (traceback)",
|
||||||
|
"icon": "resources/Ut32x32_white.svg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"menus": {
|
||||||
|
"view/title": [
|
||||||
|
{
|
||||||
|
"command": "piobuild",
|
||||||
|
"group": "navigation@1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "pioclean",
|
||||||
|
"group": "navigation@2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "pioupload",
|
||||||
|
"group": "navigation@3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "piotraceback",
|
||||||
|
"group": "navigation@4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"vscode:prepublish": "npm run compile",
|
||||||
|
"compile": "tsc -p ./",
|
||||||
|
"watch": "tsc -watch -p ./",
|
||||||
|
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||||
|
"test": "npm run compile && node ./node_modules/vscode/bin/test"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vscode": "^1.1.17",
|
||||||
|
"typescript": "^2.6.1",
|
||||||
|
"tslint": "^5.8.0",
|
||||||
|
"@types/node": "^7.0.43",
|
||||||
|
"@types/mocha": "^2.2.42"
|
||||||
|
}
|
||||||
|
}
|
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/AB_menu.png
Normal file
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480px" height="480px" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="24" height="24" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:14px;font-weight:lighter;stroke:white;stroke-width:0.3;" x="7.75" y="16.8" id="e2_texte" dy="" dx="">B</text></svg>
|
After Width: | Height: | Size: 440 B |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="610px" height="390px" viewBox="-9.02564 0 50.0513 32" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="32" height="32" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:45px;stroke:white;stroke-width:0.5;font-style:normal;font-weight:lighter;" x="2.18804" y="32.2188" id="e1_texte" dy="" dx="">B</text></svg>
|
After Width: | Height: | Size: 476 B |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28px" height="28px" viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="28" height="28" style="fill:black; stroke:black;"/><text style="fill:white;font-family:Arial;font-size:24px;stroke:white;font-weight:lighter;stroke-width:0.4;" x="7.18702" y="22.6128" id="e1_texte" dy="" dx="">B</text></svg>
|
After Width: | Height: | Size: 442 B |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Build.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="610px" height="390px" viewBox="-9.02564 0 50.0513 32" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="32" height="32" style="fill: black; stroke: black;"/><text style="font-family: Arial; font-size:42px; font-style: normal; font-weight: lighter; stroke: white; stroke-width: 0.5;fill:white;" x="0.437605" y="31.1795" id="e2_texte" dy="" dx="">C</text></svg>
|
After Width: | Height: | Size: 487 B |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28px" height="28px" viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="28" height="28" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:24px;font-weight:lighter;stroke:white;stroke-width:0.4;" x="5.51903" y="23.0989" id="e1_texte" dy="" dx="">C</text></svg>
|
After Width: | Height: | Size: 444 B |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Clean.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Open_Folder.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Open_Marlin.png
Normal file
After Width: | Height: | Size: 56 KiB |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="610px" height="390px" viewBox="-9.02564 0 50.0513 32" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="32" height="32" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:42px;font-weight:lighter;stroke:white;stroke-width:0.5;" x="3.06325" y="31.1795" id="e4_texte" dy="" dx="">T</text></svg>
|
After Width: | Height: | Size: 458 B |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Traceback.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="610px" height="390px" viewBox="-9.02564 0 50.0513 32" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="32" height="32" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:42px;font-weight:lighter;stroke:white;stroke-width:0.5;" x="0.71111" y="31.2342" id="e3_texte" dy="" dx="">U</text></svg>
|
After Width: | Height: | Size: 458 B |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28px" height="28px" viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="28" height="28" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:24px;font-weight:lighter;stroke:white;stroke-width:0.4;" x="5.17808" y="22.0335" id="e2_texte" dy="" dx="">U</text></svg>
|
After Width: | Height: | Size: 444 B |
BIN
buildroot/share/vscode/AutoBuildMarlin/resources/Upload.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="610px" height="390px" viewBox="-9.02564 0 50.0513 32" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="32" height="32" style="fill: black; stroke: black;"/><text style="fill: white; font-family: Arial; font-size:42px; font-weight: lighter; stroke: white; stroke-width: 0.5;font-stretch:condensed;" x="-2.40683" y="31.0701" id="e6_texte" dy="" dx="">Ut</text></svg>
|
After Width: | Height: | Size: 493 B |
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28px" height="28px" viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" ><rect id="svgEditorBackground" x="0" y="0" width="28" height="28" style="fill: black; stroke: black;"/><text style="fill:white;font-family:Arial;font-size:24px;font-weight:lighter;font-stretch:condensed;stroke:white;stroke-width:0.4;" x="3.34551" y="22.8858" id="e3_texte" dy="" dx="">Ut</text></svg>
|
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 10 KiB |
12
buildroot/share/vscode/AutoBuildMarlin/tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es6",
|
||||||
|
"outDir": "out",
|
||||||
|
"lib": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
|
"sourceMap": true,
|
||||||
|
"rootDir": "."
|
||||||
|
}
|
||||||
|
}
|