瀏覽代碼

Auto Build for Visual Studio Code (#11014)

Bob Kuhn 6 年之前
父節點
當前提交
7e8d2d611d
共有 29 個檔案被更改,包括 3553 行新增0 行删除
  1. 2
    0
      buildroot/share/vscode/AutoBuildMarlin/.gitignore
  2. 9
    0
      buildroot/share/vscode/AutoBuildMarlin/.vscodeignore
  3. 52
    0
      buildroot/share/vscode/AutoBuildMarlin/README.md
  4. 37
    0
      buildroot/share/vscode/AutoBuildMarlin/extension.js
  5. 12
    0
      buildroot/share/vscode/AutoBuildMarlin/media/AB.svg
  6. 3323
    0
      buildroot/share/vscode/AutoBuildMarlin/package-lock.json
  7. 96
    0
      buildroot/share/vscode/AutoBuildMarlin/package.json
  8. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/AB_menu.png
  9. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Activity_bar.png
  10. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/B24x24_white.svg
  11. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/B32x32_white.svg
  12. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/B_small.svg
  13. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Build.png
  14. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/C32x32_white.svg
  15. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/C_small.svg
  16. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Clean.png
  17. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Open_Folder.png
  18. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Open_Marlin.png
  19. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/T32x32_white.svg
  20. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Traceback.png
  21. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/U32x32_white.svg
  22. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/U_small.svg
  23. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/Upload.png
  24. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/Ut32x32_white.svg
  25. 1
    0
      buildroot/share/vscode/AutoBuildMarlin/resources/Ut_small.svg
  26. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/install_extensions.png
  27. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/platformio_install.png
  28. 二進制
      buildroot/share/vscode/AutoBuildMarlin/resources/view_command_palette.png
  29. 12
    0
      buildroot/share/vscode/AutoBuildMarlin/tsconfig.json

+ 2
- 0
buildroot/share/vscode/AutoBuildMarlin/.gitignore 查看文件

@@ -0,0 +1,2 @@
1
+out
2
+node_modules

+ 9
- 0
buildroot/share/vscode/AutoBuildMarlin/.vscodeignore 查看文件

@@ -0,0 +1,9 @@
1
+.vscode/**
2
+.vscode-test/**
3
+out/test/**
4
+test/**
5
+src/**
6
+**/*.map
7
+.gitignore
8
+tsconfig.json
9
+vsc-extension-quickstart.md

+ 52
- 0
buildroot/share/vscode/AutoBuildMarlin/README.md 查看文件

@@ -0,0 +1,52 @@
1
+# Auto Build support for Visual Studio Code
2
+This `Visual Studio Code` extension provides access to the `Auto Build` script.
3
+
4
+## Installation
5
+
6
+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.
7
+
8
+To find the `Visual Studio Code` extension directory:
9
+
10
+- Windows - Use Windows Explorer's address bar to open `C:/Users/USERNAME/.vscode/extensions`.
11
+- Mac - Use the Finder's `Go` menu to open `~/.vscode/extensions`.
12
+- Linux - In the Terminal type `open ~/.vscode/extensions`.
13
+
14
+### 3. Install the PlatformIO extension
15
+Click on `View` > `Command Palette...`
16
+
17
+![](./resources/view_command_palette.png)
18
+
19
+Find and click on `Extensions: Install Extensions`
20
+
21
+![](./resources/install_extensions.png)
22
+
23
+Type `platformio` into the search box and click on `Install` under `PlatformIO IDE`.
24
+
25
+![](./resources/platformio_install.png)
26
+
27
+## Usage
28
+
29
+This extension adds the Auto Build icon ![](./media/AB.svg) to the Activities bar.
30
+
31
+### 1. Open the Marlin folder
32
+Click on `File` > `Open Folder...`
33
+
34
+![](./resources/Open_Folder.png)
35
+
36
+This brings up the `Open Folder` dialog. Select the folder that has the `platformio.ini` file in it.
37
+
38
+![](./resources/Open_Marlin.png)
39
+
40
+You should see something like the following. If not, click on the Explorer icon in the Activities bar.
41
+
42
+![](./resources/Activity_bar.png)
43
+
44
+### 2. Click on the Auto Build Icon ![](./media/AB.svg)
45
+This brings up the Auto Build menu icon bar.
46
+![](./resources/AB_menu.png)
47
+
48
+### 3. Click on one of the four icons
49
+- ![](./resources/B_small.svg) - Clicking on it starts `PIO Build`
50
+- ![](./resources/C_small.svg) - Clicking on it starts `PIO Clean`
51
+- ![](./resources/U_small.svg) - Clicking on it starts `PIO Upload`
52
+- ![](./resources/Ut_small.svg) - Clicking on it starts `PIO Upload (traceback)`

+ 37
- 0
buildroot/share/vscode/AutoBuildMarlin/extension.js 查看文件

@@ -0,0 +1,37 @@
1
+'use strict';
2
+
3
+var vscode = require('vscode');
4
+
5
+function activate(context) {
6
+
7
+  console.log('Extension "AutoBuildMarlin" is now active!');
8
+
9
+  var NEXT_TERM_ID = 1;
10
+  var pio_build     = vscode.commands.registerCommand('piobuild',     function () {
11
+    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
12
+    terminal.sendText("python buildroot/share/atom/auto_build.py build");
13
+    });
14
+  var pio_clean     = vscode.commands.registerCommand('pioclean',     function () {
15
+    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
16
+    terminal.sendText("python buildroot/share/atom/auto_build.py clean");
17
+  });
18
+  var pio_upload    = vscode.commands.registerCommand('pioupload',    function () {
19
+    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
20
+    terminal.sendText("python buildroot/share/atom/auto_build.py upload");
21
+  });
22
+  var pio_traceback = vscode.commands.registerCommand('piotraceback', function () {
23
+    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
24
+    terminal.sendText("python buildroot/share/atom/auto_build.py traceback");
25
+  });
26
+
27
+  context.subscriptions.push(pio_build);
28
+  context.subscriptions.push(pio_clean);
29
+  context.subscriptions.push(pio_upload);
30
+  context.subscriptions.push(pio_traceback);
31
+}
32
+exports.activate = activate;
33
+
34
+// this method is called when your extension is deactivated
35
+function deactivate() {
36
+}
37
+exports.deactivate = deactivate;

+ 12
- 0
buildroot/share/vscode/AutoBuildMarlin/media/AB.svg 查看文件

@@ -0,0 +1,12 @@
1
+<svg width="50" height="40" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
2
+ <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
3
+ <title>VScode view icon</title>
4
+ <g stroke="null">
5
+  <title>Layer 2</title>
6
+  <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>
7
+ </g>
8
+ <g>
9
+  <title>Layer 1</title>
10
+  <rect fill-opacity="0" id="svg_1" height="28" width="28" y="6" x="11" stroke-width="0.5" stroke="#ffffff" fill="#000000"/>
11
+ </g>
12
+</svg>

+ 3323
- 0
buildroot/share/vscode/AutoBuildMarlin/package-lock.json
文件差異過大導致無法顯示
查看文件


+ 96
- 0
buildroot/share/vscode/AutoBuildMarlin/package.json 查看文件

@@ -0,0 +1,96 @@
1
+{
2
+  "name": "auto-build",
3
+  "displayName": "Auto Build Marlin",
4
+  "description": "Auto Build Marlin for VS code",
5
+  "version": "0.1.0",
6
+  "publisher": "marlinfirmware",
7
+  "engines": {
8
+    "vscode": "^1.23.0"
9
+  },
10
+  "enableProposedApi": true,
11
+  "categories": [
12
+    "Other"
13
+  ],
14
+  "activationEvents": [
15
+    "onCommand:piobuild",
16
+    "onCommand:pioclean",
17
+    "onCommand:pioupload",
18
+    "onCommand:piotraceback"
19
+  ],
20
+  "main": "./extension",
21
+  "contributes": {
22
+    "viewsContainers": {
23
+      "activitybar": [
24
+        {
25
+          "id": "auto-build",
26
+          "title": "Auto Build Marlin",
27
+          "icon": "media/AB.svg"
28
+        }
29
+      ]
30
+    },
31
+    "views": {
32
+      "auto-build": [
33
+        {
34
+          "id": "autobuild",
35
+          "name": " "
36
+        }
37
+      ]
38
+    },
39
+    "commands": [
40
+      {
41
+        "command": "piobuild",
42
+        "title": "PIO Build",
43
+        "icon": "resources/B32x32_white.svg"
44
+      },
45
+      {
46
+        "command": "pioclean",
47
+        "title": "PIO Clean",
48
+        "icon": "resources/C32x32_white.svg"
49
+      },
50
+      {
51
+        "command": "pioupload",
52
+        "title": "PIO Upload",
53
+        "icon": "resources/U32x32_white.svg"
54
+      },
55
+      {
56
+        "command": "piotraceback",
57
+        "title": "PIO Upload (traceback)",
58
+        "icon": "resources/Ut32x32_white.svg"
59
+      }
60
+    ],
61
+    "menus": {
62
+      "view/title": [
63
+        {
64
+          "command": "piobuild",
65
+          "group": "navigation@1"
66
+        },
67
+        {
68
+          "command": "pioclean",
69
+          "group": "navigation@2"
70
+        },
71
+        {
72
+          "command": "pioupload",
73
+          "group": "navigation@3"
74
+        },
75
+        {
76
+          "command": "piotraceback",
77
+          "group": "navigation@4"
78
+        }
79
+      ]
80
+    }
81
+  },
82
+  "scripts": {
83
+    "vscode:prepublish": "npm run compile",
84
+    "compile": "tsc -p ./",
85
+    "watch": "tsc -watch -p ./",
86
+    "postinstall": "node ./node_modules/vscode/bin/install",
87
+    "test": "npm run compile && node ./node_modules/vscode/bin/test"
88
+  },
89
+  "devDependencies": {
90
+    "vscode": "^1.1.17",
91
+    "typescript": "^2.6.1",
92
+    "tslint": "^5.8.0",
93
+    "@types/node": "^7.0.43",
94
+    "@types/mocha": "^2.2.42"
95
+  }
96
+}

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/AB_menu.png 查看文件


二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Activity_bar.png 查看文件


+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/B24x24_white.svg 查看文件

@@ -0,0 +1 @@
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>

+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/B32x32_white.svg 查看文件

@@ -0,0 +1 @@
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>

+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/B_small.svg 查看文件

@@ -0,0 +1 @@
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>

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Build.png 查看文件


+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/C32x32_white.svg 查看文件

@@ -0,0 +1 @@
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>

+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/C_small.svg 查看文件

@@ -0,0 +1 @@
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>

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Clean.png 查看文件


二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Open_Folder.png 查看文件


二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Open_Marlin.png 查看文件


+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/T32x32_white.svg 查看文件

@@ -0,0 +1 @@
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>

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Traceback.png 查看文件


+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/U32x32_white.svg 查看文件

@@ -0,0 +1 @@
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>

+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/U_small.svg 查看文件

@@ -0,0 +1 @@
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>

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/Upload.png 查看文件


+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/Ut32x32_white.svg 查看文件

@@ -0,0 +1 @@
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>

+ 1
- 0
buildroot/share/vscode/AutoBuildMarlin/resources/Ut_small.svg 查看文件

@@ -0,0 +1 @@
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>

二進制
buildroot/share/vscode/AutoBuildMarlin/resources/install_extensions.png 查看文件


二進制
buildroot/share/vscode/AutoBuildMarlin/resources/platformio_install.png 查看文件


二進制
buildroot/share/vscode/AutoBuildMarlin/resources/view_command_palette.png 查看文件


+ 12
- 0
buildroot/share/vscode/AutoBuildMarlin/tsconfig.json 查看文件

@@ -0,0 +1,12 @@
1
+{
2
+  "compilerOptions": {
3
+    "module": "commonjs",
4
+    "target": "es6",
5
+    "outDir": "out",
6
+    "lib": [
7
+      "es6"
8
+    ],
9
+    "sourceMap": true,
10
+    "rootDir": "."
11
+  }
12
+}

Loading…
取消
儲存