Skip to content

Commit

Permalink
Merge branch 'master' into transformFlagCleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Mar 7, 2019
2 parents 1f212ec + d2364f5 commit 8e5178d
Show file tree
Hide file tree
Showing 473 changed files with 31,696 additions and 13,467 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Here's a checklist you might find useful.
* [ ] There is an associated issue that is labeled
'Bug' or 'help wanted' or is in the Community milestone
* [ ] Code is up-to-date with the `master` branch
* [ ] You've successfully run `jake runtests` locally
* [ ] You've successfully run `gulp runtests` locally
* [ ] You've signed the CLA
* [ ] There are new or updated unit tests validating the change
Expand Down
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ tests
tslint.json
Jakefile.js
.editorconfig
.failed-tests
.git
.git/
.gitattributes
.github/
.gitmodules
.settings/
.travis.yml
Expand All @@ -23,6 +27,5 @@ Jakefile.js
test.config
package-lock.json
yarn.lock
.github/
CONTRIBUTING.md
TEST-results.xml
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ language: node_js
node_js:
- 'node'
- '10'
- '6'

sudo: false
- '8'

env:
- workerCount=3 timeout=600000
Expand Down
30 changes: 15 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The TypeScript repository is relatively large. To save some time, you might want

### Using local builds

Run `gulp build` to build a version of the compiler/language service that reflects changes you've made. You can then run `node <repo-root>/built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`.
Run `gulp` to build a version of the compiler/language service that reflects changes you've made. You can then run `node <repo-root>/built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`.

## Contributing bug fixes

Expand Down Expand Up @@ -104,7 +104,7 @@ Any changes should be made to [src/lib](https://github.com/Microsoft/TypeScript/
Library files in `built/local/` are updated automatically by running the standard build task:

```sh
jake
gulp
```

The files in `lib/` are used to bootstrap compilation and usually **should not** be updated unless publishing a new version or updating the LKG.
Expand All @@ -115,49 +115,49 @@ The files `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` bo

## Running the Tests

To run all tests, invoke the `runtests-parallel` target using jake:
To run all tests, invoke the `runtests-parallel` target using gulp:

```Shell
jake runtests-parallel
gulp runtests-parallel
```

This will run all tests; to run only a specific subset of tests, use:

```Shell
jake runtests tests=<regex>
gulp runtests --tests=<regex>
```

e.g. to run all compiler baseline tests:

```Shell
jake runtests tests=compiler
gulp runtests --tests=compiler
```

or to run a specific test: `tests\cases\compiler\2dArrays.ts`

```Shell
jake runtests tests=2dArrays
gulp runtests --tests=2dArrays
```

## Debugging the tests

To debug the tests, invoke the `runtests-browser` task from jake.
To debug the tests, invoke the `runtests-browser` task from gulp.
You will probably only want to debug one test at a time:

```Shell
jake runtests-browser tests=2dArrays
gulp runtests-browser --tests=2dArrays
```

You can specify which browser to use for debugging. Currently Chrome and IE are supported:

```Shell
jake runtests-browser tests=2dArrays browser=chrome
gulp runtests-browser --tests=2dArrays --browser=chrome
```

You can debug with VS Code or Node instead with `jake runtests inspect=true`:
You can debug with VS Code or Node instead with `gulp runtests --inspect=true`:

```Shell
jake runtests tests=2dArrays inspect=true
gulp runtests --tests=2dArrays --inspect=true
```

## Adding a Test
Expand Down Expand Up @@ -197,20 +197,20 @@ Compiler testcases generate baselines that track the emitted `.js`, the errors p
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use

```Shell
jake diff
gulp diff
```

After verifying that the changes in the baselines are correct, run

```Shell
jake baseline-accept
gulp baseline-accept
```

to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines.

## Localization

All strings the user may see are stored in [`diagnosticMessages.json`](./src/compiler/diagnosticMessages.json).
If you make changes to it, run `jake generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`.
If you make changes to it, run `gulp generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`.

See [coding guidelines on diagnostic messages](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#diagnostic-messages).
74 changes: 41 additions & 33 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ task("watch-tsserver").flags = {
" --built": "Compile using the built version of the compiler."
}

task("min", series(lkgPreBuild, parallel(buildTsc, buildServer)));
task("min", series(preBuild, parallel(buildTsc, buildServer)));
task("min").description = "Builds only tsc and tsserver";
task("min").flags = {
" --built": "Compile using the built version of the compiler."
Expand Down Expand Up @@ -373,9 +373,34 @@ task("lint").flags = {
" --f[iles]=<regex>": "pattern to match files to lint",
};

const buildCancellationToken = () => buildProject("src/cancellationToken");
const cleanCancellationToken = () => cleanProject("src/cancellationToken");
cleanTasks.push(cleanCancellationToken);

const buildTypingsInstaller = () => buildProject("src/typingsInstaller");
const cleanTypingsInstaller = () => cleanProject("src/typingsInstaller");
cleanTasks.push(cleanTypingsInstaller);

const buildWatchGuard = () => buildProject("src/watchGuard");
const cleanWatchGuard = () => cleanProject("src/watchGuard");
cleanTasks.push(cleanWatchGuard);

const generateTypesMap = () => src("src/server/typesMap.json")
.pipe(newer("built/local/typesMap.json"))
.pipe(transform(contents => (JSON.parse(contents), contents))) // validates typesMap.json is valid JSON
.pipe(dest("built/local"));
task("generate-types-map", generateTypesMap);

const cleanTypesMap = () => del("built/local/typesMap.json");
cleanTasks.push(cleanTypesMap);

const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller, buildWatchGuard, generateTypesMap);
task("other-outputs", series(preBuild, buildOtherOutputs));
task("other-outputs").description = "Builds miscelaneous scripts and documents distributed with the LKG";

const buildFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("build")); };
const buildFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("build")); };
task("local", series(buildFoldStart, lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl), buildFoldEnd));
task("local", series(buildFoldStart, preBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs), buildFoldEnd));
task("local").description = "Builds the full compiler and services";
task("local").flags = {
" --built": "Compile using the built version of the compiler."
Expand Down Expand Up @@ -473,22 +498,23 @@ task("diff").description = "Diffs the compiler baselines using the diff tool spe
task("diff-rwc", () => exec(getDiffTool(), [refRwcBaseline, localRwcBaseline], { ignoreExitCode: true }));
task("diff-rwc").description = "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable";

const baselineAccept = subfolder => merge2(
src([`${localBaseline}${subfolder ? `${subfolder}/` : ``}**`, `!${localBaseline}${subfolder}/**/*.delete`], { base: localBaseline })
/**
* @param {string} localBaseline Path to the local copy of the baselines
* @param {string} refBaseline Path to the reference copy of the baselines
*/
const baselineAccept = (localBaseline, refBaseline) => merge2(
src([`${localBaseline}/**`, `!${localBaseline}/**/*.delete`], { base: localBaseline })
.pipe(dest(refBaseline)),
src([`${localBaseline}${subfolder ? `${subfolder}/` : ``}**/*.delete`], { base: localBaseline, read: false })
src([`${localBaseline}/**/*.delete`], { base: localBaseline, read: false })
.pipe(rm())
.pipe(rename({ extname: "" }))
.pipe(rm(refBaseline)));
task("baseline-accept", () => baselineAccept(""));
task("baseline-accept", () => baselineAccept(localBaseline, refBaseline));
task("baseline-accept").description = "Makes the most recent test results the new baseline, overwriting the old baseline";

task("baseline-accept-rwc", () => baselineAccept("rwc"));
task("baseline-accept-rwc", () => baselineAccept(localRwcBaseline, refRwcBaseline));
task("baseline-accept-rwc").description = "Makes the most recent rwc test results the new baseline, overwriting the old baseline";

task("baseline-accept-test262", () => baselineAccept("test262"));
task("baseline-accept-test262").description = "Makes the most recent test262 test results the new baseline, overwriting the old baseline";

// TODO(rbuckton): Determine if 'webhost' is still in use.
const buildWebHost = () => buildProject("tests/webhost/webtsc.tsconfig.json");
task("webhost", series(lkgPreBuild, buildWebHost));
Expand Down Expand Up @@ -550,28 +576,6 @@ const buildReleaseTsc = () => buildProject("src/tsc/tsconfig.release.json");
const cleanReleaseTsc = () => cleanProject("src/tsc/tsconfig.release.json");
cleanTasks.push(cleanReleaseTsc);

const buildCancellationToken = () => buildProject("src/cancellationToken");
const cleanCancellationToken = () => cleanProject("src/cancellationToken");
cleanTasks.push(cleanCancellationToken);

const buildTypingsInstaller = () => buildProject("src/typingsInstaller");
const cleanTypingsInstaller = () => cleanProject("src/typingsInstaller");
cleanTasks.push(cleanTypingsInstaller);

const buildWatchGuard = () => buildProject("src/watchGuard");
const cleanWatchGuard = () => cleanProject("src/watchGuard");
cleanTasks.push(cleanWatchGuard);

// TODO(rbuckton): This task isn't triggered by any other task. Is it still needed?
const generateTypesMap = () => src("src/server/typesMap.json")
.pipe(newer("built/local/typesMap.json"))
.pipe(transform(contents => (JSON.parse(contents), contents))) // validates typesMap.json is valid JSON
.pipe(dest("built/local"));
task("generate-types-map", generateTypesMap);

const cleanTypesMap = () => del("built/local/typesMap.json");
cleanTasks.push(cleanTypesMap);

const cleanBuilt = () => del("built");

const produceLKG = async () => {
Expand Down Expand Up @@ -601,7 +605,7 @@ const produceLKG = async () => {
}
};

task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildCancellationToken, buildTypingsInstaller, buildWatchGuard, buildReleaseTsc), produceLKG));
task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs, buildReleaseTsc), produceLKG));
task("LKG").description = "Makes a new LKG out of the built js files";
task("LKG").flags = {
" --built": "Compile using the built version of the compiler.",
Expand All @@ -618,6 +622,10 @@ const configureNightly = () => exec(process.execPath, ["scripts/configurePrerele
task("configure-nightly", series(buildScripts, configureNightly));
task("configure-nightly").description = "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing";

const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerelease.js", "insiders", "package.json", "src/compiler/core.ts"])
task("configure-insiders", series(buildScripts, configureInsiders));
task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing";

const publishNightly = () => exec("npm", ["publish", "--tag", "next"]);
task("publish-nightly", series(task("clean"), task("LKG"), task("clean"), task("runtests-parallel"), publishNightly));
task("publish-nightly").description = "Runs `npm publish --tag next` to create a new nightly build on npm";
Expand Down
Loading

0 comments on commit 8e5178d

Please sign in to comment.