build: Upgrade to TypeScript 2.5 (#20175)
- update to TypeScript 2.5 - point the 2.4 typings test at the previous typescript version, so we don't break it accidentally - widen the peerDeps from Angular packages that depend on TypeScript - update to latest TypeScript 2.5 compatible Bazel rules - move .bazelrc to tools/bazel.rc per https://docs.bazel.build/versions/master/best-practices.html#bazelrc PR Close #20175
This commit is contained in:
parent
f8658cdc38
commit
a9f3e2bd95
18
.bazelrc
18
.bazelrc
|
@ -1,18 +0,0 @@
|
||||||
# Make compilation fast, by keeping a few copies of the compilers
|
|
||||||
# running as daemons, and cache SourceFile AST's to reduce parse time.
|
|
||||||
build --strategy=TypeScriptCompile=worker
|
|
||||||
build --strategy=AngularTemplateCompile=worker
|
|
||||||
|
|
||||||
# Don't create bazel-* symlinks in the WORKSPACE directory.
|
|
||||||
# These require .gitignore and may scare users.
|
|
||||||
# Also, it's a workaround for https://github.com/bazelbuild/rules_typescript/issues/12
|
|
||||||
# which affects the common case of having `tsconfig.json` in the WORKSPACE directory.
|
|
||||||
#
|
|
||||||
# Instead, you should run `bazel info bazel-bin` to find out where the outputs went.
|
|
||||||
build --symlink_prefix=/
|
|
||||||
|
|
||||||
# Performance: avoid stat'ing input files
|
|
||||||
build --watchfs
|
|
||||||
|
|
||||||
# Don't print all the .d.ts output locations after builds
|
|
||||||
build --show_result=0
|
|
|
@ -5,8 +5,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||||
git_repository(
|
git_repository(
|
||||||
name = "build_bazel_rules_nodejs",
|
name = "build_bazel_rules_nodejs",
|
||||||
remote = "https://github.com/bazelbuild/rules_nodejs.git",
|
remote = "https://github.com/bazelbuild/rules_nodejs.git",
|
||||||
# TODO(alexeagle): use the correct tag here.
|
commit = "0.2.1",
|
||||||
commit = "2c6243df53fd33fdab283ebdd01582e4eb815db8",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
|
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "angular-integration",
|
"name": "angular-integration",
|
||||||
"description": "Assert that users with TypeScript 2.2 can type-check an Angular application",
|
"description": "Assert that users with TypeScript 2.4 can type-check an Angular application",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
||||||
"@types/jasmine": "2.5.41",
|
"@types/jasmine": "2.5.41",
|
||||||
"rxjs": "file:../../node_modules/rxjs",
|
"rxjs": "file:../../node_modules/rxjs",
|
||||||
"typescript": "file:../../node_modules/typescript",
|
"typescript": "2.4.x",
|
||||||
"zone.js": "file:../../node_modules/zone.js"
|
"zone.js": "file:../../node_modules/zone.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as compiler from '@angular/compiler';
|
||||||
|
import * as compilerTesting from '@angular/compiler/testing';
|
||||||
|
import * as core from '@angular/core';
|
||||||
|
import * as coreTesting from '@angular/core/testing';
|
||||||
|
import * as forms from '@angular/forms';
|
||||||
|
import * as http from '@angular/http';
|
||||||
|
import * as httpTesting from '@angular/http/testing';
|
||||||
|
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||||
|
import * as platformBrowser from '@angular/platform-browser';
|
||||||
|
import * as platformBrowserTesting from '@angular/platform-browser/testing';
|
||||||
|
import * as platformServer from '@angular/platform-server';
|
||||||
|
import * as platformServerTesting from '@angular/platform-server/testing';
|
||||||
|
import * as router from '@angular/router';
|
||||||
|
import * as routerTesting from '@angular/router/testing';
|
||||||
|
import * as upgrade from '@angular/upgrade';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
compiler,
|
||||||
|
compilerTesting,
|
||||||
|
core,
|
||||||
|
coreTesting,
|
||||||
|
forms,
|
||||||
|
http,
|
||||||
|
httpTesting,
|
||||||
|
platformBrowser,
|
||||||
|
platformBrowserTesting,
|
||||||
|
platformBrowserDynamic,
|
||||||
|
platformServer,
|
||||||
|
platformServerTesting,
|
||||||
|
router,
|
||||||
|
routerTesting,
|
||||||
|
upgrade
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "angular-integration",
|
||||||
|
"description": "Assert that users with TypeScript 2.5 can type-check an Angular application",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "file:../../dist/packages-dist/animations",
|
||||||
|
"@angular/common": "file:../../dist/packages-dist/common",
|
||||||
|
"@angular/compiler": "file:../../dist/packages-dist/compiler",
|
||||||
|
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||||
|
"@angular/core": "file:../../dist/packages-dist/core",
|
||||||
|
"@angular/forms": "file:../../dist/packages-dist/forms",
|
||||||
|
"@angular/http": "file:../../dist/packages-dist/http",
|
||||||
|
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||||
|
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||||
|
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
|
||||||
|
"@angular/router": "file:../../dist/packages-dist/router",
|
||||||
|
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
||||||
|
"@types/jasmine": "2.5.41",
|
||||||
|
"rxjs": "file:../../node_modules/rxjs",
|
||||||
|
"typescript": "2.5.x",
|
||||||
|
"zone.js": "file:../../node_modules/zone.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tsc"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": "../../dist/typings_test_ts25/",
|
||||||
|
"rootDir": ".",
|
||||||
|
"target": "es5",
|
||||||
|
"lib": [
|
||||||
|
"es5",
|
||||||
|
"dom",
|
||||||
|
"es2015.collection",
|
||||||
|
"es2015.iterable",
|
||||||
|
"es2015.promise"
|
||||||
|
],
|
||||||
|
"types": [],
|
||||||
|
"strictNullChecks": true
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"include-all.ts",
|
||||||
|
"node_modules/@types/jasmine/index.d.ts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -32,7 +32,7 @@
|
||||||
"fsevents": "1.1.2"
|
"fsevents": "1.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bazel/typescript": "0.2.x",
|
"@bazel/typescript": "0.3.1",
|
||||||
"@types/angularjs": "1.5.14-alpha",
|
"@types/angularjs": "1.5.14-alpha",
|
||||||
"@types/base64-js": "1.2.5",
|
"@types/base64-js": "1.2.5",
|
||||||
"@types/chokidar": "1.7.3",
|
"@types/chokidar": "1.7.3",
|
||||||
|
@ -95,10 +95,10 @@
|
||||||
"source-map-support": "0.4.18",
|
"source-map-support": "0.4.18",
|
||||||
"systemjs": "0.18.10",
|
"systemjs": "0.18.10",
|
||||||
"ts-api-guardian": "0.2.2",
|
"ts-api-guardian": "0.2.2",
|
||||||
"tsickle": "0.24.x",
|
"tsickle": "0.25.5",
|
||||||
"tslint": "5.7.0",
|
"tslint": "5.7.0",
|
||||||
"tslint-eslint-rules": "4.1.1",
|
"tslint-eslint-rules": "4.1.1",
|
||||||
"typescript": "2.4.2",
|
"typescript": "2.5.x",
|
||||||
"uglify-js": "2.8.29",
|
"uglify-js": "2.8.29",
|
||||||
"universal-analytics": "0.4.15",
|
"universal-analytics": "0.4.15",
|
||||||
"vlq": "0.2.2",
|
"vlq": "0.2.2",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
||||||
"typescript": ">=2.4.2 <2.5"
|
"typescript": ">=2.4.2 <2.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bazel/typescript": "0.2.x",
|
"@bazel/typescript": "0.2.x",
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
// TODO(tbosch): figure out why we need this as it breaks node code within ngc-wrapped
|
|
||||||
/// <reference types="node" />
|
|
||||||
import * as ng from '@angular/compiler-cli';
|
import * as ng from '@angular/compiler-cli';
|
||||||
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, fixUmdModuleDeclarations, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
|
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, fixUmdModuleDeclarations, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"reflect-metadata": "^0.1.2",
|
"reflect-metadata": "^0.1.2",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"tsickle": "^0.24.0",
|
"tsickle": "^0.25.5",
|
||||||
"chokidar": "^1.4.2"
|
"chokidar": "^1.4.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": ">=2.4.2 <2.5",
|
"typescript": ">=2.4.2 <2.6",
|
||||||
"@angular/compiler": "0.0.0-PLACEHOLDER"
|
"@angular/compiler": "0.0.0-PLACEHOLDER"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -41,6 +41,13 @@ export interface CodeGenerator {
|
||||||
findGeneratedFileNames(fileName: string): string[];
|
findGeneratedFileNames(fileName: string): string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assert<T>(condition: T | null | undefined) {
|
||||||
|
if (!condition) {
|
||||||
|
// TODO(chuckjaz): do the right thing
|
||||||
|
}
|
||||||
|
return condition !;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the following hosts based on an api.CompilerHost:
|
* Implements the following hosts based on an api.CompilerHost:
|
||||||
* - ts.CompilerHost to be consumed by a ts.Program
|
* - ts.CompilerHost to be consumed by a ts.Program
|
||||||
|
@ -113,7 +120,7 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
||||||
return sf ? this.metadataProvider.getMetadata(sf) : undefined;
|
return sf ? this.metadataProvider.getMetadata(sf) : undefined;
|
||||||
},
|
},
|
||||||
fileExists: (filePath) => this.originalFileExists(filePath),
|
fileExists: (filePath) => this.originalFileExists(filePath),
|
||||||
readFile: (filePath) => this.context.readFile(filePath),
|
readFile: (filePath) => assert(this.context.readFile(filePath)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +428,7 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
||||||
return summary.text;
|
return summary.text;
|
||||||
}
|
}
|
||||||
if (this.originalFileExists(filePath)) {
|
if (this.originalFileExists(filePath)) {
|
||||||
return this.context.readFile(filePath);
|
return assert(this.context.readFile(filePath));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +479,7 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
||||||
if (!this.originalFileExists(filePath)) {
|
if (!this.originalFileExists(filePath)) {
|
||||||
throw syntaxError(`Error: Resource file not found: ${filePath}`);
|
throw syntaxError(`Error: Resource file not found: ${filePath}`);
|
||||||
}
|
}
|
||||||
return this.context.readFile(filePath);
|
return assert(this.context.readFile(filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasBundleIndex(filePath: string): boolean {
|
private hasBundleIndex(filePath: string): boolean {
|
||||||
|
@ -490,13 +497,13 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
||||||
if (this.originalFileExists(packageFile)) {
|
if (this.originalFileExists(packageFile)) {
|
||||||
// Once we see a package.json file, assume false until it we find the bundle index.
|
// Once we see a package.json file, assume false until it we find the bundle index.
|
||||||
result = false;
|
result = false;
|
||||||
const packageContent: any = JSON.parse(this.context.readFile(packageFile));
|
const packageContent: any = JSON.parse(assert(this.context.readFile(packageFile)));
|
||||||
if (packageContent.typings) {
|
if (packageContent.typings) {
|
||||||
const typings = path.normalize(path.join(directory, packageContent.typings));
|
const typings = path.normalize(path.join(directory, packageContent.typings));
|
||||||
if (DTS.test(typings)) {
|
if (DTS.test(typings)) {
|
||||||
const metadataFile = typings.replace(DTS, '.metadata.json');
|
const metadataFile = typings.replace(DTS, '.metadata.json');
|
||||||
if (this.originalFileExists(metadataFile)) {
|
if (this.originalFileExists(metadataFile)) {
|
||||||
const metadata = JSON.parse(this.context.readFile(metadataFile));
|
const metadata = JSON.parse(assert(this.context.readFile(metadataFile)));
|
||||||
if (metadata.flatModuleIndexRedirect) {
|
if (metadata.flatModuleIndexRedirect) {
|
||||||
this.flatModuleIndexRedirectNames.add(typings);
|
this.flatModuleIndexRedirectNames.add(typings);
|
||||||
// Note: don't set result = true,
|
// Note: don't set result = true,
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
###############################
|
||||||
|
# Typescript / Angular / Sass #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Make compilation fast, by keeping a few copies of the compilers
|
||||||
|
# running as daemons, and cache SourceFile AST's to reduce parse time.
|
||||||
|
build --strategy=TypeScriptCompile=worker
|
||||||
|
build --strategy=AngularTemplateCompile=worker
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Filesystem interactions #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Don't create bazel-* symlinks in the WORKSPACE directory.
|
||||||
|
# These require .gitignore and may scare users.
|
||||||
|
# Also, it's a workaround for https://github.com/bazelbuild/rules_typescript/issues/12
|
||||||
|
# which affects the common case of having `tsconfig.json` in the WORKSPACE directory.
|
||||||
|
#
|
||||||
|
# Instead, you should run `bazel info bazel-bin` to find out where the outputs went.
|
||||||
|
build --symlink_prefix=/
|
||||||
|
|
||||||
|
# Performance: avoid stat'ing input files
|
||||||
|
build --watchfs
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Output #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Don't print all the .d.ts output locations after builds
|
||||||
|
build --show_result=0
|
||||||
|
|
||||||
|
# A more useful default output mode for bazel query
|
||||||
|
# Prints eg. "ng_module rule //foo:bar" rather than just "//foo:bar"
|
||||||
|
query --output=label_kind
|
||||||
|
|
||||||
|
# Don't print every dependency in :node_modules, for example
|
||||||
|
query --noimplicit_deps
|
||||||
|
|
||||||
|
# By default, failing tests don't print any output, it goes to the log file
|
||||||
|
test --test_output=errors
|
||||||
|
|
||||||
|
# Show which actions are run under workers,
|
||||||
|
# and print all the actions running in parallel.
|
||||||
|
# Helps to demonstrate that bazel uses all the cores on the machine.
|
||||||
|
build --experimental_ui
|
||||||
|
test --experimental_ui
|
31
yarn.lock
31
yarn.lock
|
@ -2,15 +2,15 @@
|
||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@bazel/typescript@0.2.x":
|
"@bazel/typescript@0.3.1":
|
||||||
version "0.2.2"
|
version "0.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.2.2.tgz#0a0d09924508c946de32e6acdb2b5cc1ee32c506"
|
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.3.1.tgz#54367df8f30fa0fb25e41106eb7aa558534c36dd"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "7.0.18"
|
"@types/node" "7.0.18"
|
||||||
"@types/source-map" "^0.5.1"
|
"@types/source-map" "^0.5.1"
|
||||||
protobufjs "5.0.0"
|
protobufjs "5.0.0"
|
||||||
tsickle "0.24.x"
|
tsickle "0.25.x"
|
||||||
typescript "2.4.x"
|
typescript "2.5.x"
|
||||||
|
|
||||||
"@google-cloud/common@^0.13.0":
|
"@google-cloud/common@^0.13.0":
|
||||||
version "0.13.5"
|
version "0.13.5"
|
||||||
|
@ -7102,9 +7102,18 @@ ts-api-guardian@0.2.2:
|
||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
typescript "2.0.10"
|
typescript "2.0.10"
|
||||||
|
|
||||||
tsickle@0.24.x:
|
tsickle@0.25.5:
|
||||||
version "0.24.1"
|
version "0.25.5"
|
||||||
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.24.1.tgz#039343b205bf517a333b0703978892f80a7d848e"
|
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.25.5.tgz#2891d29f97c4aab1306e06378d8496d1765a4bfe"
|
||||||
|
dependencies:
|
||||||
|
minimist "^1.2.0"
|
||||||
|
mkdirp "^0.5.1"
|
||||||
|
source-map "^0.5.6"
|
||||||
|
source-map-support "^0.4.2"
|
||||||
|
|
||||||
|
tsickle@0.25.x:
|
||||||
|
version "0.25.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.25.5.tgz#2891d29f97c4aab1306e06378d8496d1765a4bfe"
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
mkdirp "^0.5.1"
|
mkdirp "^0.5.1"
|
||||||
|
@ -7199,9 +7208,9 @@ typescript@2.0.10:
|
||||||
version "2.0.10"
|
version "2.0.10"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.0.10.tgz#ccdd4ed86fd5550a407101a0814012e1b3fac3dd"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.0.10.tgz#ccdd4ed86fd5550a407101a0814012e1b3fac3dd"
|
||||||
|
|
||||||
typescript@2.4.2, typescript@2.4.x:
|
typescript@2.5.x:
|
||||||
version "2.4.2"
|
version "2.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
|
||||||
|
|
||||||
uglify-js@1.2.6, uglify-js@~1.2.5:
|
uglify-js@1.2.6, uglify-js@~1.2.5:
|
||||||
version "1.2.6"
|
version "1.2.6"
|
||||||
|
|
Loading…
Reference in New Issue