@@ -6,8 +6,8 @@ load("@npm_bazel_karma//:defs.bzl", _karma_web_test_suite = "karma_web_test_suit
6
6
load ("@npm_bazel_protractor//:index.bzl" , _protractor_web_test_suite = "protractor_web_test_suite" )
7
7
load ("@npm_bazel_typescript//:defs.bzl" , _ts_library = "ts_library" )
8
8
load ("//:packages.bzl" , "ANGULAR_LIBRARY_UMDS" , "VERSION_PLACEHOLDER_REPLACEMENTS" )
9
- load ("//tools/markdown-to-html:index.bzl" , _markdown_to_html = "markdown_to_html" )
10
9
load ("//tools:default_module_name.bzl" , "get_default_module_name" )
10
+ load ("//tools/markdown-to-html:index.bzl" , _markdown_to_html = "markdown_to_html" )
11
11
12
12
_DEFAULT_TSCONFIG_BUILD = "//src:bazel-tsconfig-build.json"
13
13
_DEFAULT_TSCONFIG_TEST = "//src:tsconfig-test"
@@ -44,13 +44,32 @@ def ts_library(tsconfig = None, deps = [], testonly = False, **kwargs):
44
44
** kwargs
45
45
)
46
46
47
- def ng_module (deps = [], tsconfig = None , module_name = None , testonly = False , ** kwargs ):
47
+ def ng_module (
48
+ deps = [],
49
+ srcs = [],
50
+ tsconfig = None ,
51
+ module_name = None ,
52
+ flat_module_out_file = None ,
53
+ testonly = False ,
54
+ ** kwargs ):
48
55
if not tsconfig :
49
56
tsconfig = _getDefaultTsConfig (testonly )
50
57
51
58
if not module_name and not testonly :
52
59
module_name = get_default_module_name ()
53
60
61
+ if module_name and not flat_module_out_file :
62
+ flat_module_out_file = "index"
63
+
64
+ # Workaround to avoid a lot of changes to the Bazel build rules. Since
65
+ # for most targets the flat module out file is "index.js", we cannot
66
+ # include "index.ts" (if present) as source-file. This would resolve
67
+ # in a conflict in the metadata bundler. Once we switch to Ivy and
68
+ # no longer need metadata bundles, we can remove this logic.
69
+ if flat_module_out_file == "index" :
70
+ if "index.ts" in srcs :
71
+ srcs .remove ("index.ts" )
72
+
54
73
local_deps = [
55
74
# Add tslib because we use import helpers for all public packages.
56
75
"@npm//tslib" ,
@@ -67,8 +86,10 @@ def ng_module(deps = [], tsconfig = None, module_name = None, testonly = False,
67
86
local_deps = local_deps + [d ]
68
87
69
88
_ng_module (
89
+ srcs = srcs ,
70
90
type_check = _ENABLE_NG_TYPE_CHECKING ,
71
91
module_name = module_name ,
92
+ flat_module_out_file = flat_module_out_file ,
72
93
deps = local_deps ,
73
94
tsconfig = tsconfig ,
74
95
testonly = testonly ,
0 commit comments