|
@@ -4,9 +4,10 @@ const fs = require('fs')
|
|
|
const { hashElement } = require('folder-hash')
|
|
|
const path = require('path')
|
|
|
|
|
|
+const utils = require('./lib/utils')
|
|
|
+
|
|
|
const BASE = path.resolve(__dirname, '../..')
|
|
|
const NPM_CMD = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
|
-const OUT_DIR = process.env.ELECTRON_SPEC_OUT_DIR || 'Default'
|
|
|
|
|
|
const specHashPath = path.resolve(__dirname, '../spec/.hash')
|
|
|
|
|
@@ -20,7 +21,7 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
|
|
|
if (specChanged || installChanged) {
|
|
|
const out = cp.spawnSync(NPM_CMD, ['install'], {
|
|
|
env: Object.assign({}, process.env, {
|
|
|
- npm_config_nodedir: path.resolve(BASE, `out/${OUT_DIR}/gen/node_headers`),
|
|
|
+ npm_config_nodedir: path.resolve(BASE, `out/${utils.OUT_DIR}/gen/node_headers`),
|
|
|
npm_config_msvs_version: '2017'
|
|
|
}),
|
|
|
cwd: path.resolve(__dirname, '../spec')
|
|
@@ -35,7 +36,7 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
|
|
|
})
|
|
|
}
|
|
|
}).then(() => {
|
|
|
- let exe = path.resolve(BASE, getElectronExec())
|
|
|
+ let exe = path.resolve(BASE, utils.getElectronExec())
|
|
|
const args = process.argv.slice(2)
|
|
|
if (process.platform === 'linux') {
|
|
|
args.unshift(path.resolve(__dirname, 'lib/dbus_mock.py'), exe)
|
|
@@ -50,19 +51,6 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
-function getElectronExec () {
|
|
|
- switch (process.platform) {
|
|
|
- case 'darwin':
|
|
|
- return 'out/Default/Electron.app/Contents/MacOS/Electron'
|
|
|
- case 'win32':
|
|
|
- return 'out/Default/electron.exe'
|
|
|
- case 'linux':
|
|
|
- return 'out/Default/electron'
|
|
|
- default:
|
|
|
- throw new Error('Unknown path')
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function getSpecHash () {
|
|
|
return Promise.all([
|
|
|
new Promise((resolve) => {
|