build: Update to latest rules_typescript. (#21675)

Fixes #21481

PR Close #21675
This commit is contained in:
Alex Eagle 2018-01-19 13:32:39 -08:00 committed by Miško Hevery
parent a64af40c0b
commit 95fbb7d675
3 changed files with 11 additions and 16 deletions

View File

@ -15,12 +15,8 @@ node_repositories(package_json = ["//:package.json"])
git_repository( git_repository(
name = "build_bazel_rules_typescript", name = "build_bazel_rules_typescript",
# Use alexeagle's branch temporarily to allow a green build in the middle of remote = "https://github.com/bazelbuild/rules_typescript.git",
# the tsconfig refactoring. commit = "c4ea003acd7d42269b81a2d25eb832972cd24912"
# TODO(alexeagle): after the change lands in google3, push it to bazelbuild
# mirror and point this back to upstream.
remote = "https://github.com/alexeagle/rules_typescript.git",
commit = "5ccf967a393d94f53b5b1a97760eb1e18367faa3"
) )
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")

View File

@ -13,12 +13,8 @@ node_repositories(package_json = ["//:package.json"])
git_repository( git_repository(
name = "build_bazel_rules_typescript", name = "build_bazel_rules_typescript",
# Use alexeagle's branch temporarily to allow a green build in the middle of remote = "https://github.com/bazelbuild/rules_typescript.git",
# the tsconfig refactoring. commit = "c4ea003acd7d42269b81a2d25eb832972cd24912"
# TODO(alexeagle): after the change lands in google3, push it to bazelbuild
# mirror and point this back to upstream.
remote = "https://github.com/alexeagle/rules_typescript.git",
commit = "5ccf967a393d94f53b5b1a97760eb1e18367faa3"
) )
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")

View File

@ -189,15 +189,18 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
} }
return bazelOpts.workspaceName + '/' + result; return bazelOpts.workspaceName + '/' + result;
}; };
ngHost.toSummaryFileName = (fileName: string, referringSrcFileName: string) => ngHost.toSummaryFileName = (fileName: string, referringSrcFileName: string) => path.join(
relativeToRootDirs(fileName, compilerOpts.rootDirs).replace(EXT, ''); bazelOpts.workspaceName,
relativeToRootDirs(fileName, compilerOpts.rootDirs).replace(EXT, ''));
if (allDepsCompiledWithBazel) { if (allDepsCompiledWithBazel) {
// Note: The default implementation would work as well, // Note: The default implementation would work as well,
// but we can be faster as we know how `toSummaryFileName` works. // but we can be faster as we know how `toSummaryFileName` works.
// Note: We can't do this if some deps have been compiled with the command line, // Note: We can't do this if some deps have been compiled with the command line,
// as that has a different implementation of fromSummaryFileName / toSummaryFileName // as that has a different implementation of fromSummaryFileName / toSummaryFileName
ngHost.fromSummaryFileName = (fileName: string, referringLibFileName: string) => ngHost.fromSummaryFileName = (fileName: string, referringLibFileName: string) => {
path.resolve(bazelBin, fileName) + '.d.ts'; const workspaceRelative = fileName.split('/').splice(1).join('/');
return path.resolve(bazelBin, workspaceRelative) + '.d.ts';
};
} }
const emitCallback: ng.TsEmitCallback = ({ const emitCallback: ng.TsEmitCallback = ({