From ebf9722e2eddf09d62f88d929f1d2feb6a9140d1 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Tue, 9 Aug 2016 10:14:00 +0200 Subject: [PATCH] darwin: customize plain electron for dev --- build/gulpfile.vscode.js | 21 +++++++++++++++------ package.json | 2 +- scripts/code.sh | 8 ++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index cc4257f5508..e813048d0f7 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -114,10 +114,19 @@ const config = { token: process.env['GITHUB_TOKEN'] || void 0 }; -gulp.task('electron', () => { - // Force windows to use ia32 - const arch = process.env.VSCODE_ELECTRON_PLATFORM || (process.platform === 'win32' ? 'ia32' : process.arch); - return electron.dest(path.join(build, 'electron'), _.extend({}, config, { arch: arch, ffmpegChromium: true })); +const electronPath = path.join(build, 'electron'); + +gulp.task('clean-electron', util.rimraf(electronPath)); + +gulp.task('electron', ['clean-electron'], () => { + const platform = process.platform; + const arch = process.env.VSCODE_ELECTRON_PLATFORM || (platform === 'win32' ? 'ia32' : process.arch); + const opts = _.extend({}, config, { platform, arch, ffmpegChromium: true, keepDefaultApp: true }); + + return gulp.src('package.json') + .pipe(electron(opts)) + .pipe(filter(['**', '!**/app/package.json'])) + .pipe(symdest(electronPath)); }); const languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita']; @@ -156,7 +165,7 @@ function packageTask(platform, arch, opts) { const sources = es.merge(src, extensions) .pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n'))) .pipe(filter(['**', '!**/*.js.map'])) - .pipe(util.handleAzureJson({ platform: platform })); + .pipe(util.handleAzureJson({ platform })); let version = packageJson.version; const quality = product.quality; @@ -211,7 +220,7 @@ function packageTask(platform, arch, opts) { let result = all .pipe(util.skipDirectories()) .pipe(util.fixWin32DirectoryPermissions()) - .pipe(electron(_.extend({}, config, { platform: platform, arch: arch, ffmpegChromium: true }))) + .pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true }))) .pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version'])); if (platform === 'win32') { diff --git a/package.json b/package.json index acd4b8f311c..10a6ee55878 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "ghooks": "1.0.3", "glob": "^5.0.13", "gulp": "^3.8.9", - "gulp-atom-electron": "^1.7.1", + "gulp-atom-electron": "^1.9.0", "gulp-azure-storage": "^0.6.0", "gulp-bom": "^1.0.0", "gulp-buffer": "0.0.2", diff --git a/scripts/code.sh b/scripts/code.sh index c451ee5daae..aeed1698dbf 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -14,7 +14,11 @@ function code() { test -d node_modules || ./scripts/npm.sh install # Get electron - test -d .build/electron || ./node_modules/.bin/gulp electron + if [[ "$OSTYPE" == "darwin"* ]]; then + test -d .build/electron/Code\ -\ OSS.app || ./node_modules/.bin/gulp electron + else + test -d .build/electron || ./node_modules/.bin/gulp electron + fi # Build test -d out || ./node_modules/.bin/gulp compile @@ -28,7 +32,7 @@ function code() { # Launch Code if [[ "$OSTYPE" == "darwin"* ]]; then - exec ./.build/electron/Electron.app/Contents/MacOS/Electron . "$@" + exec ./.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron . "$@" else exec ./.build/electron/electron . "$@" fi