Skip to content

Commit

Permalink
Get codebase building pre bundling
Browse files Browse the repository at this point in the history
This isn't totally complete, but enough to get everything building and
tests running manually. The next commit will make the build work fully.
  • Loading branch information
jakebailey committed Nov 6, 2022
1 parent ab93880 commit 760ae38
Show file tree
Hide file tree
Showing 71 changed files with 613 additions and 1,201 deletions.
22 changes: 16 additions & 6 deletions Gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const { src, dest, task, parallel, series, watch } = gulp;
const copyright = "CopyrightNotice.txt";
const cleanTasks = [];

const testRunner = "./built/local/testRunner/runner.js";

const buildScripts = () => buildProject("scripts");
task("scripts", buildScripts);
task("scripts").description = "Builds files in the 'scripts' folder.";
Expand Down Expand Up @@ -91,6 +93,14 @@ const localize = async () => {
}
};

const preSrc = parallel(generateLibs, series(buildScripts, generateDiagnostics, localize));
const buildSrc = () => buildProject("src");

task("build-src", series(preSrc, buildSrc));

const cleanSrc = () => cleanProject("src");
task("clean-src", cleanSrc);

const buildDebugTools = () => buildProject("src/debug");
const cleanDebugTools = () => cleanProject("src/debug");
cleanTasks.push(cleanDebugTools);
Expand Down Expand Up @@ -405,8 +415,8 @@ task("watch-local").flags = {
const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
preTest.displayName = "preTest";

const runTests = () => runConsoleTests("built/local/run.js", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
task("runtests", series(preBuild, preTest, runTests));
const runTests = () => runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
task("runtests", series(/*preBuild, preTest,*/ task("build-src"), runTests)); // TODO(jakebailey): fix this for modules
task("runtests").description = "Runs the tests using the built run.js file.";
task("runtests").flags = {
"-t --tests=<regex>": "Pattern for tests to run.",
Expand All @@ -424,8 +434,8 @@ task("runtests").flags = {
" --shardId": "1-based ID of this shard (default: 1)",
};

const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ cmdLineOptions.workers > 1, /*watchMode*/ false);
task("runtests-parallel", series(preBuild, preTest, runTestsParallel));
const runTestsParallel = () => runConsoleTests(testRunner, "min", /*runInParallel*/ cmdLineOptions.workers > 1, /*watchMode*/ false);
task("runtests-parallel", series(/*preBuild, preTest,*/ task("build-src"), runTestsParallel)); // TODO(jakebailey): fix this for modules
task("runtests-parallel").description = "Runs all the tests in parallel using the built run.js file.";
task("runtests-parallel").flags = {
" --light": "Run tests in light mode (fewer verifications, but tests run faster).",
Expand Down Expand Up @@ -550,10 +560,10 @@ task("publish-nightly").description = "Runs `npm publish --tag next` to create a
// write some kind of trigger file that indicates build completion that we could listen for instead.
const watchRuntests = () => watch(["built/local/*.js", "tests/cases/**/*.ts", "tests/cases/**/tsconfig.json"], { delay: 5000 }, async () => {
if (cmdLineOptions.tests || cmdLineOptions.failed) {
await runConsoleTests("built/local/run.js", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true);
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true);
}
else {
await runConsoleTests("built/local/run.js", "min", /*runInParallel*/ true, /*watchMode*/ true);
await runConsoleTests(testRunner, "min", /*runInParallel*/ true, /*watchMode*/ true);
}
});
task("watch", series(preBuild, preTest, parallel(watchLib, watchDiagnostics, watchServices, watchLssl, watchTests, watchRuntests)));
Expand Down
2 changes: 0 additions & 2 deletions src/cancellationToken/cancellationToken.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="node"/>

import * as fs from "fs";

interface ServerCancellationToken {
Expand Down
14 changes: 3 additions & 11 deletions src/cancellationToken/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"extends": "../tsconfig-noncomposite-base",
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local/",
"rootDir": ".",
"composite": false,
"declaration": false,
"declarationMap": false,
"removeComments": true,
"incremental": false,
"outDir": "../../built/local/cancellationToken",
"module": "commonjs",
"types": [
"node"
Expand All @@ -16,7 +10,5 @@
"es6"
]
},
"files": [
"cancellationToken.ts"
]
"include": ["**/*"]
}
9 changes: 8 additions & 1 deletion src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,14 @@ export let sys: System = (() => {
}
},
getExecutingFilePath() {
return __filename;
// This function previously returned a path like `built/local/tsc.js`.
// Now, with a module output, this file is now `built/local/compiler/sys.js`.
// We want to return a file that looks like the old one, so that callers
// can locate other assets like the lib.d.ts files.
//
// TODO(jakebailey): replace this function with one that returns the path
// to the lib folder (or package path)?.
return _path.join(_path.dirname(__dirname), "fake.js");
},
getCurrentDirectory,
getDirectories,
Expand Down
80 changes: 2 additions & 78 deletions src/compiler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,12 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"outDir": "../../built/local/compiler",
"types": ["node"]
},

"references": [
],

"files": [
"corePublic.ts",
"core.ts",
"debug.ts",
"semver.ts",
"performanceCore.ts",
"performance.ts",
"perfLogger.ts",
"tracing.ts",

"types.ts",
"sys.ts",
"path.ts",
"diagnosticInformationMap.generated.ts",
"scanner.ts",
"utilitiesPublic.ts",
"utilities.ts",
"factory/baseNodeFactory.ts",
"factory/parenthesizerRules.ts",
"factory/nodeConverters.ts",
"factory/nodeFactory.ts",
"factory/emitNode.ts",
"factory/emitHelpers.ts",
"factory/nodeTests.ts",
"factory/utilities.ts",
"factory/utilitiesPublic.ts",
"parser.ts",
"commandLineParser.ts",
"moduleNameResolver.ts",

"binder.ts",
"symbolWalker.ts",
"checker.ts",
"visitorPublic.ts",
"sourcemap.ts",
"transformers/utilities.ts",
"transformers/destructuring.ts",
"transformers/taggedTemplate.ts",
"transformers/ts.ts",
"transformers/classFields.ts",
"transformers/typeSerializer.ts",
"transformers/legacyDecorators.ts",
"transformers/es2017.ts",
"transformers/es2018.ts",
"transformers/es2019.ts",
"transformers/es2020.ts",
"transformers/es2021.ts",
"transformers/esnext.ts",
"transformers/jsx.ts",
"transformers/es2016.ts",
"transformers/es2015.ts",
"transformers/es5.ts",
"transformers/generators.ts",
"transformers/module/module.ts",
"transformers/module/system.ts",
"transformers/module/esnextAnd2015.ts",
"transformers/module/node.ts",
"transformers/declarations/diagnostics.ts",
"transformers/declarations.ts",
"transformer.ts",
"emitter.ts",
"watchUtilities.ts",
"program.ts",
"builderStatePublic.ts",
"builderState.ts",
"builder.ts",
"builderPublic.ts",
"resolutionCache.ts",
"moduleSpecifiers.ts",
"watch.ts",
"watchPublic.ts",
"tsbuild.ts",
"tsbuildPublic.ts",
"_namespaces/ts.ts",
"_namespaces/ts.moduleSpecifiers.ts",
"_namespaces/ts.performance.ts"
]
"include": ["**/*"]
}
10 changes: 0 additions & 10 deletions src/compiler/tsconfig.release.json

This file was deleted.

11 changes: 3 additions & 8 deletions src/debug/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
"extends": "../tsconfig-library-base",
"extends": "../tsconfig-base",
"compilerOptions": {
"target": "es2019",
"lib": ["es2019"],
"outDir": "../../built/local",
"declaration": false,
"sourceMap": true
"outDir": "../../built/local/debug"
},
"files": [
"dbg.ts",
"_namespaces/Debug.ts"
]
"include": ["**/*"]
}
18 changes: 3 additions & 15 deletions src/deprecatedCompat/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"experimentalDecorators": true
"outDir": "../../built/local/deprecatedCompat"
},
"references": [
{ "path": "../compiler" }
],
"files": [
"deprecations.ts",
"4.0/nodeFactoryTopLevelExports.ts",
"4.0/renamedNodeTests.ts",
"4.0/renamedMapInterfaces.ts",
"4.2/renamedNodeTests.ts",
"4.2/abstractConstructorTypes.ts",
"4.6/importTypeAssertions.ts",
"4.7/typeParameterModifiers.ts",
"4.8/mergeDecoratorsAndModifiers.ts",
"_namespaces/ts.ts"
]
}
"include": ["**/*"]
}
9 changes: 3 additions & 6 deletions src/dynamicImportCompat/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"extends": "../tsconfig-library-base",
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"outDir": "../../built/local/dynamicImportCompat",
"rootDir": ".",
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"declaration": false,
"sourceMap": true,
"tsBuildInfoFile": "../../built/local/dynamicImportCompat.tsbuildinfo"
"lib": ["esnext"]
},
"files": [
"dynamicImportCompat.ts",
Expand Down
7 changes: 2 additions & 5 deletions src/executeCommandLine/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local"
"outDir": "../../built/local/executeCommandLine"
},

"references": [
{ "path": "../compiler" }
],

"files": [
"executeCommandLine.ts",
"_namespaces/ts.ts"
]
"include": ["**/*"]
}
11 changes: 0 additions & 11 deletions src/executeCommandLine/tsconfig.release.json

This file was deleted.

42 changes: 2 additions & 40 deletions src/harness/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"outDir": "../../built/local/harness",
"types": [
"node", "mocha", "chai"
],
Expand All @@ -19,43 +19,5 @@
{ "path": "../deprecatedCompat" },
],

"files": [
"collectionsImpl.ts",
"util.ts",
"documentsUtil.ts",
"vpathUtil.ts",
"vfsUtil.ts",
"compilerImpl.ts",
"evaluatorImpl.ts",
"fakesHosts.ts",
"client.ts",
"findUpDir.ts",

"runnerbase.ts",
"sourceMapRecorder.ts",
"harnessGlobals.ts",
"harnessUtils.ts",
"harnessIO.ts",
"harnessLanguageService.ts",
"virtualFileSystemWithWatch.ts",
"fourslashImpl.ts",
"fourslashInterfaceImpl.ts",
"typeWriter.ts",
"_namespaces/ts.server.ts",
"_namespaces/ts.ts",
"_namespaces/collections.ts",
"_namespaces/compiler.ts",
"_namespaces/documents.ts",
"_namespaces/evaluator.ts",
"_namespaces/fakes.ts",
"_namespaces/Utils.ts",
"_namespaces/FourSlash.ts",
"_namespaces/FourSlashInterface.ts",
"_namespaces/Harness.ts",
"_namespaces/Harness.LanguageService.ts",
"_namespaces/Harness.SourceMapRecorder.ts",
"_namespaces/vfs.ts",
"_namespaces/ts.TestFSWithWatch.ts",
"_namespaces/vpath.ts"
]
"include": ["**/*"]
}
11 changes: 2 additions & 9 deletions src/jsTyping/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"outDir": "../../built/local/jsTyping",
"types": [
"node"
],
Expand All @@ -13,12 +13,5 @@
"references": [
{ "path": "../compiler" }
],
"files": [
"shared.ts",
"types.ts",
"jsTyping.ts",
"_namespaces/ts.JsTyping.ts",
"_namespaces/ts.ts",
"_namespaces/ts.server.ts"
]
"include": ["**/*"]
}
10 changes: 2 additions & 8 deletions src/loggedIO/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "../../built/local",
"outDir": "../../built/local/loggedIO",
"types": [
],
"lib": [
Expand All @@ -18,11 +18,5 @@
{ "path": "../harness" },
],

"files": [
"loggedIO.ts",
"_namespaces/Playback.ts",
"_namespaces/ts.server.ts",
"_namespaces/ts.ts",
"_namespaces/Harness.ts"
]
"include": ["**/*"]
}
Loading

0 comments on commit 760ae38

Please sign in to comment.