Skip to content

Commit 1cfb5a0

Browse files
committed
remove unused code
1 parent cb761f3 commit 1cfb5a0

File tree

1 file changed

+21
-55
lines changed

1 file changed

+21
-55
lines changed

scripts/ninja.js

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ o core/js_map.ml: p4of core/js_map.mlp | core/j.ml
4444
* @returns {boolean}
4545
*/
4646
function hasCamlp4() {
47-
// console.log(`camlp4of ${process.env.PATH}`)
47+
// console.log(`camlp4of ${process.env.PATH}`)
4848
try {
4949
console.log(cp.execSync(`camlp4of -v`, { encoding: "ascii" }));
5050
return true;
@@ -100,7 +100,6 @@ function generateVisitorPattern() {
100100
* need do test build in CI either
101101
*
102102
*/
103-
var useEnv = false;
104103

105104
/**
106105
* Note this file is not used in ninja file
@@ -109,7 +108,7 @@ var useEnv = false;
109108
* Note ocamldep.opt has built-in macro handling OCAML_VERSION
110109
*/
111110
var getOcamldepFile = () => {
112-
if (useEnv || process.env.ESY === "true") {
111+
if (process.env.ESY === "true") {
113112
return `ocamldep.opt`;
114113
} else {
115114
return path.join(
@@ -867,11 +866,7 @@ var compilerTarget = pseudoTarget(COMPILIER);
867866
async function runtimeNinja(devmode = true) {
868867
var ninjaCwd = "runtime";
869868
var externalDeps = devmode ? [compilerTarget] : [];
870-
var ninjaOutput = devmode
871-
? useEnv
872-
? "env.ninja"
873-
: "build.ninja"
874-
: "release.ninja";
869+
var ninjaOutput = devmode ? "build.ninja" : "release.ninja";
875870
var templateRuntimeRules = `
876871
bsc_no_open_flags = ${commonBsFlags} -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:lib/js -bs-package-output es6:lib/es6 -nopervasives -unsafe -w +50 -warn-error A
877872
bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini
@@ -964,11 +959,7 @@ rule ${mllRuleName}
964959
`;
965960
async function othersNinja(devmode = true) {
966961
var externalDeps = [runtimeTarget];
967-
var ninjaOutput = devmode
968-
? useEnv
969-
? "env.ninja"
970-
: "build.ninja"
971-
: "release.ninja";
962+
var ninjaOutput = devmode ? "build.ninja" : "release.ninja";
972963
var ninjaCwd = "others";
973964

974965
var templateOthersRules = `
@@ -1087,11 +1078,7 @@ async function stdlibNinja(devmode = true) {
10871078
var ninjaCwd = stdlibVersion;
10881079
var stdlibDir = path.join(jscompDir, stdlibVersion);
10891080
var externalDeps = [othersTarget];
1090-
var ninjaOutput = devmode
1091-
? useEnv
1092-
? "env.ninja"
1093-
: "build.ninja"
1094-
: "release.ninja";
1081+
var ninjaOutput = devmode ? "build.ninja" : "release.ninja";
10951082
var bsc_flags = "bsc_flags";
10961083
/**
10971084
* @type [string,string][]
@@ -1232,7 +1219,7 @@ function baseName(x) {
12321219
* @returns {Promise<void>}
12331220
*/
12341221
async function testNinja() {
1235-
var ninjaOutput = useEnv ? "env.ninja" : "build.ninja";
1222+
var ninjaOutput = "build.ninja";
12361223
var ninjaCwd = `test`;
12371224
var templateTestRules = `
12381225
bsc_flags = -absname -bs-no-version-header -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I $stdlib -I others
@@ -1392,32 +1379,15 @@ function sortFilesByDeps(domain, dependency_graph) {
13921379
}
13931380

13941381
function updateRelease() {
1395-
if (!useEnv) {
1396-
runtimeNinja(false);
1397-
stdlibNinja(false);
1398-
othersNinja(false);
1399-
}
1382+
runtimeNinja(false);
1383+
stdlibNinja(false);
1384+
othersNinja(false);
14001385
}
14011386

14021387
function updateDev() {
1403-
if (useEnv) {
1404-
writeFileAscii(
1405-
path.join(jscompDir, "env.ninja"),
1406-
`
1407-
${getEnnvConfigNinja()}
1408-
stdlib = ${version6() ? `stdlib-406` : `stdlib-402`}
1409-
subninja compilerEnv.ninja
1410-
subninja runtime/env.ninja
1411-
subninja others/env.ninja
1412-
subninja $stdlib/env.ninja
1413-
subninja test/env.ninja
1414-
o all: phony runtime others $stdlib test
1415-
`
1416-
);
1417-
} else {
1418-
writeFileAscii(
1419-
path.join(jscompDir, "build.ninja"),
1420-
`
1388+
writeFileAscii(
1389+
path.join(jscompDir, "build.ninja"),
1390+
`
14211391
${getVendorConfigNinja()}
14221392
stdlib = ${version6() ? `stdlib-406` : `stdlib-402`}
14231393
${BSC_COMPILER}
@@ -1428,17 +1398,17 @@ subninja $stdlib/build.ninja
14281398
subninja test/build.ninja
14291399
o all: phony runtime others $stdlib test
14301400
`
1431-
);
1432-
writeFileAscii(
1433-
path.join(jscompDir, "..", "lib", "build.ninja"),
1434-
`
1401+
);
1402+
writeFileAscii(
1403+
path.join(jscompDir, "..", "lib", "build.ninja"),
1404+
`
14351405
ocamlopt = ocamlopt.opt
14361406
ext = exe
14371407
INCL= ${version6() ? "4.06.1+BS" : "4.02.3+BS"}
14381408
include body.ninja
14391409
`
1440-
);
1441-
}
1410+
);
1411+
14421412
preprocessorNinjaSync();
14431413
nativeNinja();
14441414
runtimeNinja();
@@ -1509,7 +1479,7 @@ ocaml = ocaml
15091479
* @returns {string}
15101480
*/
15111481
function getPreprocessorFileName() {
1512-
return useEnv ? "cppoEnv.ninja" : "cppoVendor.ninja";
1482+
return "cppoVendor.ninja";
15131483
}
15141484
/**
15151485
* Built cppo.exe refmt.exe etc for dev purpose
@@ -1523,7 +1493,7 @@ function preprocessorNinjaSync() {
15231493
.map((file) => `o napkin/${file} : copy ../syntax/src/${file}`)
15241494
.join("\n");
15251495
var cppoNative = `
1526-
${useEnv ? getEnnvConfigNinja() : getVendorConfigNinja()}
1496+
${getVendorConfigNinja()}
15271497
rule link
15281498
command = $ocamlopt -g -I +compiler-libs $flags $libs $in -o $out
15291499
o ${cppoFile}: link ${cppoMonoFile}
@@ -1584,7 +1554,7 @@ ${buildNapkinFiles}
15841554
* an effect on depfile
15851555
*/
15861556
function nativeNinja() {
1587-
var ninjaOutput = useEnv ? "compilerEnv.ninja" : "compiler.ninja";
1557+
var ninjaOutput = "compiler.ninja";
15881558
var sourceDirs = [
15891559
"stubs",
15901560
"ext",
@@ -1774,10 +1744,6 @@ function main() {
17741744
var emptyCount = 2;
17751745
var isPlayground = false;
17761746
if (require.main === module) {
1777-
if (process.argv.includes("-env")) {
1778-
useEnv = true;
1779-
emptyCount++;
1780-
}
17811747
if (process.argv.includes("-check")) {
17821748
checkEffect();
17831749
}

0 commit comments

Comments
 (0)