This commit is contained in:
Luis Blanco 2018-01-30 18:09:26 +03:00
parent 1f44e78a8d
commit c119d4e780
6 changed files with 29 additions and 23 deletions

View File

@ -42,9 +42,8 @@ dependency packages.
``` ```
'variables': { 'variables': {
'_rd' : '<!(node -e "console.log(require(\'addon-tools-raub\')._rd)")', 'rmrf' : '<!(node -e "console.log(require(\'addon-tools-raub\').rmrf)")',
'_md' : '<!(node -e "console.log(require(\'addon-tools-raub\')._md)")', 'mkdirp' : '<!(node -e "console.log(require(\'addon-tools-raub\').mkdirp)")',
'_del' : '<!(node -e "console.log(require(\'addon-tools-raub\')._del)")',
}, },
``` ```
@ -173,8 +172,9 @@ If you always copy your compiled addon to the `binary` directory, it will be eas
'<(module_root_dir)/binary/MY_ADDON.node' '<(module_root_dir)/binary/MY_ADDON.node'
] } ], ] } ],
[ 'OS=="win"', { 'action' : [ [ 'OS=="win"', { 'action' : [
'copy "<(module_root_dir)/build/Release/MY_ADDON.node"' + 'copy',
' "<(module_root_dir)/binary/MY_ADDON.node"' '<(module_root_dir)/build/Release/MY_ADDON.node' +
'<(module_root_dir)/binary/MY_ADDON.node'
] } ], ] } ],
], ],
}], }],
@ -533,25 +533,25 @@ input `dir`.
* `include` - include directory for this `dir`. * `include` - include directory for this `dir`.
* `root` - where `'addon-tools-raub'` module is situated. * `root` - where `'addon-tools-raub'` module is situated.
* `include` - `'addon-tools-raub'` own 'include' directory. * `include` - `'addon-tools-raub'` own 'include' directory.
* `_rd` - the location of `'_rd.bat'` file. * `rmrf` - the location of `'rmrf.bat'` file.
* `_md` - the location of `'_md.bat'` file. * `mkdirp` - the location of `'mkdirp.bat'` file.
* `_del` - the location of `'_del.bat'` file.
--- ---
## Windows BAT ## Windows BAT
Windows-only utilities. Because in gyp any `/` on Windows is converted to `\`, it is Windows-only utilities. Disregard `del` vs `rd` aspect of Windows command line.
impossible to put correct commands for file/directory removal. Those need such Now
parameters as `/Q`, but gyp makes them `\Q` which is inappropriate. So these files
simply contain their respective commands with all necessary parameters, avoiding any
conflict with gyp.
Also on Windows there is no `mkdir -p`, hence if directory exists you get an error Also on Windows there is no `mkdir -p`, hence if directory exists you get an error
trying to make it great again with `md`. trying to make it great again with `md`.
``` ```
'variables': {
'rmrf' : '<!(node -e "console.log(require(\'addon-tools-raub\').rmrf)")',
'mkdirp' : '<!(node -e "console.log(require(\'addon-tools-raub\').mkdirp)")',
},
... ...
[ 'OS=="mac"', { 'action' : [ [ 'OS=="mac"', { 'action' : [
'rm', 'rm',
@ -559,7 +559,7 @@ trying to make it great again with `md`.
'<(module_root_dir)/build/Release/addon.node' '<(module_root_dir)/build/Release/addon.node'
] } ], ] } ],
[ 'OS=="win"', { 'action' : [ [ 'OS=="win"', { 'action' : [
'<(_del)', '<(rmrf)',
'<(module_root_dir)/build/Release/addon.*', '<(module_root_dir)/build/Release/addon.*',
'<(module_root_dir)/build/Release/obj/addon/*.*' '<(module_root_dir)/build/Release/obj/addon/*.*'
] } ], ] } ],

View File

@ -1,3 +0,0 @@
for %%x in (%*) do (
if exist %%x del /f /q %%x
)

View File

@ -1,3 +0,0 @@
for %%x in (%*) do (
if exist %%x rd /s /q %%x
)

View File

@ -49,8 +49,7 @@ module.exports = {
printNan() { require('nan'); }, printNan() { require('nan'); },
_rd :`${thisDir}/_rd.bat`, mkdirp : `${thisDir}/mkdirp.bat`,
_md :`${thisDir}/_md.bat`, rmrf : `${thisDir}/rmrf.bat`,
_del :`${thisDir}/_del.bat`,
}; };

View File

13
rmrf.bat Normal file
View File

@ -0,0 +1,13 @@
for %%x in (%*) do (
if %%x=="-r" goto continue
if %%x=="-f" goto continue
if %%x=="-rf" goto continue
if exist %%~x\ rd /s /q %%x
if not exist %%~x\ if exist %%x del /f /q %%x
:continue
rem
)