Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ The configuration has the following syntax:
"bluebazel.shellCommands": [
{
"name": "myCommand1",
"command": "A shell command"
"command": "A shell command",
"memoized": false
}
]
```
Expand All @@ -100,15 +101,23 @@ Example:
"bluebazel.shellCommands": [
{
"name": "myEcho",
"command": "echo this is my custom shell command"
"command": "echo this is my custom shell command",
"memoized": true,
},
{
"name": "myEchoEcho",
"command": "echo <myEcho>" // This will execute the command `myEcho` and echo the result.
},
{
"name": "myDecoaratedEcho",
"command": "echo \"Echo was: <myEcho>\""
}
]
```

In the above example, the command `myEcho` will only be evaluated once, then memoized and reused in both
`myEchoMyEcho` and `myDecoratedEcho`.

### Custom Button configuration

Custom buttons configuration allows the user to add sections and buttons to the bazel view container, and link
Expand Down Expand Up @@ -188,6 +197,7 @@ Here are additional keywords to receive user input at the time of the execution:

1. [Pick(`arg`)]: This shows an item list for the user to choose one from. `arg` must be a command that returns multiline string where each line corresponds to an item.
2. [Input()]: This receives a plain string input from the user.
3. [MultiPick(`arg`)]: Similar to `Pick`, this shows an item list for the user to choose one or more from. Where as `Pick` returns a single selection, `MultiPick` returns all selections, one per line (output is one selection per line, separated by a "\n").

### A complete example

Expand All @@ -206,6 +216,18 @@ This example illustrates the `Test` button:
"methodName": "bluebazel.test"
}
]
},
{
"title": "Run PyTest",
"buttons": [
{
"title": "Run Selected Test Cases",
"command": "bazel test <confirmedTestTargetAsLabel> --build_tests_only --test_timeout=1500 <confirmExtraTestArgs> <testCaseTestArgList>",
"description": "Select and run specific test case(s)",
"tooltip": "Select and run specific test case(s) with `bazel test`",
"methodName": "bluebazel.runPyTestCase"
}
]
}
],
"bluebazel.shellCommands": [
Expand All @@ -216,6 +238,27 @@ This example illustrates the `Test` button:
{
"name": "testTarget",
"command": "bash -c 'source scripts/envsetup.sh > /dev/null && bazel query \"tests(<testTargetHelper>)\""
},
{
"name": "testTargetAsLabel",
"command": "echo -n ${bluebazel.testTarget} | perl -pe 's|^bazel-bin(/.*?)/([^/]+)$|/$1:$2|'"
},
{
"name": "confirmedTestTargetAsLabel",
"command": "echo -n \"[Input(<testTargetAsLabel>)]\"",
"memoized": true
},
{
"name": "testCaseListHelper",
"command": "bazel run --ui_event_filters=-info,-stdout,-stderr --noshow_progress <confirmedTestTargetAsLabel> -- --collect-only -qq --no-cov --disable-warnings --color=no | grep -E '(.*?/).+::.+'",
},
{
"name": "confirmExtraTestArgs",
"command": "echo -n \"[Input(--test_arg=\\\"--no-cov\\\")]\"",
},
{
"name": "testCaseTestArgList",
"command": "echo -n \"[MultiPick(<testCaseListHelper>)]\" | awk '{print \"--test_arg=\\\"\"$1\"\\\"\"}' | tr \"\n\" \" \"",
}
]
```
Expand All @@ -225,9 +268,19 @@ modifies it to return something in the form of `//path/...`.

`testTarget` gives this input to `bazel query` to return all available tests in this path.

Finally, the button `Test` uses the output of `testTarget` to display the user the list of tests to choose from,
`testTargetAsLabel` formats the selected test target bazel path as a label.

`testCaseTestArgList` takes a `MultiSelect` output and formats it as a series of `--test_arg` options
passed to the Bazel test command.

The button `Test` uses the output of `testTarget` to display the user the list of tests to choose from,
and executes the test using the current configs and run arguments.

Finally, the button `Run Selected Test Cases` uses the output of `testCaseTestArgList` to display the user the
list of PyTest-managed Python test cases corresponding to the current `testTarget`. `testTarget`
is assumed to support both the Bazel test and run execution phases and that it conforms to the PyTest
command line program interface.

## Releases

See [Release Notes](ReleaseNotes.md)
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ Clear the workspace state only on major version changes.
Add unit tests for the bazel parser and service.
Fix query of targets to be more accurate.
Fix argument passing when debugging with C/C++ and GDB.

## 1.1.0

Support MultiPick quickpik extension.
Support memoizing shellCommand outputs for repeated use in a button command.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bluebazel",
"displayName": "Blue Bazel",
"description": "Bazel vscode UI integration to build, debug, and test targets",
"version": "1.0.5",
"version": "1.1.0",
"engines": {
"vscode": "^1.85.2"
},
Expand Down
Loading