build: remove ivy build/test tag hackery now that we can (#26735)

With https://github.com/bazelbuild/rules_nodejs/pull/388 fixed we can stop messing around
with tags and just rely on the explicitly defined tags.

PR Close #26735
This commit is contained in:
Igor Minar 2018-10-24 18:15:46 -07:00 committed by Matias Niemelä
parent 5d7ba57dd5
commit 30f319a11f
4 changed files with 17 additions and 33 deletions

View File

@ -131,7 +131,7 @@ jobs:
- run: bazel run @yarn//:yarn - run: bazel run @yarn//:yarn
- *setup_bazel_remote_execution - *setup_bazel_remote_execution
- run: bazel test //... --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=ivy-jit - run: bazel test //... --define=compile=jit --build_tag_filters=-no-ivy-jit,-fixme-ivy-jit --test_tag_filters=-no-ivy-jit,-fixme-ivy-jit
test_ivy_aot: test_ivy_aot:
<<: *job_defaults <<: *job_defaults
@ -144,7 +144,7 @@ jobs:
- run: bazel run @yarn//:yarn - run: bazel run @yarn//:yarn
- *setup_bazel_remote_execution - *setup_bazel_remote_execution
- run: bazel test //... --define=compile=aot --build_tag_filters=ivy-aot --test_tag_filters=ivy-aot - run: bazel test //... --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot
test_aio: test_aio:
<<: *job_defaults <<: *job_defaults

View File

@ -72,7 +72,7 @@ keeps the outputs up-to-date as you save sources.
If you're experiencing problems with seemingly unrelated tests failing, it may be because you're not using the proper flags with your Bazel test runs in Angular. If you're experiencing problems with seemingly unrelated tests failing, it may be because you're not using the proper flags with your Bazel test runs in Angular.
See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=ivy=false` is defined as default. See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=compile=legacy` is defined as default.
- `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below) - `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below)
- `--test_arg=--node_options=--inspect=9228`: change the inspector port. - `--test_arg=--node_options=--inspect=9228`: change the inspector port.
@ -80,11 +80,12 @@ See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc
- `legacy`: (default behavior) compile against View Engine, e.g. `--define=compile=legacy` - `legacy`: (default behavior) compile against View Engine, e.g. `--define=compile=legacy`
- `jit`: Compile in ivy JIT mode, e.g. `--define=compile=jit` - `jit`: Compile in ivy JIT mode, e.g. `--define=compile=jit`
- `aot`: Compile in ivy AOT move, e.g. `--define=compile=aot` - `aot`: Compile in ivy AOT move, e.g. `--define=compile=aot`
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config - `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config of your rules in any given `BUILD.bazel`.
of your rules in any given `BUILD.bazel`. - `no-ivy-aot`: Useful for excluding build and test targets that are not meant to be executed in Ivy AOT mode (`--define=compile=aot`).
- `ivy-jit`: This flag should be set for tests that should be excuted with ivy JIT, e.g. `--test_tag_filters=ivy-jit`. For this, you may have to include `--define=compile=jit`. - `no-ivy-jit`: Useful for excluding build and test targets that are not meant to be executed in Ivy JIT mode (`--define=compile=jit`).
- `ivy-aot`: Only run tests that have to do with ivy AOT. For this, you may have to include `--define=compile=aot`, e.g. `--test_tag_filters=ivy-aot`.. - `ivy-only`: Useful for excluding all Ivy build and tests targets with `--define=compile=legacy`.
- `ivy-only`: Only run ivy related tests, e.g. `--test_tag_filters=ivy-only`. - `fixme-ivy-aot`: Useful for including/excluding build and test targets that are currently broken in Ivy AOT mode (`--define=compile=aot`).
- `fixme-ivy-jit`: Useful for including/excluding build and test targets that are currently broken in Ivy JIT mode (`--define=compile=jit`).
### Debugging a Node Test ### Debugging a Node Test

View File

@ -26,10 +26,10 @@
"update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG", "update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG",
"check-env": "gulp check-env", "check-env": "gulp check-env",
"commitmsg": "node ./scripts/git/commit-msg.js", "commitmsg": "node ./scripts/git/commit-msg.js",
"test-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=ivy-jit", "test-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy-jit,-fixme-ivy-jit --test_tag_filters=-no-ivy-jit,-fixme-ivy-jit",
"test-fixme-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy", "test-fixme-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy-jit --test_tag_filters=-no-ivy-jit",
"test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=ivy-aot --test_tag_filters=ivy-aot", "test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot",
"test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy" "test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot --test_tag_filters=-no-ivy-aot"
}, },
"dependencies": { "dependencies": {
"@angular-devkit/schematics": "^0.5.5", "@angular-devkit/schematics": "^0.5.5",

View File

@ -44,7 +44,7 @@ PKG_GROUP_REPLACEMENTS = {
]""" % ",\n ".join(["\"%s\"" % s for s in ANGULAR_SCOPED_PACKAGES]), ]""" % ",\n ".join(["\"%s\"" % s for s in ANGULAR_SCOPED_PACKAGES]),
} }
def ts_library(tsconfig = None, testonly = False, deps = [], tags = [], **kwargs): def ts_library(tsconfig = None, testonly = False, deps = [], **kwargs):
"""Default values for ts_library""" """Default values for ts_library"""
deps = deps + ["@ngdeps//tslib"] deps = deps + ["@ngdeps//tslib"]
if testonly: if testonly:
@ -62,11 +62,10 @@ def ts_library(tsconfig = None, testonly = False, deps = [], tags = [], **kwargs
testonly = testonly, testonly = testonly,
deps = deps, deps = deps,
node_modules = _DEFAULT_TS_TYPINGS, node_modules = _DEFAULT_TS_TYPINGS,
tags = ivy_tags(tags),
**kwargs **kwargs
) )
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], tags = [], **kwargs): def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], **kwargs):
"""Default values for ng_module""" """Default values for ng_module"""
deps = deps + ["@ngdeps//tslib"] deps = deps + ["@ngdeps//tslib"]
if testonly: if testonly:
@ -90,7 +89,6 @@ def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps
compiler = _INTERNAL_NG_MODULE_COMPILER, compiler = _INTERNAL_NG_MODULE_COMPILER,
ng_xi18n = _INTERNAL_NG_MODULE_XI18N, ng_xi18n = _INTERNAL_NG_MODULE_XI18N,
node_modules = _DEFAULT_TS_TYPINGS, node_modules = _DEFAULT_TS_TYPINGS,
tags = ivy_tags(tags),
**kwargs **kwargs
) )
@ -152,7 +150,7 @@ def npm_package(name, replacements = {}, **kwargs):
**kwargs **kwargs
) )
def ts_web_test_suite(bootstrap = [], deps = [], tags = [], **kwargs): def ts_web_test_suite(bootstrap = [], deps = [], **kwargs):
"""Default values for ts_web_test_suite""" """Default values for ts_web_test_suite"""
if not bootstrap: if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"] bootstrap = ["//:web_test_bootstrap_scripts"]
@ -175,7 +173,6 @@ def ts_web_test_suite(bootstrap = [], deps = [], tags = [], **kwargs):
# "@io_bazel_rules_webtesting//browsers:firefox-local", # "@io_bazel_rules_webtesting//browsers:firefox-local",
# TODO(alexeagle): add remote browsers on SauceLabs # TODO(alexeagle): add remote browsers on SauceLabs
], ],
tags = ivy_tags(tags),
**kwargs **kwargs
) )
@ -188,7 +185,7 @@ def nodejs_binary(data = [], **kwargs):
**kwargs **kwargs
) )
def jasmine_node_test(deps = [], tags = [], **kwargs): def jasmine_node_test(deps = [], **kwargs):
"""Default values for jasmine_node_test""" """Default values for jasmine_node_test"""
deps = deps + [ deps = deps + [
# Very common dependencies for tests # Very common dependencies for tests
@ -204,7 +201,6 @@ def jasmine_node_test(deps = [], tags = [], **kwargs):
] ]
_jasmine_node_test( _jasmine_node_test(
deps = deps, deps = deps,
tags = ivy_tags(tags),
# Pass-thru --define=compile=foo as an environment variable # Pass-thru --define=compile=foo as an environment variable
configuration_env_vars = ["compile"], configuration_env_vars = ["compile"],
**kwargs **kwargs
@ -219,16 +215,3 @@ def ng_rollup_bundle(deps = [], **kwargs):
deps = deps, deps = deps,
**kwargs **kwargs
) )
def ivy_tags(tags):
"""Sets inclusive ivy-jit and ivy-local tags"""
# Set the tags by default unless no-ivy-jit, no-ivy-aot, fixme-ivy-jit, or fixme-ivy-aot were specified.
# We should remove this and use only explicitly defined tags once https://github.com/bazelbuild/rules_nodejs/pull/388 is fixed.
if not tags:
tags = ["ivy-jit", "ivy-aot"]
elif "no-ivy-jit" not in tags and "fixme-ivy-jit" not in tags:
tags = tags + ["ivy-jit"]
elif "no-ivy-aot" not in tags and "fixme-ivy-aot" not in tags:
tags = tags + ["ivy-aot"]
return tags