Skip to content

Commit fb06fac

Browse files
committed
remove unused code
no install for cm* files in ci
1 parent 0487044 commit fb06fac

File tree

1 file changed

+4
-90
lines changed

1 file changed

+4
-90
lines changed

scripts/install.js

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ var path = require("path");
1717
var root_dir = path.join(__dirname, "..");
1818
var lib_dir = path.join(root_dir, "lib");
1919
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");
2220

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);
2824
}
29-
var is_windows = process.platform === 'win32'
25+
var is_windows = process.platform === "win32";
3026

3127
process.env.BS_RELEASE_BUILD = "true";
3228

@@ -90,67 +86,6 @@ function provideNinja() {
9086

9187
build_ninja();
9288
}
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-
}
15489

15590
/**
15691
*
@@ -163,24 +98,6 @@ function ensureExists(dir) {
16398
}
16499
}
165100

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-
}
184101

185102

186103
/**
@@ -217,7 +134,6 @@ function checkPrebuiltBscCompiler() {
217134
*/
218135
function buildLibs(stdlib) {
219136
ensureExists(lib_dir);
220-
ensureExists(ocaml_dir);
221137
ensureExists(path.join(lib_dir, "js"));
222138
ensureExists(path.join(lib_dir, "es6"));
223139
process.env.NINJA_IGNORE_GENERATOR = "true";
@@ -280,7 +196,6 @@ function provideCompiler() {
280196
// under windows require '.exe'
281197
var releaseNinja = require("./ninjaFactory.js").libNinja({
282198
ocamlopt: ocamlopt,
283-
ext: ".exe",
284199
INCL: myVersion,
285200
isWin: is_windows
286201
});
@@ -304,5 +219,4 @@ var stdlib = ocamlVersion.includes("4.02") ? "stdlib-402" : "stdlib-406";
304219

305220
if (process.env.BS_TRAVIS_CI) {
306221
buildLibs(stdlib);
307-
install(stdlib);
308222
}

0 commit comments

Comments
 (0)