@@ -17,16 +17,12 @@ var path = require("path");
17
17
var root_dir = path . join ( __dirname , ".." ) ;
18
18
var lib_dir = path . join ( root_dir , "lib" ) ;
19
19
var jscomp_dir = path . join ( root_dir , "jscomp" ) ;
20
- var runtime_dir = path . join ( jscomp_dir , "runtime" ) ;
21
- var others_dir = path . join ( jscomp_dir , "others" ) ;
22
20
23
- var ocaml_dir = path . join ( lib_dir , "ocaml" ) ;
24
-
25
- var supported_os = [ 'darwin' , 'freebsd' , 'linux' , 'win32' ]
26
- if ( supported_os . indexOf ( process . platform ) < 0 ) {
27
- throw new Error ( "Not supported platform" + process . platform )
21
+ var supported_os = [ "darwin" , "freebsd" , "linux" , "win32" ] ;
22
+ if ( supported_os . indexOf ( process . platform ) < 0 ) {
23
+ throw new Error ( "Not supported platform" + process . platform ) ;
28
24
}
29
- var is_windows = process . platform === ' win32'
25
+ var is_windows = process . platform === " win32" ;
30
26
31
27
process . env . BS_RELEASE_BUILD = "true" ;
32
28
@@ -90,67 +86,6 @@ function provideNinja() {
90
86
91
87
build_ninja ( ) ;
92
88
}
93
- /**
94
- *
95
- * @param {NodeJS.ErrnoException } err
96
- */
97
- function throwWhenError ( err ) {
98
- if ( err !== null ) {
99
- throw err ;
100
- }
101
- }
102
- /**
103
- *
104
- * @param {string } file
105
- * @param {string } target
106
- */
107
- function poorCopyFile ( file , target ) {
108
- var stat = fs . statSync ( file ) ;
109
- fs . createReadStream ( file ) . pipe (
110
- fs . createWriteStream ( target , { mode : stat . mode } )
111
- ) ;
112
- }
113
- /**
114
- * @type {(x:string,y:string)=>void }
115
- *
116
- */
117
- var installTrytoCopy ;
118
- if ( fs . copyFile !== undefined ) {
119
- installTrytoCopy = function ( x , y ) {
120
- fs . copyFile ( x , y , throwWhenError ) ;
121
- } ;
122
- } else if ( is_windows ) {
123
- installTrytoCopy = function ( x , y ) {
124
- fs . rename ( x , y , throwWhenError ) ;
125
- } ;
126
- } else {
127
- installTrytoCopy = function ( x , y ) {
128
- poorCopyFile ( x , y ) ;
129
- } ;
130
- }
131
-
132
- /**
133
- *
134
- * @param {string } src
135
- * @param {(file:string)=>boolean } filter
136
- * @param {string } dest
137
- */
138
- function installDirBy ( src , dest , filter ) {
139
- fs . readdir ( src , function ( err , files ) {
140
- if ( err === null ) {
141
- files . forEach ( function ( file ) {
142
- if ( filter ( file ) ) {
143
- var x = path . join ( src , file ) ;
144
- var y = path . join ( dest , file ) ;
145
- // console.log(x, '----->', y )
146
- installTrytoCopy ( x , y ) ;
147
- }
148
- } ) ;
149
- } else {
150
- throw err ;
151
- }
152
- } ) ;
153
- }
154
89
155
90
/**
156
91
*
@@ -163,24 +98,6 @@ function ensureExists(dir) {
163
98
}
164
99
}
165
100
166
- /**
167
- * @param {string } stdlib
168
- */
169
- function install ( stdlib ) {
170
- installDirBy ( runtime_dir , ocaml_dir , function ( file ) {
171
- var y = path . parse ( file ) ;
172
- return y . name === "js" || y . ext . includes ( "cm" ) ;
173
- } ) ;
174
- installDirBy ( others_dir , ocaml_dir , function ( file ) {
175
- var y = path . parse ( file ) ;
176
- return y . ext === ".ml" || y . ext === ".mli" || y . ext . includes ( "cm" ) ;
177
- } ) ;
178
- var stdlib_dir = path . join ( jscomp_dir , stdlib ) ;
179
- installDirBy ( stdlib_dir , ocaml_dir , function ( file ) {
180
- var y = path . parse ( file ) ;
181
- return y . ext === ".ml" || y . ext === ".mli" || y . ext . includes ( "cm" ) ;
182
- } ) ;
183
- }
184
101
185
102
186
103
/**
@@ -217,7 +134,6 @@ function checkPrebuiltBscCompiler() {
217
134
*/
218
135
function buildLibs ( stdlib ) {
219
136
ensureExists ( lib_dir ) ;
220
- ensureExists ( ocaml_dir ) ;
221
137
ensureExists ( path . join ( lib_dir , "js" ) ) ;
222
138
ensureExists ( path . join ( lib_dir , "es6" ) ) ;
223
139
process . env . NINJA_IGNORE_GENERATOR = "true" ;
@@ -280,7 +196,6 @@ function provideCompiler() {
280
196
// under windows require '.exe'
281
197
var releaseNinja = require ( "./ninjaFactory.js" ) . libNinja ( {
282
198
ocamlopt : ocamlopt ,
283
- ext : ".exe" ,
284
199
INCL : myVersion ,
285
200
isWin : is_windows
286
201
} ) ;
@@ -304,5 +219,4 @@ var stdlib = ocamlVersion.includes("4.02") ? "stdlib-402" : "stdlib-406";
304
219
305
220
if ( process . env . BS_TRAVIS_CI ) {
306
221
buildLibs ( stdlib ) ;
307
- install ( stdlib ) ;
308
222
}
0 commit comments