@@ -114,21 +114,24 @@ function tryToProvideOCamlCompiler() {
114
114
}
115
115
}
116
116
117
- function non_windows_npm_release ( ) {
117
+ // copy all [*.sys_extension] files into [*.exe]
118
+ function copyBinToExe ( ) {
119
+ var indeed_windows_release = 0
120
+ fs . readdirSync ( lib_dir ) . forEach ( function ( f ) {
121
+ var last_index = f . lastIndexOf ( sys_extension )
122
+ if ( last_index !== - 1 ) {
123
+ var new_file = f . slice ( 0 , - sys_extension . length ) + ".exe"
124
+ build_util . poor_copy_sync ( path . join ( lib_dir , f ) , path . join ( lib_dir , new_file ) ) ;
125
+ // we do have .win file which means windows npm release
126
+ ++ indeed_windows_release
127
+ }
118
128
119
- if ( checkPrebuilt ( ) ) {
120
- child_process . execSync ( make + " libs && " + make + " install" , root_dir_config )
121
- } else {
122
- tryToProvideOCamlCompiler ( )
123
- child_process . execSync ( make + " world && " + make + " install" , root_dir_config )
124
- }
129
+ } )
130
+ return indeed_windows_release > 1
125
131
}
132
+
126
133
function checkPrebuilt ( ) {
127
134
try {
128
- if ( fs . existsSync ( path . join ( lib_dir , 'bsc.exe' ) ) ) {
129
- console . log ( 'Found bsc.exe, assume it was already built' )
130
- return true // already built before
131
- }
132
135
var version = child_process . execFileSync ( path . join ( lib_dir , 'bsc' + sys_extension ) , [ '-v' ] )
133
136
console . log ( "checkoutput:" , String ( version ) )
134
137
return copyBinToExe ( )
@@ -138,20 +141,21 @@ function checkPrebuilt() {
138
141
}
139
142
}
140
143
141
- function copyBinToExe ( ) {
142
- var indeed_windows_release = 0
143
- fs . readdirSync ( lib_dir ) . forEach ( function ( f ) {
144
- var last_index = f . lastIndexOf ( sys_extension )
145
- if ( last_index !== - 1 ) {
146
- var new_file = f . slice ( 0 , - sys_extension . length ) + ".exe"
147
- build_util . poor_copy_sync ( path . join ( lib_dir , f ) , path . join ( lib_dir , new_file ) ) ;
148
- // we do have .win file which means windows npm release
149
- ++ indeed_windows_release
150
- }
151
144
152
- } )
153
- return indeed_windows_release > 1
145
+
146
+ function non_windows_npm_release ( ) {
147
+ if ( fs . existsSync ( path . join ( lib_dir , 'bsc.exe' ) ) ) {
148
+ console . log ( 'Found bsc.exe, assume it was already built' )
149
+ return true // already built before
150
+ }
151
+ if ( checkPrebuilt ( ) ) {
152
+ child_process . execSync ( make + " libs && " + make + " install" , root_dir_config )
153
+ } else {
154
+ tryToProvideOCamlCompiler ( )
155
+ child_process . execSync ( make + " world && " + make + " install" , root_dir_config )
156
+ }
154
157
}
158
+
155
159
var build_util = require ( './build_util.js' )
156
160
157
161
setUpNinja ( )
@@ -161,7 +165,6 @@ if (is_windows) {
161
165
path . join ( __dirname , 'win_build.bat' ) ,
162
166
{ cwd : path . join ( root_dir , 'jscomp' ) , stdio : [ 0 , 1 , 2 ] }
163
167
)
164
- // clean.clean()
165
168
console . log ( "Installing" )
166
169
build_util . install ( )
167
170
} else {
0 commit comments