Skip to content

Commit

Permalink
Merge branch 'master' into add-unmeasurable-variance-kind
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham committed Apr 24, 2019
2 parents 33b6e42 + b010010 commit bbfb25f
Show file tree
Hide file tree
Showing 215 changed files with 3,589 additions and 2,606 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -59,11 +59,11 @@ Run `gulp` to build a version of the compiler/language service that reflects cha

## Contributing bug fixes

TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)) by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

## Contributing features

Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved ([labelled "help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.

Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.

Expand Down
4 changes: 4 additions & 0 deletions Gulpfile.js
Expand Up @@ -545,6 +545,10 @@ const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerel
task("configure-insiders", series(buildScripts, configureInsiders));
task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing";

const configureExperimental = () => exec(process.execPath, ["scripts/configurePrerelease.js", "experimental", "package.json", "src/compiler/core.ts"])
task("configure-experimental", series(buildScripts, configureExperimental));
task("configure-experimental").description = "Runs scripts/configurePrerelease.ts to prepare a build for experimental 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
2 changes: 1 addition & 1 deletion lib/tsserverlibrary.d.ts
Expand Up @@ -626,7 +626,7 @@ declare namespace ts {
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrandBrand: any;
_objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
Expand Down
2 changes: 1 addition & 1 deletion lib/typescript.d.ts
Expand Up @@ -626,7 +626,7 @@ declare namespace ts {
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrandBrand: any;
_objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
Expand Down
2 changes: 1 addition & 1 deletion lib/typescriptServices.d.ts
Expand Up @@ -626,7 +626,7 @@ declare namespace ts {
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrandBrand: any;
_objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -68,7 +68,6 @@
"gulp-rename": "latest",
"gulp-sourcemaps": "latest",
"istanbul": "latest",
"lodash": "^4.17.11",
"merge2": "latest",
"minimist": "latest",
"mkdirp": "latest",
Expand Down
2 changes: 1 addition & 1 deletion scripts/configurePrerelease.ts
Expand Up @@ -22,7 +22,7 @@ function main(): void {
}

const tag = args[0];
if (tag !== "dev" && tag !== "insiders") {
if (tag !== "dev" && tag !== "insiders" && tag !== "experimental") {
throw new Error(`Unexpected tag name '${tag}'.`);
}

Expand Down
11 changes: 1 addition & 10 deletions scripts/open-user-pr.ts
@@ -1,16 +1,7 @@
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
import cp = require("child_process");
import Octokit = require("@octokit/rest");

const opts = { timeout: 100_000, shell: true, stdio: "inherit" }
function runSequence(tasks: [string, string[]][]) {
for (const task of tasks) {
console.log(`${task[0]} ${task[1].join(" ")}`);
const result = cp.spawnSync(task[0], task[1], opts);
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
}
}
import {runSequence} from "./run-sequence";

function padNum(number: number) {
const str = "" + number;
Expand Down
19 changes: 19 additions & 0 deletions scripts/run-sequence.js
@@ -0,0 +1,19 @@
// @ts-check
const cp = require("child_process");
/**
*
* @param {[string, string[]][]} tasks
* @param {cp.SpawnSyncOptions} opts
*/
function runSequence(tasks, opts = { timeout: 100000, shell: true, stdio: "inherit" }) {
let lastResult;
for (const task of tasks) {
console.log(`${task[0]} ${task[1].join(" ")}`);
const result = cp.spawnSync(task[0], task[1], opts);
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
lastResult = result;
}
return lastResult && lastResult.stdout && lastResult.stdout.toString();
}

exports.runSequence = runSequence;
97 changes: 97 additions & 0 deletions scripts/update-experimental-branches.js
@@ -0,0 +1,97 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
const Octokit = require("@octokit/rest");
const {runSequence} = require("./run-sequence");

/**
* This program should be invoked as `node ./scripts/update-experimental-branches <GithubAccessToken> <Branch1> [Branch2] [...]`
*/
async function main() {
const branchesRaw = process.argv[3];
const branches = process.argv.slice(3);
if (!branches.length) {
throw new Error(`No experimental branches, aborting...`);
}
console.log(`Performing experimental branch updating and merging for branches ${branchesRaw}`);

const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
});

// Fetch all relevant refs
runSequence([
["git", ["fetch", "origin", "master:master", ...branches.map(b => `${b}:${b}`)]]
])

// Forcibly cleanup workspace
runSequence([
["git", ["clean", "-fdx"]],
["git", ["checkout", "."]],
["git", ["checkout", "master"]],
]);

// Update branches
for (const branch of branches) {
// Checkout, then get the merge base
const mergeBase = runSequence([
["git", ["checkout", branch]],
["git", ["merge-base", branch, "master"]],
]);
// Simulate the merge and abort if there are conflicts
const mergeTree = runSequence([
["git", ["merge-tree", mergeBase, branch, "master"]]
]);
if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker
const res = await gh.pulls.list({owner: "Microsoft", repo: "TypeScript", base: branch});
if (res && res.data && res.data[0]) {
const pr = res.data[0];
await gh.issues.createComment({
owner: "Microsoft",
repo: "TypeScript",
number: pr.number,
body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.`
});
}
throw new Error(`Merge conflict detected on branch ${branch} with master`);
}
// Merge is good - apply a rebase and (force) push
runSequence([
["git", ["rebase", "master"]],
["git", ["push", "-f", "-u", "origin", branch]],
]);
}

// Return to `master` and make a new `experimental` branch
runSequence([
["git", ["checkout", "master"]],
["git", ["branch", "-D", "experimental"]],
["git", ["checkout", "-b", "experimental"]],
]);

// Merge each branch into `experimental` (which, if there is a conflict, we now know is from inter-experiment conflict)
for (const branch of branches) {
// Find the merge base
const mergeBase = runSequence([
["git", ["merge-base", branch, "experimental"]],
]);
// Simulate the merge and abort if there are conflicts
const mergeTree = runSequence([
["git", ["merge-tree", mergeBase, branch, "experimental"]]
]);
if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker
throw new Error(`Merge conflict detected on branch ${branch} with other experiment`);
}
// Merge (always producing a merge commit)
runSequence([
["git", ["merge", branch, "--no-ff"]],
]);
}
// Every branch merged OK, force push the replacement `experimental` branch
runSequence([
["git", ["push", "-f", "-u", "origin", "experimental"]],
]);
}

main().catch(e => (console.error(e), process.exitCode = 2));

0 comments on commit bbfb25f

Please sign in to comment.