diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 14b20f716cd..fe21519f3d4 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -33,6 +33,7 @@ const crypto = require('crypto'); const i18n = require('./lib/i18n'); const glob = require('glob'); const deps = require('./dependencies'); +const getElectronVersion = require('./lib/electron').getElectronVersion; const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname)); const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n)); @@ -123,7 +124,7 @@ gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-index-js'], commo const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8')); const config = { - version: packageJson.electronVersion, + version: getElectronVersion(), productAppName: product.nameLong, companyName: 'Microsoft Corporation', copyright: 'Copyright (C) 2017 Microsoft. All rights reserved', diff --git a/build/lib/electron.js b/build/lib/electron.js index 13f698739f3..9e8a48e1858 100644 --- a/build/lib/electron.js +++ b/build/lib/electron.js @@ -21,9 +21,8 @@ module.exports.getElectronVersion = getElectronVersion; // returns 0 if the right version of electron is in .build/electron if (require.main === module) { const version = getElectronVersion(); - console.log(version); - const versionFile = path.join(root, '.build', 'electron', 'version'); const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `v${version}`; + process.exit(isUpToDate ? 0 : 1); } diff --git a/package.json b/package.json index 9f89294570e..9d20d58974f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "code-oss-dev", "version": "1.19.0", - "electronVersion": "1.7.9", "distro": "4120b819fd97e23adef120e48ceaa7d47c213c2c", "author": { "name": "Microsoft Corporation" diff --git a/scripts/code-cli.bat b/scripts/code-cli.bat index d5e4f44b7d6..f08ddb744e0 100644 --- a/scripts/code-cli.bat +++ b/scripts/code-cli.bat @@ -13,14 +13,9 @@ set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"electronVersion\":.*" package.json') do set DESIREDVERSION=%%~a -set DESIREDVERSION=%DESIREDVERSION: "=% -set DESIREDVERSION=v%DESIREDVERSION:"=% -if exist .\.build\electron\version (set /p INSTALLEDVERSION=<.\.build\electron\version) else (set INSTALLEDVERSION="") - -:: Get electron -if not exist %CODE% node .\node_modules\gulp\bin\gulp.js electron -if not "%INSTALLEDVERSION%" == "%DESIREDVERSION%" node .\node_modules\gulp\bin\gulp.js electron +:: Download Electron if needed +node build\lib\electron.js +if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron :: Build if not exist out node .\node_modules\gulp\bin\gulp.js compile diff --git a/scripts/code-cli.sh b/scripts/code-cli.sh index 1995f490c41..89e518322fc 100755 --- a/scripts/code-cli.sh +++ b/scripts/code-cli.sh @@ -18,14 +18,11 @@ function code() { CODE=".build/electron/$NAME" fi - INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" - INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null` - # Node modules test -d node_modules || yarn # Get electron - (test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron + node build/lib/electron.js || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile diff --git a/scripts/code.bat b/scripts/code.bat index ca75c60acf5..3b403b1c64c 100644 --- a/scripts/code.bat +++ b/scripts/code.bat @@ -13,14 +13,9 @@ set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"electronVersion\":.*" package.json') do set DESIREDVERSION=%%~a -set DESIREDVERSION=%DESIREDVERSION: "=% -set DESIREDVERSION=v%DESIREDVERSION:"=% -if exist .\.build\electron\version (set /p INSTALLEDVERSION=<.\.build\electron\version) else (set INSTALLEDVERSION="") - -:: Get electron -if not exist %CODE% node .\node_modules\gulp\bin\gulp.js electron -if not "%INSTALLEDVERSION%" == "%DESIREDVERSION%" node .\node_modules\gulp\bin\gulp.js electron +:: Download Electron if needed +node build\lib\electron.js +if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron :: Build if not exist out node .\node_modules\gulp\bin\gulp.js compile diff --git a/scripts/code.sh b/scripts/code.sh index 70395aadfb6..6339ad06bd4 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -18,14 +18,11 @@ function code() { CODE=".build/electron/$NAME" fi - INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" - INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null` - # Node modules test -d node_modules || yarn # Get electron - (test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron + node build/lib/electron.js || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile diff --git a/scripts/env.ps1 b/scripts/env.ps1 index afd26f17baa..4f2d411c5c6 100644 --- a/scripts/env.ps1 +++ b/scripts/env.ps1 @@ -1,3 +1,3 @@ $env:npm_config_disturl="https://atom.io/download/electron" -$env:npm_config_target=(node -p "require('./package.json').electronVersion") +$env:npm_config_target=(node "build/lib/electron.js") $env:npm_config_runtime="electron" \ No newline at end of file diff --git a/scripts/env.sh b/scripts/env.sh index 35d09f66bb2..aa4acdf94e6 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -1,6 +1,6 @@ #!/bin/bash export npm_config_disturl=https://atom.io/download/electron -export npm_config_target=$(node -p "require('./package.json').electronVersion") +export npm_config_target=$(node "build/lib/electron.js") export npm_config_runtime=electron export npm_config_cache="$HOME/.npm-electron" mkdir -p "$npm_config_cache" \ No newline at end of file diff --git a/scripts/node-electron.sh b/scripts/node-electron.sh index a1c2cf469b0..febdb7cb896 100755 --- a/scripts/node-electron.sh +++ b/scripts/node-electron.sh @@ -17,12 +17,8 @@ else CODE=".build/electron/$NAME" fi -INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" -INSTALLED_VERSION=$(cat .build/electron/version 2> /dev/null) - - # Get electron -(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron +node build/lib/electron.js || ./node_modules/.bin/gulp electron export VSCODE_DEV=1 if [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/scripts/test.bat b/scripts/test.bat index 48ee90d108f..7f5f5f8df8e 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -12,13 +12,8 @@ set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" :: Download Electron if needed -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"electronVersion\":.*" package.json') do set DESIREDVERSION=%%~a -set DESIREDVERSION=%DESIREDVERSION: "=% -set DESIREDVERSION=v%DESIREDVERSION:"=% -if exist .\.build\electron\version (set /p INSTALLEDVERSION=<.\.build\electron\version) else (set INSTALLEDVERSION="") - -if not exist %CODE% node .\node_modules\gulp\bin\gulp.js electron -if not "%INSTALLEDVERSION%" == "%DESIREDVERSION%" node .\node_modules\gulp\bin\gulp.js electron +node build\lib\electron.js +if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron :: Run tests %CODE% .\test\electron\index.js %* diff --git a/scripts/test.sh b/scripts/test.sh index 43c515c205f..d88a28c5e2d 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -18,14 +18,11 @@ else CODE=".build/electron/$NAME" fi -INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" -INSTALLED_VERSION=$(cat .build/electron/version 2> /dev/null) - # Node modules test -d node_modules || yarn # Get electron -(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron +node build/lib/electron.js || ./node_modules/.bin/gulp electron # Unit Tests export ELECTRON_ENABLE_LOGGING=1