Skip to content

Commit b49da00

Browse files
committedFeb 18, 2020
remove unused code
1 parent 7d9d9a9 commit b49da00

File tree

2 files changed

+6
-58
lines changed

2 files changed

+6
-58
lines changed
 

‎scripts/ciTest.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ if (all) {
4141
bsbTest = true;
4242
}
4343

44-
var os = require("os");
44+
4545
var fs = require("fs");
4646

47-
// TODO: seems it is never used, remove it later
48-
var ninjaPath = "";
4947

5048
function init() {
5149
var vendorOCamlPath = path.join(

‎scripts/install.js

+5-55
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ var runtime_dir = path.join(jscomp_dir, "runtime");
2121
var others_dir = path.join(jscomp_dir, "others");
2222

2323
var ocaml_dir = path.join(lib_dir, "ocaml");
24-
var config = require("./config.js");
2524

26-
var is_windows = config.is_windows;
27-
var sys_extension = config.sys_extension;
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)
28+
}
29+
var is_windows = process.platform === 'win32'
2830

2931
process.env.BS_RELEASE_BUILD = "true";
3032

3133
var ninja_bin_output = path.join(root_dir, process.platform, "ninja.exe");
32-
var preBuiltCompilerArtifacts = ["bsc", "bsb", "bsb_helper", "bsppx", "refmt"];
3334

3435
/**
3536
* Make sure `ninja_bin_output` exists
@@ -181,57 +182,6 @@ function install(stdlib) {
181182
});
182183
}
183184

184-
/**
185-
*
186-
* @param {string} sys_extension
187-
*
188-
*/
189-
function copyPrebuiltCompilersForUnix(sys_extension) {
190-
var output = `
191-
rule cp
192-
command = cp $in $out
193-
`;
194-
output += preBuiltCompilerArtifacts
195-
.map(function(x) {
196-
return `build ${x}.exe: cp ${x}${sys_extension}`;
197-
})
198-
.join("\n");
199-
output += "\n";
200-
201-
var filePath = path.join(lib_dir, "copy.ninja");
202-
fs.writeFileSync(filePath, output, "ascii");
203-
cp.execFileSync(ninja_bin_output, ["-f", "copy.ninja"], {
204-
cwd: lib_dir,
205-
stdio: [0, 1, 2]
206-
});
207-
fs.unlinkSync(filePath);
208-
}
209-
210-
/**
211-
*
212-
* @param {string} sys_extension
213-
*
214-
*/
215-
function copyPrebuiltCompilersForWindows(sys_extension) {
216-
preBuiltCompilerArtifacts.forEach(function(x) {
217-
fs.copyFileSync(
218-
path.join(lib_dir, `${x}${sys_extension}`),
219-
path.join(lib_dir, `${x}.exe`)
220-
);
221-
});
222-
}
223-
224-
function copyPrebuiltCompilers() {
225-
switch (sys_extension) {
226-
case ".win32":
227-
copyPrebuiltCompilersForWindows(sys_extension);
228-
break;
229-
230-
default:
231-
copyPrebuiltCompilersForUnix(sys_extension);
232-
break;
233-
}
234-
}
235185

236186
/**
237187
* @returns {string|undefined}

0 commit comments

Comments
 (0)
Please sign in to comment.