Skip to content

Commit

Permalink
build: Update to latest rules_typescript. (#21675)
Browse files Browse the repository at this point in the history
Fixes #21481

PR Close #21675
  • Loading branch information
alexeagle authored and mhevery committed Jan 22, 2018
1 parent a64af40 commit 95fbb7d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
8 changes: 2 additions & 6 deletions WORKSPACE
Expand Up @@ -15,12 +15,8 @@ node_repositories(package_json = ["//:package.json"])

git_repository(
name = "build_bazel_rules_typescript",
# Use alexeagle's branch temporarily to allow a green build in the middle of
# the tsconfig refactoring.
# 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"
remote = "https://github.com/bazelbuild/rules_typescript.git",
commit = "c4ea003acd7d42269b81a2d25eb832972cd24912"
)

load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
Expand Down
8 changes: 2 additions & 6 deletions integration/bazel/WORKSPACE
Expand Up @@ -13,12 +13,8 @@ node_repositories(package_json = ["//:package.json"])

git_repository(
name = "build_bazel_rules_typescript",
# Use alexeagle's branch temporarily to allow a green build in the middle of
# the tsconfig refactoring.
# 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"
remote = "https://github.com/bazelbuild/rules_typescript.git",
commit = "c4ea003acd7d42269b81a2d25eb832972cd24912"
)

load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
Expand Down
11 changes: 7 additions & 4 deletions packages/bazel/src/ngc-wrapped/index.ts
Expand Up @@ -189,15 +189,18 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
}
return bazelOpts.workspaceName + '/' + result;
};
ngHost.toSummaryFileName = (fileName: string, referringSrcFileName: string) =>
relativeToRootDirs(fileName, compilerOpts.rootDirs).replace(EXT, '');
ngHost.toSummaryFileName = (fileName: string, referringSrcFileName: string) => path.join(
bazelOpts.workspaceName,
relativeToRootDirs(fileName, compilerOpts.rootDirs).replace(EXT, ''));
if (allDepsCompiledWithBazel) {
// Note: The default implementation would work as well,
// 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,
// as that has a different implementation of fromSummaryFileName / toSummaryFileName
ngHost.fromSummaryFileName = (fileName: string, referringLibFileName: string) =>
path.resolve(bazelBin, fileName) + '.d.ts';
ngHost.fromSummaryFileName = (fileName: string, referringLibFileName: string) => {
const workspaceRelative = fileName.split('/').splice(1).join('/');
return path.resolve(bazelBin, workspaceRelative) + '.d.ts';
};
}

const emitCallback: ng.TsEmitCallback = ({
Expand Down

0 comments on commit 95fbb7d

Please sign in to comment.