From bfe077ad64b4a7d9a248bc9232dc3a87566b29d6 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Wed, 14 Mar 2018 01:10:41 -0700 Subject: [PATCH] fix(bazel): correct expected outs for external sources in ng_module (#22755) PR Close #22755 --- packages/bazel/src/ng_module.bzl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index 6540307f59..3b165cd94c 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -37,8 +37,12 @@ def _expected_outs(ctx): for src in ctx.files.srcs + ctx.files.assets: package_prefix = ctx.label.package + "/" if ctx.label.package else "" - if src.short_path.endswith(".ts") and not src.short_path.endswith(".d.ts"): - basename = src.short_path[len(package_prefix):-len(".ts")] + # Strip external repository name from path if src is from external repository + # If src is from external repository, it's short_path will be ..//... + short_path = src.short_path if src.short_path[0:2] != ".." else "/".join(src.short_path.split("/")[2:]) + + if short_path.endswith(".ts") and not short_path.endswith(".d.ts"): + basename = short_path[len(package_prefix):-len(".ts")] if len(factory_basename_set) == 0 or basename in factory_basename_set: devmode_js = [ ".ngfactory.js", @@ -49,8 +53,8 @@ def _expected_outs(ctx): else: devmode_js = [".js"] summaries = [] - elif src.short_path.endswith(".css"): - basename = src.short_path[len(package_prefix):-len(".css")] + elif short_path.endswith(".css"): + basename = short_path[len(package_prefix):-len(".css")] devmode_js = [ ".css.shim.ngstyle.js", ".css.ngstyle.js",