@@ -2,6 +2,22 @@ const fs = require('fs')
22const path = require ( 'path' )
33const childProcess = require ( 'child_process' )
44
5+ const exe = process . platform === 'win32' ? '.exe' : ''
6+ const binDir = path . join ( __dirname , 'bin' , `${ process . platform } -${ process . arch } ` )
7+
8+ const minidumpStackwalkDest = path . join ( binDir , 'minidump_stackwalk' ) + exe
9+ const minidumpDumpDest = path . join ( binDir , 'minidump_dump' ) + exe
10+ const dumpSymsDest = path . join ( binDir , 'dump_syms' ) + exe
11+
12+ // do not build if executables already exist
13+ if (
14+ fs . existsSync ( minidumpStackwalkDest ) &&
15+ fs . existsSync ( minidumpDumpDest ) &&
16+ fs . existsSync ( dumpSymsDest )
17+ ) {
18+ process . exit ( 0 )
19+ }
20+
521function spawnSync ( ...args ) {
622 const result = childProcess . spawnSync ( ...args )
723 if ( result . status !== 0 ) {
@@ -36,3 +52,23 @@ if (process.platform === 'darwin') {
3652 stdio : 'inherit'
3753 } )
3854}
55+
56+ // copy to bin folder
57+ if ( ! fs . existsSync ( binDir ) ) {
58+ fs . mkdirSync ( binDir , { recursive : true } )
59+ }
60+
61+ const minidumpStackwalk = path . resolve ( __dirname , 'build' , 'src' , 'processor' , 'minidump_stackwalk' ) + exe
62+ fs . copyFileSync ( minidumpStackwalk , minidumpStackwalkDest )
63+
64+ const minidumpDump = path . resolve ( __dirname , 'build' , 'src' , 'processor' , 'minidump_dump' ) + exe
65+ fs . copyFileSync ( minidumpDump , minidumpDumpDest )
66+
67+ const dumpSyms = ( ( ) => {
68+ if ( process . platform === 'darwin' ) {
69+ return path . resolve ( __dirname , 'deps' , 'breakpad' , 'src' , 'tools' , 'mac' , 'dump_syms' , 'build' , 'Release' , 'dump_syms' )
70+ } else if ( process . platform === 'linux' ) {
71+ return path . resolve ( __dirname , 'build' , 'src' , 'tools' , 'linux' , 'dump_syms' , 'dump_syms' )
72+ }
73+ } ) ( )
74+ fs . copyFileSync ( dumpSyms , dumpSymsDest )
0 commit comments