Skip to content

Commit

Permalink
fixup! docs(ivy): add better documentation around debugging ivy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Aug 13, 2018
1 parent 34323c5 commit 6f51918
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
11 changes: 5 additions & 6 deletions docs/BAZEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ See also: [`//tools/bazel.rc`](https://github.com/angular/angular/blob/master/to
See also: [`./src/ivy_switch.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch.ts) for more details.

- `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below)
- `--define=compile=<option>` Controls if ivy or legacy mode is enabled. This is down by generating the [`src/ivy_switch.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch.ts) file from [`ivy_switch_legacy.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_legacy.ts) (default), [`ivy_switch_jit.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_jit.ts), or [`ivy_switch_local.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_local.ts).
- `legacy`: (default behavior) compile against legacy renderer, e.g. `--define=compile=legacy`
- `--define=compile=<option>` Controls if ivy or legacy mode is enabled. This is done by generating the [`src/ivy_switch.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch.ts) file from [`ivy_switch_legacy.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_legacy.ts) (default), [`ivy_switch_jit.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_jit.ts), or [`ivy_switch_local.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_local.ts).
- `legacy`: (default behavior) compile against View Engine, e.g. `--define=compile=legacy`
- `jit`: Compile in ivy JIT mode, e.g. `--define=compile=jit`
- `local`: Compile in ivy AOT move, e.g. `--define=compile=local`
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config
of your rules in any given `BUILD.bazel`.
- `ivy-jit`: Only run tests that have to do with ivy JIT, e.g. `--test_tag_filters=ivy-jit`, e.g. `--test_tag_filters=ivy-local`. For this,
you may have to include `--define=compile=jit`.
- `ivy-local`: Only run tests that have to do with ivy AOT. For this, you may have to include `--define=compile=local`.
- `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-local`: Only run tests that have to do with ivy AOT. For this, you may have to include `--define=compile=local`, e.g. `--test_tag_filters=ivy-local`..
- `ivy-only`: Only run ivy related tests, e.g. `--test_tag_filters=ivy-only`.


Expand Down Expand Up @@ -129,7 +128,7 @@ First time setup:
},
```

** Setting breakpoints directly in your code files may not work in VSCode**.
**Setting breakpoints directly in your code files may not work in VSCode**. This is because the files you're actually debugging are built files that exist in a `./private/...` folder.
The easiest way to debug a test for now is to add a `debugger` statement in the code
and launch the bazel corresponding test (`bazel test <target> --config=debug`).

Expand Down
23 changes: 2 additions & 21 deletions packages/core/src/ivy_switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,8 @@
/**
* This file is used to control if the default rendering pipeline should be `ViewEngine` or `Ivy`.
*
* Reexport from:
* - `./ivy_switch_false` => Use `ViewEngine`.
* - `./ivy_switch_true` => Use `Ivy`.
*
* This file is here for your IDE as well as for `google3`. The `bazel` build system
* specifically excludes this file and instead generates a new file which is controlled by
* command line:
*
* - `bazel build packages/core` => Use `ViewEngine`
* - `bazel build packages/core --define=ivy=true` => Use `Ivy`
*
* See: `bazel build packages/core:ivy_switch` for more details.
*
* ## How to use this
*
* Use this mechanism to have the same symbol be aliased to different implementation.
* 1) Create two implementations of a symbol (most likely a `function` or a `class`).
* 2) Export the two implementation under same name in `./ivy_switch_false` and `./ivy_switch_false`
* respectively.
* 3) Import the symbol from `./ivy_switch`. The imported symbol will that point to either the
* symbol in `./ivy_switch_false` and `./ivy_switch_false` depending on the compilation mode.
* For more information on how to run and debug tests with either Ivy or View Engine (legacy),
* please see [BAZEL.md](./docs/BAZEL.md).
*/
export * from './ivy_switch_legacy';

Expand Down

0 comments on commit 6f51918

Please sign in to comment.