build: enable importHelpers in tsconfig (#22812)

This is the primary tsconfig file used for Bazel builds.
Previously, we enabled this option only for releases.

PR Close #22812
This commit is contained in:
Alex Eagle 2018-03-15 18:33:52 -07:00 committed by Miško Hevery
parent 44de10e2db
commit f9247e4b2e
18 changed files with 37 additions and 93 deletions

View File

@ -143,6 +143,9 @@ describe('@angular/core ng_package', () => {
expect(shx.cat('bundles/core.umd.js')) expect(shx.cat('bundles/core.umd.js'))
.toMatch(/@license Angular v\d+\.\d+\.\d+(?!-PLACEHOLDER)/); .toMatch(/@license Angular v\d+\.\d+\.\d+(?!-PLACEHOLDER)/);
}); });
it('should have tslib helpers',
() => { expect(shx.cat('bundles/core.umd.js')).not.toContain('undefined.__extends'); });
}); });
}); });

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -32,12 +31,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -49,14 +48,9 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [ # disable since tests are running but not yet passing
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
tags = ["manual"], tags = ["manual"],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -62,12 +61,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -57,12 +56,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "render3_web", name = "render3_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":render3_lib", ":render3_lib",
], ],
) )

View File

@ -13,7 +13,7 @@ cd `dirname $0`
DIST="../../dist/examples"; DIST="../../dist/examples";
rm -rf -- $DIST rm -rf -- $DIST
$(npm bin)/tsc -p ./tsconfig-build.json $(npm bin)/tsc -p ./tsconfig-build.json --importHelpers false
mkdir $DIST/vendor/ mkdir $DIST/vendor/

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -27,12 +26,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -28,12 +27,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -16,10 +15,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], bootstrap = ["angular/tools/testing/init_node_spec.js"],
# dissable since tests are running but not yet passing # disable since tests are running but not yet passing
tags = ["manual"], tags = ["manual"],
deps = [ deps = [
":test_lib",
"//tools/testing:node", "//tools/testing:node",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -30,14 +29,9 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [ # disable since tests are running but not yet passing
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
tags = ["manual"], tags = ["manual"],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -36,14 +35,9 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [ # disable since tests are running but not yet passing
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
tags = ["manual"], tags = ["manual"],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -30,12 +29,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -31,12 +30,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -29,12 +28,7 @@ jasmine_node_test(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -22,7 +22,8 @@
// As tsickle will lower decorators before TS, this is not a problem for our build. // As tsickle will lower decorators before TS, this is not a problem for our build.
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"sourceMap": true, "sourceMap": true,
"inlineSources": true "inlineSources": true,
"importHelpers": true
}, },
"bazelOptions": { "bazelOptions": {
"suppressTsconfigOverrideWarnings": true "suppressTsconfigOverrideWarnings": true

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library( ts_library(
@ -22,16 +21,13 @@ ts_library(
ts_web_test( ts_web_test(
name = "test_web", name = "test_web",
bootstrap = [ bootstrap = [
"//:web_test_bootstrap_scripts",
# "//:angularjs", # "//:angularjs",
], ],
# Disable since tests need to request different AngularJS versions at # Disable since tests need to request different AngularJS versions at
# runtime, which is not yet supported. # runtime, which is not yet supported.
# (Related issue: https://github.com/bazelbuild/rules_typescript/issues/131) # (Related issue: https://github.com/bazelbuild/rules_typescript/issues/131)
tags = ["manual"], tags = ["manual"],
# do not sort
deps = [ deps = [
"//tools/testing:browser",
":test_lib", ":test_lib",
], ],
) )

View File

@ -1,6 +1,6 @@
"""Re-export of some bazel rules with repository-wide defaults.""" """Re-export of some bazel rules with repository-wide defaults."""
load("@build_bazel_rules_nodejs//:defs.bzl", _npm_package = "npm_package") load("@build_bazel_rules_nodejs//:defs.bzl", _npm_package = "npm_package")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library") load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test = "ts_web_test")
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json" DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
@ -66,3 +66,16 @@ def npm_package(name, replacements = {}, **kwargs):
stamp_data = "//tools:stamp_data", stamp_data = "//tools:stamp_data",
replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS), replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS),
**kwargs) **kwargs)
def ts_web_test(bootstrap = [], deps = [], **kwargs):
if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"]
local_deps = [
"//:node_modules/tslib/tslib.js",
"//tools/testing:browser",
] + deps
_ts_web_test(
bootstrap = bootstrap,
deps = local_deps,
**kwargs)