@@ -2,50 +2,31 @@ var promisify = require("promisify-node");
2
2
var path = require ( "path" ) ;
3
3
var fs = require ( "fs" ) ;
4
4
5
- var whichNativeNodish = require ( "which-native-nodish" ) ;
6
5
var prepareForBuild = require ( "./prepareForBuild" ) ;
7
6
8
7
var exec = promisify ( function ( command , opts , callback ) {
9
8
return require ( "child_process" ) . exec ( command , opts , callback ) ;
10
9
} ) ;
11
- var nwVersion = null ;
12
- var asVersion = null ;
13
10
14
11
var local = path . join . bind ( path , __dirname ) ;
15
12
16
- return whichNativeNodish ( ".." )
17
- . then ( function ( results ) {
18
- nwVersion = results . nwVersion ;
19
- asVersion = results . asVersion ;
20
- } )
21
- . then ( function ( ) {
22
- if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
23
- return prepareAndBuild ( ) ;
24
- }
25
- if ( process . env . BUILD_DEBUG ) {
26
- console . info ( "[nodegit] Doing a debug build, no fetching allowed." ) ;
27
- return prepareAndBuild ( ) ;
28
- }
29
- if ( process . env . BUILD_ONLY ) {
30
- console . info ( "[nodegit] BUILD_ONLY is set to true, no fetching allowed." ) ;
31
- return prepareAndBuild ( ) ;
32
- }
33
- var args = [ ] ;
34
- if ( asVersion ) {
35
- args . push ( "--runtime=electron" ) ;
36
- args . push ( "--target=" + asVersion ) ;
37
- args . push ( "--is_clang=1" ) ;
38
- } else if ( nwVersion ) {
39
- args . push ( "--runtime=node-webkit" ) ;
40
- args . push ( "--target=" + nwVersion ) ;
41
- }
42
- return installPrebuilt ( args ) ;
43
- } ) ;
13
+ if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
14
+ return prepareAndBuild ( ) ;
15
+ }
16
+ if ( process . env . BUILD_DEBUG ) {
17
+ console . info ( "[nodegit] Doing a debug build, no fetching allowed." ) ;
18
+ return prepareAndBuild ( ) ;
19
+ }
20
+ if ( process . env . BUILD_ONLY ) {
21
+ console . info ( "[nodegit] BUILD_ONLY is set to true, no fetching allowed." ) ;
22
+ return prepareAndBuild ( ) ;
23
+ }
44
24
45
- function installPrebuilt ( args ) {
25
+ return installPrebuilt ( ) ;
26
+
27
+ function installPrebuilt ( ) {
46
28
console . info ( "[nodegit] Fetching binary from S3." ) ;
47
- var installArguments = args . join ( " " ) ;
48
- return exec ( "node-pre-gyp install " + installArguments )
29
+ return exec ( "node-pre-gyp install --fallback-to-build=false" )
49
30
. then (
50
31
function ( ) {
51
32
console . info ( "[nodegit] Completed installation successfully." ) ;
@@ -70,44 +51,24 @@ function prepareAndBuild() {
70
51
71
52
function build ( ) {
72
53
console . info ( "[nodegit] Everything is ready to go, attempting compilation" ) ;
73
- if ( nwVersion ) {
74
- console . info ( "[nodegit] Building native node-webkit module." ) ;
75
- }
76
- else {
77
- console . info ( "[nodegit] Building native node module." ) ;
78
- }
79
54
80
55
var opts = {
81
56
cwd : "." ,
82
57
maxBuffer : Number . MAX_VALUE ,
83
58
env : process . env
84
59
} ;
85
60
86
- var target = "" ;
87
61
var debug = ( process . env . BUILD_DEBUG ? " --debug" : "" ) ;
88
62
var builder = "node-gyp" ;
89
- var distUrl = "" ;
90
-
91
- if ( asVersion ) {
92
- var home = process . platform == "win32" ?
93
- process . env . USERPROFILE : process . env . HOME ;
94
-
95
- opts . env . HOME = path . join ( home , ".atom-shell-gyp" ) ;
96
63
97
- target = "--target=" + asVersion ;
64
+ var home = process . platform == "win32" ?
65
+ process . env . USERPROFILE : process . env . HOME ;
98
66
99
- distUrl = "--dist-url=https://gh-contractor-zcbenz.s3." +
100
- "amazonaws.com/atom-shell/dist" ;
101
- }
102
- else if ( nwVersion ) {
103
- builder = "nw-gyp" ;
104
- target = "--target=" + nwVersion ;
105
- }
67
+ opts . env . HOME = path . join ( home , ".nodegit-gyp" ) ;
106
68
107
69
builder = path . resolve ( "." , "node_modules" , ".bin" , builder ) ;
108
70
builder = builder . replace ( / \s / g, "\\$&" ) ;
109
- var cmd = [ builder , "rebuild" , target , debug , distUrl ]
110
- . join ( " " ) . trim ( ) ;
71
+ var cmd = [ builder , "rebuild" , debug ] . join ( " " ) . trim ( ) ;
111
72
112
73
return exec ( cmd , opts )
113
74
. then ( function ( ) {
0 commit comments