@@ -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,7 +44,14 @@ 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
@@ -60,6 +67,18 @@ def ng_module(deps = [], tsconfig = None, module_name = None, testonly = False,
60
67
if "index.ts" in srcs :
61
68
srcs .remove ("index.ts" )
62
69
70
+ if module_name and not flat_module_out_file :
71
+ flat_module_out_file = "index"
72
+
73
+ # Workaround to avoid a lot of changes to the Bazel build rules. Since
74
+ # for most targets the flat module out file is "index.js", we cannot
75
+ # include "index.ts" (if present) as source-file. This would resolve
76
+ # in a conflict in the metadata bundler. Once we switch to Ivy and
77
+ # no longer need metadata bundles, we can remove this logic.
78
+ if flat_module_out_file == "index" :
79
+ if "index.ts" in srcs :
80
+ srcs .remove ("index.ts" )
81
+
63
82
local_deps = [
64
83
# Add tslib because we use import helpers for all public packages.
65
84
"@npm//tslib" ,
@@ -76,8 +95,10 @@ def ng_module(deps = [], tsconfig = None, module_name = None, testonly = False,
76
95
local_deps = local_deps + [d ]
77
96
78
97
_ng_module (
98
+ srcs = srcs ,
79
99
type_check = _ENABLE_NG_TYPE_CHECKING ,
80
100
module_name = module_name ,
101
+ flat_module_out_file = flat_module_out_file ,
81
102
deps = local_deps ,
82
103
tsconfig = tsconfig ,
83
104
testonly = testonly ,
0 commit comments