From 20724b34983bdd9f29e28f7f3fd0b2c584c8440d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 17 Sep 2018 10:58:33 -0700 Subject: [PATCH] Remove unused code from jakefile and gulpfile --- Gulpfile.js | 8 ++++---- Jakefile.js | 49 ++----------------------------------------------- tsconfig.json | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 51 deletions(-) create mode 100644 tsconfig.json diff --git a/Gulpfile.js b/Gulpfile.js index 704fbba444766..7e71f6d253db5 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -26,7 +26,7 @@ const exec = require("./scripts/build/exec"); const browserify = require("./scripts/build/browserify"); const prepend = require("./scripts/build/prepend"); const { removeSourceMaps } = require("./scripts/build/sourcemaps"); -const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex"); +const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex"); const { libraryTargets, generateLibs } = require("./scripts/build/lib"); const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests"); @@ -121,7 +121,7 @@ const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt .map(f => `built/local/${f}/diagnosticMessages.generated.json`) .concat(generatedLCGFile); -gulp.task(generatedLCGFile, /*help*/ false, [generateLocalizedDiagnosticMessagesJs, diagnosticInformationMapTs], (done) => { +gulp.task(generatedLCGFile, /*help*/ false, [generateLocalizedDiagnosticMessagesJs, diagnosticInformationMapTs], () => { if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) { return exec(host, [generateLocalizedDiagnosticMessagesJs, "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true }); } @@ -435,7 +435,7 @@ gulp.task( // Instrumented compiler const loggedIOTs = "src/harness/loggedIO.ts"; const loggedIOJs = "built/local/loggedIO.js"; -gulp.task(loggedIOJs, /*help*/ false, [], (done) => { +gulp.task(loggedIOJs, /*help*/ false, [], () => { return mkdirp("built/local/temp") .then(() => exec(host, ["lib/tsc.js", "--types", "--target es5", "--lib es5", "--outdir", "built/local/temp", loggedIOTs])) .then(() => { fs.renameSync(path.join("built/local/temp", "/harness/loggedIO.js"), loggedIOJs); }) @@ -585,7 +585,7 @@ gulp.task( project.waitForWorkToStart().then(() => { source.cancel(); }); - + if (cmdLineOptions.tests || cmdLineOptions.failed) { await runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, source.token); } diff --git a/Jakefile.js b/Jakefile.js index 6ecb67ab9ce49..439d5ef61db5b 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -24,12 +24,8 @@ else if (process.env.PATH !== undefined) { const host = process.env.TYPESCRIPT_HOST || process.env.host || "node"; -const locales = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]; - const defaultTestTimeout = 40000; -let useDebugMode = true; - const TaskNames = { local: "local", runtests: "runtests", @@ -115,19 +111,6 @@ const ConfigFileFor = { tsserverLibrary: "built/local/tsserverlibrary.tsconfig.json", }; -const ExpectedLKGFiles = [ - "tsc.js", - "tsserver.js", - "typescriptServices.js", - "typescriptServices.d.ts", - "typescript.js", - "typescript.d.ts", - "cancellationToken.js", - "typingsInstaller.js", - "protocol.d.ts", - "watchGuard.js" -]; - directory(Paths.builtLocal); // Local target to build the compiler and services @@ -275,16 +258,6 @@ task(TaskNames.publishInsiders, [TaskNames.coreBuild, TaskNames.configureInsider exec(cmd, () => complete()); }, { async: true }); -desc("Sets the release mode flag"); -task("release", function () { - useDebugMode = false; -}); - -desc("Clears the release mode flag"); -task("setDebugMode", function () { - useDebugMode = true; -}); - desc("Generates localized diagnostic messages"); task(TaskNames.localize, [Paths.generatedLCGFile]); @@ -520,7 +493,6 @@ function runConsoleTests(defaultReporter, runInParallel) { } let testTimeout = process.env.timeout || defaultTestTimeout; - const debug = process.env.debug || process.env["debug-brk"] || process.env.d; const inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i; const runners = process.env.runners || process.env.runner || process.env.ru; const tests = process.env.test || process.env.tests || process.env.t; @@ -592,7 +564,7 @@ function runConsoleTests(defaultReporter, runInParallel) { process.env.NODE_ENV = savedNodeEnv; Travis.measure(startTime); runLinterAndComplete(); - }, function (e, status) { + }, function (_e, status) { process.env.NODE_ENV = savedNodeEnv; Travis.measure(startTime); finish(status); @@ -608,7 +580,7 @@ function runConsoleTests(defaultReporter, runInParallel) { process.env.NODE_ENV = savedNodeEnv; Travis.measure(startTime); runLinterAndComplete(); - }, function (e, status) { + }, function (_e, status) { // Tests failed process.env.NODE_ENV = savedNodeEnv; Travis.measure(startTime); @@ -710,19 +682,6 @@ const Travis = { } }; -function buildLocalizedTargets() { - /** - * The localization target produces the two following transformations: - * 1. 'src\loc\lcl\\diagnosticMessages.generated.json.lcl' => 'built\local\\diagnosticMessages.generated.json' - * convert localized resources into a .json file the compiler can understand - * 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg' - * generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json - */ - const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"] - .map(f => path.join(Paths.builtLocal,f)) - .concat(path.dirname(Paths.generatedLCGFile)); -} - function toNs(diff) { return diff[0] * 1e9 + diff[1]; } @@ -844,10 +803,6 @@ function concatenateFiles(destinationFile, sourceFiles, extraContent) { fs.renameSync(temp, destinationFile); } -function appendToFile(path, content) { - fs.writeFileSync(path, readFileSync(path) + "\r\n" + content); -} - /** * * @param {string} path diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000000..cb1fc96a35415 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,16 @@ +{ + "files": [ + "Jakefile.js", + "Gulpfile.js" + ], + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "target": "esnext", + // TODO: "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noEmit": true, + "types": [] + }, +} \ No newline at end of file