Skip to content

Commit ebf9722

Browse files
committed
darwin: customize plain electron for dev
1 parent 28550cf commit ebf9722

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

build/gulpfile.vscode.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,19 @@ const config = {
114114
token: process.env['GITHUB_TOKEN'] || void 0
115115
};
116116

117-
gulp.task('electron', () => {
118-
// Force windows to use ia32
119-
const arch = process.env.VSCODE_ELECTRON_PLATFORM || (process.platform === 'win32' ? 'ia32' : process.arch);
120-
return electron.dest(path.join(build, 'electron'), _.extend({}, config, { arch: arch, ffmpegChromium: true }));
117+
const electronPath = path.join(build, 'electron');
118+
119+
gulp.task('clean-electron', util.rimraf(electronPath));
120+
121+
gulp.task('electron', ['clean-electron'], () => {
122+
const platform = process.platform;
123+
const arch = process.env.VSCODE_ELECTRON_PLATFORM || (platform === 'win32' ? 'ia32' : process.arch);
124+
const opts = _.extend({}, config, { platform, arch, ffmpegChromium: true, keepDefaultApp: true });
125+
126+
return gulp.src('package.json')
127+
.pipe(electron(opts))
128+
.pipe(filter(['**', '!**/app/package.json']))
129+
.pipe(symdest(electronPath));
121130
});
122131

123132
const languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
@@ -156,7 +165,7 @@ function packageTask(platform, arch, opts) {
156165
const sources = es.merge(src, extensions)
157166
.pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n')))
158167
.pipe(filter(['**', '!**/*.js.map']))
159-
.pipe(util.handleAzureJson({ platform: platform }));
168+
.pipe(util.handleAzureJson({ platform }));
160169

161170
let version = packageJson.version;
162171
const quality = product.quality;
@@ -211,7 +220,7 @@ function packageTask(platform, arch, opts) {
211220
let result = all
212221
.pipe(util.skipDirectories())
213222
.pipe(util.fixWin32DirectoryPermissions())
214-
.pipe(electron(_.extend({}, config, { platform: platform, arch: arch, ffmpegChromium: true })))
223+
.pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true })))
215224
.pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version']));
216225

217226
if (platform === 'win32') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"ghooks": "1.0.3",
4747
"glob": "^5.0.13",
4848
"gulp": "^3.8.9",
49-
"gulp-atom-electron": "^1.7.1",
49+
"gulp-atom-electron": "^1.9.0",
5050
"gulp-azure-storage": "^0.6.0",
5151
"gulp-bom": "^1.0.0",
5252
"gulp-buffer": "0.0.2",

scripts/code.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ function code() {
1414
test -d node_modules || ./scripts/npm.sh install
1515

1616
# Get electron
17-
test -d .build/electron || ./node_modules/.bin/gulp electron
17+
if [[ "$OSTYPE" == "darwin"* ]]; then
18+
test -d .build/electron/Code\ -\ OSS.app || ./node_modules/.bin/gulp electron
19+
else
20+
test -d .build/electron || ./node_modules/.bin/gulp electron
21+
fi
1822

1923
# Build
2024
test -d out || ./node_modules/.bin/gulp compile
@@ -28,7 +32,7 @@ function code() {
2832

2933
# Launch Code
3034
if [[ "$OSTYPE" == "darwin"* ]]; then
31-
exec ./.build/electron/Electron.app/Contents/MacOS/Electron . "$@"
35+
exec ./.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron . "$@"
3236
else
3337
exec ./.build/electron/electron . "$@"
3438
fi

0 commit comments

Comments
 (0)