Skip to content

Commit 54d4ea9

Browse files
RongXiefduSneezry
authored andcommitted
Reduce time (microsoft#874)
* optimize activation time of Arduino * fix tslint error * fix bug on osx * modify version number * clarify gulp version * clarify gulp version * log code info * modify gulp version * use ubuntu 14.04 * modify gulp version
1 parent 872f346 commit 54d4ea9

12 files changed

+226
-116
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ node_js:
66
os:
77
- linux
88
- osx
9-
# dist: trusty # using Ubuntu 14.04.5 LTS
9+
dist: trusty # using Ubuntu 14.04.5 LTS
1010

1111
# fixing https://github.com/Microsoft/vscode/issues/33998
1212
addons:

.vscodeignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ tslint.json
1111
.travis.yml
1212
gulpfile.js
1313
*.vsix
14-
.github/**
14+
.github/**
15+
*.log
16+
webpack.config.js
17+
node_modules/**
18+
vendor/**

gulpfile.js

+26-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const runSequence = require('run-sequence');
99
const del = require('del');
1010

1111
const fs = require("fs");
12+
const fsp = require('fs-plus');
1213
const path = require("path");
1314
const childProcess = require("child_process");
1415

@@ -43,6 +44,23 @@ gulp.task("html-webpack", (done) => {
4344
});
4445
});
4546

47+
gulp.task("node_modules-webpack", (done) => {
48+
const config = require("./webpack.config.js");
49+
config.context = `${__dirname}`;
50+
return webpack(config, (err, stats) => {
51+
const statsJson = stats.toJson();
52+
if (err || (statsJson.errors && statsJson.errors.length)) {
53+
statsJson.errors.forEach(webpackError => {
54+
gutil.log(gutil.colors.red(`Error (webpack): ${webpackError}`));
55+
});
56+
57+
throw new gutil.PluginError('webpack', JSON.stringify(err || statsJson.errors));
58+
}
59+
gutil.log('[webpack]', stats.toString());
60+
done();
61+
});
62+
});
63+
4664
gulp.task("ts-compile", () => {
4765
const tsProject = ts.createProject("./tsconfig.json");
4866
return tsProject.src()
@@ -78,6 +96,11 @@ gulp.task("genAikey", (done) => {
7896
}
7997
});
8098

99+
gulp.task("copyVendor", (done) => {
100+
fsp.copySync('vendor', 'out/vendor');
101+
done();
102+
});
103+
81104
gulp.task("test", (done) => {
82105
function removeExtensionDependencies() {
83106
const packageJson = JSON.parse(fs.readFileSync("package.json"));
@@ -117,13 +140,14 @@ gulp.task("test", (done) => {
117140
if (code === 0) {
118141
done();
119142
} else {
143+
gutil.log("exit code: " + code);
120144
done(code);
121145
}
122146
});
123147
});
124148

125149
gulp.task("build", (done) => {
126-
return runSequence("clean", "ts-compile", "html-webpack", done);
150+
return runSequence("clean", "ts-compile", "html-webpack", "node_modules-webpack", "copyVendor", done);
127151
});
128152

129153
gulp.task("build_without_view", (done) => {
@@ -133,4 +157,4 @@ gulp.task("build_without_view", (done) => {
133157
gulp.task("watch", () => {
134158
gulp.watch(["./src/**/*", "./test/**/*", "!./src/views/**/*"], ["ts-compile"]);
135159
gulp.watch(["./src/views/**/*", "!./src/views/node_modules/**"], ["html-webpack"]);
136-
});
160+
});

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,9 @@
465465
"verbose"
466466
]
467467
},
468-
"arduino.openPDEFiletype":{
469-
"type":"boolean",
470-
"default":false,
468+
"arduino.openPDEFiletype": {
469+
"type": "boolean",
470+
"default": false,
471471
"description": "Allow VSCode Arduino to open PDE sketches, from pre-1.0.0 versions of Arduino"
472472
},
473473
"arduino.enableUSBDetection": {
@@ -575,6 +575,7 @@
575575
"express": "^4.14.1",
576576
"glob": "^7.1.1",
577577
"iconv-lite": "^0.4.18",
578+
"impor": "^0.1.1",
578579
"properties": "^1.2.1",
579580
"uuid": "^3.0.1",
580581
"vscode-extension-telemetry": "0.0.18",

src/debug/debuggerManager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class DebuggerManager {
4343
}
4444
}
4545
}
46-
this._usbDetector = require("../../../vendor/node-usb-native").detector;
46+
this._usbDetector = require("../../vendor/node-usb-native").detector;
4747
this._debugServerPath = platform.findFile(platform.getExecutableFileName("openocd"),
4848
path.join(this._arduinoSettings.packagePath, "packages"));
4949
if (!util.fileExistsSync(this._debugServerPath)) {

0 commit comments

Comments
 (0)