From 30f319a11f1664fd6088b2b36f90b91b84335d13 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 24 Oct 2018 18:15:46 -0700 Subject: [PATCH] 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 --- .circleci/config.yml | 4 ++-- docs/BAZEL.md | 13 +++++++------ package.json | 8 ++++---- tools/defaults.bzl | 25 ++++--------------------- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a2b25cfad9..fc680bd205 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,7 +131,7 @@ jobs: - run: bazel run @yarn//:yarn - *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: <<: *job_defaults @@ -144,7 +144,7 @@ jobs: - run: bazel run @yarn//:yarn - *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: <<: *job_defaults diff --git a/docs/BAZEL.md b/docs/BAZEL.md index 513a612b79..2c02a2f2c9 100644 --- a/docs/BAZEL.md +++ b/docs/BAZEL.md @@ -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. -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) - `--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` - `jit`: Compile in ivy JIT mode, e.g. `--define=compile=jit` - `aot`: Compile in ivy AOT move, e.g. `--define=compile=aot` -- `--test_tag_filters=`: filter tests down to tags defined in the `tag` config -of your rules in any given `BUILD.bazel`. - - `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`. - - `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`: Only run ivy related tests, e.g. `--test_tag_filters=ivy-only`. +- `--test_tag_filters=`: filter tests down to tags defined in the `tag` config 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`). + - `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-only`: Useful for excluding all Ivy build and tests targets with `--define=compile=legacy`. + - `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 diff --git a/package.json b/package.json index c2bf8c0893..f2fb8246cd 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG", "check-env": "gulp check-env", "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-fixme-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy", - "test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=ivy-aot --test_tag_filters=ivy-aot", - "test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy" + "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-jit --test_tag_filters=-no-ivy-jit", + "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-aot --test_tag_filters=-no-ivy-aot" }, "dependencies": { "@angular-devkit/schematics": "^0.5.5", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 11c878701c..c3c4c09c02 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -44,7 +44,7 @@ PKG_GROUP_REPLACEMENTS = { ]""" % ",\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""" deps = deps + ["@ngdeps//tslib"] if testonly: @@ -62,11 +62,10 @@ def ts_library(tsconfig = None, testonly = False, deps = [], tags = [], **kwargs testonly = testonly, deps = deps, node_modules = _DEFAULT_TS_TYPINGS, - tags = ivy_tags(tags), **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""" deps = deps + ["@ngdeps//tslib"] if testonly: @@ -90,7 +89,6 @@ def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps compiler = _INTERNAL_NG_MODULE_COMPILER, ng_xi18n = _INTERNAL_NG_MODULE_XI18N, node_modules = _DEFAULT_TS_TYPINGS, - tags = ivy_tags(tags), **kwargs ) @@ -152,7 +150,7 @@ def npm_package(name, replacements = {}, **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""" if not bootstrap: 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", # TODO(alexeagle): add remote browsers on SauceLabs ], - tags = ivy_tags(tags), **kwargs ) @@ -188,7 +185,7 @@ def nodejs_binary(data = [], **kwargs): **kwargs ) -def jasmine_node_test(deps = [], tags = [], **kwargs): +def jasmine_node_test(deps = [], **kwargs): """Default values for jasmine_node_test""" deps = deps + [ # Very common dependencies for tests @@ -204,7 +201,6 @@ def jasmine_node_test(deps = [], tags = [], **kwargs): ] _jasmine_node_test( deps = deps, - tags = ivy_tags(tags), # Pass-thru --define=compile=foo as an environment variable configuration_env_vars = ["compile"], **kwargs @@ -219,16 +215,3 @@ def ng_rollup_bundle(deps = [], **kwargs): deps = deps, **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