darwin: customize plain electron for dev

This commit is contained in:
Joao Moreno 2016-08-09 10:14:00 +02:00
parent 28550cff75
commit ebf9722e2e
3 changed files with 22 additions and 9 deletions

View file

@ -114,10 +114,19 @@ const config = {
token: process.env['GITHUB_TOKEN'] || void 0 token: process.env['GITHUB_TOKEN'] || void 0
}; };
gulp.task('electron', () => { const electronPath = path.join(build, 'electron');
// Force windows to use ia32
const arch = process.env.VSCODE_ELECTRON_PLATFORM || (process.platform === 'win32' ? 'ia32' : process.arch); gulp.task('clean-electron', util.rimraf(electronPath));
return electron.dest(path.join(build, 'electron'), _.extend({}, config, { arch: arch, ffmpegChromium: true }));
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']; 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) const sources = es.merge(src, extensions)
.pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n'))) .pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n')))
.pipe(filter(['**', '!**/*.js.map'])) .pipe(filter(['**', '!**/*.js.map']))
.pipe(util.handleAzureJson({ platform: platform })); .pipe(util.handleAzureJson({ platform }));
let version = packageJson.version; let version = packageJson.version;
const quality = product.quality; const quality = product.quality;
@ -211,7 +220,7 @@ function packageTask(platform, arch, opts) {
let result = all let result = all
.pipe(util.skipDirectories()) .pipe(util.skipDirectories())
.pipe(util.fixWin32DirectoryPermissions()) .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'])); .pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version']));
if (platform === 'win32') { if (platform === 'win32') {

View file

@ -46,7 +46,7 @@
"ghooks": "1.0.3", "ghooks": "1.0.3",
"glob": "^5.0.13", "glob": "^5.0.13",
"gulp": "^3.8.9", "gulp": "^3.8.9",
"gulp-atom-electron": "^1.7.1", "gulp-atom-electron": "^1.9.0",
"gulp-azure-storage": "^0.6.0", "gulp-azure-storage": "^0.6.0",
"gulp-bom": "^1.0.0", "gulp-bom": "^1.0.0",
"gulp-buffer": "0.0.2", "gulp-buffer": "0.0.2",

View file

@ -14,7 +14,11 @@ function code() {
test -d node_modules || ./scripts/npm.sh install test -d node_modules || ./scripts/npm.sh install
# Get electron # 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 # Build
test -d out || ./node_modules/.bin/gulp compile test -d out || ./node_modules/.bin/gulp compile
@ -28,7 +32,7 @@ function code() {
# Launch Code # Launch Code
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
exec ./.build/electron/Electron.app/Contents/MacOS/Electron . "$@" exec ./.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron . "$@"
else else
exec ./.build/electron/electron . "$@" exec ./.build/electron/electron . "$@"
fi fi