Skip to content

Commit a887c6b

Browse files
authored
Remove unused (and sometimes broken) targets and scripts (#30054)
* Remove unused (and sometimes broken) targets and scripts * Remove browser-specific harness code
1 parent e982240 commit a887c6b

28 files changed

+34
-5382
lines changed

Gulpfile.js

+1-50
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ const merge2 = require("merge2");
1212
const mkdirp = require("mkdirp");
1313
const { src, dest, task, parallel, series, watch } = require("gulp");
1414
const { append, transform } = require("gulp-insert");
15-
const { browserify } = require("./scripts/build/browserify");
1615
const { prependFile } = require("./scripts/build/prepend");
1716
const { exec, readJson, needsUpdate, getDiffTool, getDirSize, flatten, rm } = require("./scripts/build/utils");
18-
const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
17+
const { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
1918
const { buildProject, cleanProject, watchProject } = require("./scripts/build/projects");
2019
const cmdLineOptions = require("./scripts/build/options");
2120

@@ -454,44 +453,6 @@ task("runtests-parallel").flags = {
454453
" --built": "Compile using the built version of the compiler.",
455454
};
456455

457-
const buildWebTestServer = () => buildProject("tests/webTestServer.tsconfig.json");
458-
const cleanWebTestServer = () => cleanProject("tests/webTestServer.tsconfig.json");
459-
cleanTasks.push(cleanWebTestServer);
460-
461-
const browserifyTests = () => src(["built/local/run.js"], { base: "built/local" })
462-
.pipe(newer("built/local/bundle.js"))
463-
.pipe(sourcemaps.init({ loadMaps: true }))
464-
.pipe(browserify())
465-
.pipe(rename("bundle.js"))
466-
.pipe(sourcemaps.write(".", /**@type {*}*/({ includeContent: false, destPath: "built/local" })))
467-
.pipe(dest("built/local"));
468-
469-
const runtestsBrowser = async () => {
470-
await cleanTestDirs();
471-
const { tests, runners, light } = cmdLineOptions;
472-
const testConfigFile = "test.config";
473-
await del([testConfigFile]);
474-
if (tests || runners || light) {
475-
writeTestConfigFile(tests, runners, light);
476-
}
477-
const args = ["tests/webTestServer.js"];
478-
if (cmdLineOptions.browser) {
479-
args.push(cmdLineOptions.browser);
480-
}
481-
if (tests) {
482-
args.push(JSON.stringify(tests));
483-
}
484-
await exec(process.execPath, args);
485-
};
486-
487-
task("runtests-browser", series(preBuild, parallel(buildTests, buildServices, buildLssl, buildWebTestServer), browserifyTests, runtestsBrowser));
488-
task("runtests-browser").description = "Runs the tests using the built run.js file like 'gulp runtests'.";
489-
task("runtests-browser").flags = {
490-
"-t --tests=<regex>": "pattern for tests to run",
491-
"-b --browser=<browser>": "Either 'IE' or 'chrome'",
492-
" --built": "Compile using the built version of the compiler.",
493-
};
494-
495456
task("diff", () => exec(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true }));
496457
task("diff").description = "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable";
497458

@@ -525,16 +486,6 @@ cleanTasks.push(cleanWebHost);
525486
task("clean-webhost", cleanWebHost);
526487
task("clean-webhost").description = "Cleans the outputs of the tsc web host";
527488

528-
// TODO(rbuckton): Determine if 'perftsc' is still in use.
529-
const buildPerfTsc = () => buildProject("tests/perftsc.tsconfig.json");
530-
task("perftsc", series(lkgPreBuild, buildPerfTsc));
531-
task("perftsc").description = "Builds augmented version of the compiler for perf tests";
532-
533-
const cleanPerfTsc = () => cleanProject("tests/perftsc.tsconfig.json");
534-
cleanTasks.push(cleanPerfTsc);
535-
task("clean-perftsc", cleanPerfTsc);
536-
task("clean-perftsc").description = "Cleans the outputs of the perftsc project";
537-
538489
const buildLoggedIO = async () => {
539490
mkdirp.sync("built/local/temp");
540491
await exec(process.execPath, ["lib/tsc", "--types", "--target", "es5", "--lib", "es5", "--outdir", "built/local/temp", "src/harness/loggedIO.ts"]);

scripts/browserify-optional.js

-24
This file was deleted.

scripts/build/browserify.js

-33
This file was deleted.

scripts/build/sourcemaps.js

-98
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,4 @@
11
// @ts-check
2-
/// <reference path="../types/ambient.d.ts" />
3-
4-
const path = require("path");
5-
const convertMap = require("convert-source-map");
6-
const applySourceMap = require("vinyl-sourcemaps-apply");
7-
const through2 = require("through2");
8-
9-
/**
10-
* @param {import("vinyl")} input
11-
* @param {string | Buffer} contents
12-
* @param {string | RawSourceMap} [sourceMap]
13-
*/
14-
function replaceContents(input, contents, sourceMap) {
15-
const output = input.clone();
16-
output.contents = typeof contents === "string" ? Buffer.from(contents, "utf8") : contents;
17-
if (input.sourceMap) {
18-
output.sourceMap = typeof input.sourceMap === "string" ? /**@type {RawSourceMap}*/(JSON.parse(input.sourceMap)) : input.sourceMap;
19-
if (typeof sourceMap === "string") {
20-
sourceMap = /** @type {RawSourceMap} */(JSON.parse(sourceMap));
21-
}
22-
else if (sourceMap === undefined) {
23-
const stringContents = typeof contents === "string" ? contents : contents.toString("utf8");
24-
const newSourceMapConverter = convertMap.fromSource(stringContents);
25-
if (newSourceMapConverter) {
26-
sourceMap = /** @type {RawSourceMap} */(newSourceMapConverter.toObject());
27-
output.contents = new Buffer(convertMap.removeMapFileComments(stringContents), "utf8");
28-
}
29-
}
30-
if (sourceMap) {
31-
const cwd = input.cwd || process.cwd();
32-
const base = input.base || cwd;
33-
const sourceRoot = output.sourceMap.sourceRoot;
34-
makeAbsoluteSourceMap(cwd, base, output.sourceMap);
35-
makeAbsoluteSourceMap(cwd, base, /** @type {RawSourceMap} */(sourceMap));
36-
applySourceMap(output, sourceMap);
37-
makeRelativeSourceMap(cwd, base, sourceRoot, output.sourceMap);
38-
}
39-
else {
40-
output.sourceMap = undefined;
41-
}
42-
}
43-
return output;
44-
}
45-
exports.replaceContents = replaceContents;
46-
47-
function removeSourceMaps() {
48-
return through2.obj((/**@type {import("vinyl")}*/file, _, cb) => {
49-
if (file.isBuffer()) {
50-
file.contents = Buffer.from(convertMap.removeMapFileComments(file.contents.toString("utf8")), "utf8");
51-
if (file.sourceMap) {
52-
file.sourceMap = undefined;
53-
}
54-
}
55-
cb(null, file);
56-
});
57-
}
58-
exports.removeSourceMaps = removeSourceMaps;
59-
60-
/**
61-
* @param {string | undefined} cwd
62-
* @param {string | undefined} base
63-
* @param {RawSourceMap} sourceMap
64-
*
65-
* @typedef {object} RawSourceMap
66-
* @property {string} version
67-
* @property {string} file
68-
* @property {string} [sourceRoot]
69-
* @property {string[]} sources
70-
* @property {string[]} [sourcesContent]
71-
* @property {string} mappings
72-
* @property {string[]} [names]
73-
*/
74-
function makeAbsoluteSourceMap(cwd = process.cwd(), base = "", sourceMap) {
75-
const sourceRoot = sourceMap.sourceRoot || "";
76-
const resolvedBase = path.resolve(cwd, base);
77-
const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot);
78-
sourceMap.file = path.resolve(resolvedBase, sourceMap.file).replace(/\\/g, "/");
79-
sourceMap.sources = sourceMap.sources.map(source => path.resolve(resolvedSourceRoot, source).replace(/\\/g, "/"));
80-
sourceMap.sourceRoot = "";
81-
}
82-
exports.makeAbsoluteSourceMap = makeAbsoluteSourceMap;
83-
84-
/**
85-
* @param {string | undefined} cwd
86-
* @param {string | undefined} base
87-
* @param {string} sourceRoot
88-
* @param {RawSourceMap} sourceMap
89-
*/
90-
function makeRelativeSourceMap(cwd = process.cwd(), base = "", sourceRoot, sourceMap) {
91-
makeAbsoluteSourceMap(cwd, base, sourceMap);
92-
const resolvedBase = path.resolve(cwd, base);
93-
const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot);
94-
sourceMap.file = path.relative(resolvedBase, sourceMap.file).replace(/\\/g, "/");
95-
sourceMap.sources = sourceMap.sources.map(source => path.relative(resolvedSourceRoot, source).replace(/\\/g, "/"));
96-
sourceMap.sourceRoot = sourceRoot;
97-
}
98-
exports.makeRelativeSourceMap = makeRelativeSourceMap;
99-
1002
/**
1013
* @param {string} message
1024
* @returns {never}

scripts/createBenchmark.ts

-124
This file was deleted.

0 commit comments

Comments
 (0)