@@ -9,8 +9,9 @@ const klaw = require('klaw');
99const minimist = require ( 'minimist' ) ;
1010const path = require ( 'path' ) ;
1111
12- const SOURCE_ROOT = path . normalize ( path . dirname ( __dirname ) ) ;
13- const DEPOT_TOOLS = path . resolve ( SOURCE_ROOT , '..' , 'third_party' , 'depot_tools' ) ;
12+ const ELECTRON_ROOT = path . normalize ( path . dirname ( __dirname ) ) ;
13+ const SOURCE_ROOT = path . resolve ( ELECTRON_ROOT , '..' ) ;
14+ const DEPOT_TOOLS = path . resolve ( SOURCE_ROOT , 'third_party' , 'depot_tools' ) ;
1415
1516const IGNORELIST = new Set ( [
1617 [ 'shell' , 'browser' , 'resources' , 'win' , 'resource.h' ] ,
@@ -19,7 +20,7 @@ const IGNORELIST = new Set([
1920 [ 'spec' , 'ts-smoke' , 'electron' , 'main.ts' ] ,
2021 [ 'spec' , 'ts-smoke' , 'electron' , 'renderer.ts' ] ,
2122 [ 'spec' , 'ts-smoke' , 'runner.js' ]
22- ] . map ( tokens => path . join ( SOURCE_ROOT , ...tokens ) ) ) ;
23+ ] . map ( tokens => path . join ( ELECTRON_ROOT , ...tokens ) ) ) ;
2324
2425const IS_WINDOWS = process . platform === 'win32' ;
2526
@@ -101,7 +102,7 @@ const LINTERS = [{
101102 run : ( opts , filenames ) => {
102103 const rcfile = path . join ( DEPOT_TOOLS , 'pylintrc' ) ;
103104 const args = [ '--rcfile=' + rcfile , ...filenames ] ;
104- const env = Object . assign ( { PYTHONPATH : path . join ( SOURCE_ROOT , 'script' ) } , process . env ) ;
105+ const env = Object . assign ( { PYTHONPATH : path . join ( ELECTRON_ROOT , 'script' ) } , process . env ) ;
105106 spawnAndCheckExitCode ( 'pylint' , args , { env } ) ;
106107 }
107108} , {
@@ -142,7 +143,7 @@ const LINTERS = [{
142143 run : ( opts , filenames ) => {
143144 const allOk = filenames . map ( filename => {
144145 const env = Object . assign ( {
145- CHROMIUM_BUILDTOOLS_PATH : path . resolve ( SOURCE_ROOT , '..' , 'buildtools' ) ,
146+ CHROMIUM_BUILDTOOLS_PATH : path . resolve ( ELECTRON_ROOT , '..' , 'buildtools' ) ,
146147 DEPOT_TOOLS_WIN_TOOLCHAIN : '0'
147148 } , process . env ) ;
148149 // Users may not have depot_tools in PATH.
@@ -277,7 +278,7 @@ async function findFiles (args, linter) {
277278
278279 // build the includelist
279280 if ( args . changed ) {
280- includelist = await findChangedFiles ( SOURCE_ROOT ) ;
281+ includelist = await findChangedFiles ( ELECTRON_ROOT ) ;
281282 if ( ! includelist . size ) {
282283 return [ ] ;
283284 }
@@ -287,12 +288,12 @@ async function findFiles (args, linter) {
287288
288289 // accumulate the raw list of files
289290 for ( const root of linter . roots ) {
290- const files = await findMatchingFiles ( path . join ( SOURCE_ROOT , root ) , linter . test ) ;
291+ const files = await findMatchingFiles ( path . join ( ELECTRON_ROOT , root ) , linter . test ) ;
291292 filenames . push ( ...files ) ;
292293 }
293294
294295 for ( const ignoreRoot of ( linter . ignoreRoots ) || [ ] ) {
295- const ignorePath = path . join ( SOURCE_ROOT , ignoreRoot ) ;
296+ const ignorePath = path . join ( ELECTRON_ROOT , ignoreRoot ) ;
296297 if ( ! fs . existsSync ( ignorePath ) ) continue ;
297298
298299 const ignoreFiles = new Set ( await findMatchingFiles ( ignorePath , linter . test ) ) ;
@@ -310,7 +311,7 @@ async function findFiles (args, linter) {
310311 // it's important that filenames be relative otherwise clang-format will
311312 // produce patches with absolute paths in them, which `git apply` will refuse
312313 // to apply.
313- return filenames . map ( x => path . relative ( SOURCE_ROOT , x ) ) ;
314+ return filenames . map ( x => path . relative ( ELECTRON_ROOT , x ) ) ;
314315}
315316
316317async function main ( ) {
0 commit comments