File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -67,20 +67,52 @@ function prepareAndBuild() {
67
67
function build ( ) {
68
68
console . info ( "[nodegit] Everything is ready to go, attempting compilation" ) ;
69
69
70
+ var electronVersion = process . env . ELECTRON_VERSION ;
71
+ var nwjsVersion = process . env . NWJS_VERSION ;
70
72
var opts = {
71
73
cwd : "." ,
72
74
maxBuffer : Number . MAX_VALUE ,
73
75
env : process . env
74
76
} ;
75
77
78
+ var builder = "node-gyp" ;
76
79
var debug = ( process . env . BUILD_DEBUG ? " --debug" : "" ) ;
80
+ var target ;
81
+ var distUrl ;
82
+
83
+ process . argv . forEach ( function ( arg ) {
84
+ if ( ~ arg . indexOf ( "electronVersion" ) ) {
85
+ electronVersion = arg . split ( "=" ) [ 1 ] . trim ( ) ;
86
+ }
87
+ else if ( ~ arg . indexOf ( "nsjwVersion" ) ) {
88
+ nwjsVersion = arg . split ( "=" ) [ 1 ] . trim ( ) ;
89
+ }
90
+ } ) ;
91
+
92
+ if ( electronVersion ) {
93
+ target = "--target=" + electronVersion ;
94
+ distUrl = "--dist-url=https://gh-contractor-zcbenz.s3." +
95
+ "amazonaws.com/atom-shell/dist" ;
96
+ }
97
+ else if ( nwjsVersion ) {
98
+ builder = "nw-gyp" ;
99
+ target = "--target=" + nwjsVersion ;
100
+ }
77
101
78
102
var home = process . platform == "win32" ?
79
103
process . env . USERPROFILE : process . env . HOME ;
80
104
81
105
opts . env . HOME = path . join ( home , ".nodegit-gyp" ) ;
82
106
83
- var cmd = [ pathForTool ( "node-gyp" ) , "rebuild" , debug ] . join ( " " ) . trim ( ) ;
107
+ var cmd = [
108
+ pathForTool ( builder ) ,
109
+ "rebuild" ,
110
+ debug ,
111
+ target ,
112
+ distUrl
113
+ ]
114
+ . join ( " " )
115
+ . trim ( ) ;
84
116
85
117
return exec ( cmd , opts )
86
118
. then ( function ( ) {
You can’t perform that action at this time.
0 commit comments