Update README & images to reflect latest state of extension
17
FEATURES.md
|
@ -1,17 +0,0 @@
|
|||
# Features
|
||||
|
||||
- Run [Gradle tasks](https://gradle.org/) as [VS Code tasks](https://code.visualstudio.com/docs/editor/tasks)
|
||||
- List & runs Gradle tasks in the Explorer
|
||||
- Supports massive Gradle projects (eg with 10000+ tasks)
|
||||
- Uses the [Gradle Tooling API](https://docs.gradle.org/current/userguide/third_party_integration.html#embedding) to discover and run Gradle tasks
|
||||
- Uses a long running gRPC server which provides good performance
|
||||
- Supports Kotlin & Groovy build files
|
||||
- Supports [multi-project builds](https://docs.gradle.org/current/userguide/multi_project_builds.html)
|
||||
- Supports multi-root workspaces
|
||||
- Show flat or nested tasks in the explorer
|
||||
- Gracefully cancel a running Gradle Task
|
||||
- Debug JavaExec tasks
|
||||
- Run/debug a task with custom arguments
|
||||
- Updates project configuration after running tasks, via the [Java language server](https://github.com/redhat-developer/vscode-java) (if installed)
|
||||
|
||||
Watch a short demo of the features: https://www.youtube.com/watch?v=n8hmndccxHI
|
204
README.md
|
@ -1,7 +1,7 @@
|
|||
# VS Code Gradle Tasks
|
||||
|
||||
[![Marketplace Version](https://vsmarketplacebadge.apphb.com/version-short/richardwillis.vscode-gradle.svg)](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-gradle)
|
||||
[![Build status](https://img.shields.io/github/workflow/status/badsyntax/vscode-gradle/Build)](https://github.com/badsyntax/vscode-gradle/actions?query=workflow%3ABuild)
|
||||
[![Build status](https://img.shields.io/github/workflow/status/badsyntax/vscode-gradle/Build%20&%20Publish)](https://github.com/badsyntax/vscode-gradle/actions?query=workflow%3A"Build+%26+Publish")
|
||||
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=badsyntax_vscode-gradle&metric=security_rating)](https://sonarcloud.io/dashboard?id=badsyntax_vscode-gradle)
|
||||
[![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/richardwillis.vscode-gradle)](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-gradle)
|
||||
[![GitHub bug issues](https://img.shields.io/github/issues/badsyntax/vscode-gradle/bug?label=bug%20reports)](https://github.com/badsyntax/vscode-gradle/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
|
@ -10,64 +10,43 @@ Run Gradle tasks in VS Code.
|
|||
|
||||
![Gradle Tasks Screencast](images/screencast.gif)
|
||||
|
||||
## Features
|
||||
|
||||
This extension provides a visual interface for your Gradle build. You can view Gradle projects and run Gradle tasks.
|
||||
|
||||
This extension supports whatever Gradle supports and is language/project agnostic, but it can work nicely alongside other extensions like the [Java language support extension](https://github.com/redhat-developer/vscode-java).
|
||||
|
||||
👉 [All Features](./FEATURES.md)
|
||||
|
||||
## Requirements
|
||||
|
||||
- [VS Code >= 1.45.0](https://code.visualstudio.com/download)
|
||||
- [Java >= 8](https://adoptopenjdk.net/)
|
||||
- Local Gradle wrapper executables must exist at the root of the workspace folders
|
||||
|
||||
## Settings
|
||||
## Features
|
||||
|
||||
This extension contributes the following settings:
|
||||
This extension provides a visual interface for your Gradle build. It supports whatever Gradle supports and is language agnostic, but can work nicely alongside other extensions like the [Java language support extension](https://github.com/redhat-developer/vscode-java).
|
||||
|
||||
- `gradle.autoDetect`: Automatically detect Gradle tasks
|
||||
- `gradle.focusTaskInExplorer`: Focus the task in the explorer when running a task
|
||||
- `gradle.javaDebug`: Debug JavaExec tasks (see below for usage)
|
||||
- `gradle.debug`: Show extra debug info in the output panel
|
||||
- `gradle.disableConfirmations`: Disable the warning confirm messages when performing batch actions (eg clear tasks, stop daemons etc)
|
||||
Access the Gradle views by clicking on the Gradle icon the [activity bar](https://code.visualstudio.com/docs/getstarted/userinterface).
|
||||
|
||||
To provide better compatibility with the [Java language support extension](https://github.com/redhat-developer/vscode-java), this extension supports the following settings:
|
||||
<details><summary>List projects and tasks</summary>
|
||||
|
||||
- `java.home`: Absolute path to JDK home folder used to launch the gradle daemons
|
||||
- `java.import.gradle.user.home`: Setting for `GRADLE_USER_HOME`
|
||||
- `java.import.gradle.jvmArguments`: JVM arguments to pass to Gradle
|
||||
- `java.import.gradle.wrapper.enabled`: Enable/disable the Gradle wrapper
|
||||
- `java.import.gradle.version`: Gradle version, used if the gradle wrapper is missing or disabled
|
||||
A Gradle build can have one or more projects. Projects are listed in a flat list with the root project listed first, and sub-projects listed alphabetically thereafter.
|
||||
|
||||
If you're not using the [Java language support extension](https://github.com/redhat-developer/vscode-java), you can use the standard Java & Gradle environment variables (see below), or standard Gradle settings (eg via `gradle.properties` or task configuration), to configure your tasks and/or Gradle settings.
|
||||
When you expand a project, tasks are listed in a tree, grouped by the task group. You can toggle the display of the tasks by clicking on the `Show Flat List`/`Show Tree` button in the treeview header.
|
||||
|
||||
## Supported Environment Variables
|
||||
<img src="./images/gradle-tasks-view.png" width="350" alt="Gradle Tasks View" />
|
||||
|
||||
Most of the standard Java & Gradle environment variables are supported:
|
||||
</details>
|
||||
<details><summary>Run tasks</summary>
|
||||
|
||||
- `JAVE_HOME` (overridden by `java.home`)
|
||||
- `GRADLE_USER_HOME` (overridden by `java.import.gradle.user.home`)
|
||||
Tasks can be run via the `Gradle Tasks`, `Pinned Tasks` or `Recent Tasks` treeviews, or as vscode tasks via `Command Palette => Run Task`.
|
||||
|
||||
### Setting Project Environment Variables
|
||||
A running task will be shown with an animated "spinner" icon in the treeviews, along with `Cancel Task` & `Restart Task` buttons. The `Cancel Task` button will gracefully cancel the task. The `Restart Task` button will first cancel the task, then restart it.
|
||||
|
||||
You can use an environment manager like [direnv](https://direnv.net/) to set project specific environment variables, or set the variables in the terminal settings within `.vscode/settings.json`, for example:
|
||||
<img src="./images/task-run.png" width="350" alt="Gradle Tasks Running" />
|
||||
|
||||
```json
|
||||
{
|
||||
"terminal.integrated.env.osx": {
|
||||
"GRADLE_USER_HOME": "${workspaceFolder}/.gradle"
|
||||
}
|
||||
}
|
||||
```
|
||||
A task will be run a vscode terminal where you can view the task output.
|
||||
|
||||
_Note, the VS Code settings take precedence over the environment variables._
|
||||
Send a SIGINT signal (ctrl/cmd + c) in the terminal to gracefully cancel it.
|
||||
|
||||
## Debug JavaExec Tasks
|
||||
<img src="./images/task-output.png" width="650" alt="Gradle Tasks Output" />
|
||||
|
||||
![Debug Screencast](images/debug-screencast.gif?1)
|
||||
</details>
|
||||
<details><summary>Debug JavaExec tasks</summary>
|
||||
|
||||
This extension provides an experimental feature to debug [JavaExec](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html) tasks. Before using this feature you need to install the [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) and [Language Support for Java](https://marketplace.visualstudio.com/items?itemName=redhat.java) extensions.
|
||||
|
||||
|
@ -85,9 +64,131 @@ To enable this feature you need to specify which tasks can be debugged within yo
|
|||
|
||||
You should now see a `debug` command next to the `run` command in the Gradle Tasks view. The `debug` command will start the Gradle task with [jdwp](https://docs.oracle.com/en/java/javase/11/docs/specs/jpda/conninv.html#oracle-vm-invocation-options) `jvmArgs` and start the vscode Java debugger.
|
||||
|
||||
![Debug Screencast](images/debug-screencast.gif?1)
|
||||
|
||||
</details>
|
||||
<details><summary>Pin tasks</summary>
|
||||
|
||||
As there could be many tasks in a Gradle project, it can be useful to pin commonly used tasks. Pinned tasks will be shown in a seperate view. Pin a task by accessing the task context menu (by right-clicking a task). You can also pin a task with specific arguments.
|
||||
|
||||
<img src="./images/pin-task.png" width="350" alt="Pin a Gradle Task" />
|
||||
|
||||
To remove a pinned a task, access the task context menu and select `Remove Pinned Task`, or clear all pinned tasks by clicking on the `Clear Pinned Tasks` button in the treeview header.
|
||||
|
||||
<img src="./images/remove-pinned-task.png" width="350" alt="Remove a pinned Gradle Task" />
|
||||
|
||||
> Protip: for easier access to pinned tasks, drag and drop the `Pinned Gradle Tasks` view into the explorer view.
|
||||
|
||||
</details>
|
||||
<details><summary>List recent tasks</summary>
|
||||
|
||||
Recently run Gradle tasks are listed in a seperate treeview. This can be useful to see a history of tasks and to easily access the associated task terminals.
|
||||
|
||||
The number shown next to the task is the amount of times the task has been run. Click on the `Show Terminal` button next to a task to view the most recent terminal for that task. Click on the `Close Terminal/s` button to close the terminal/s for that task.
|
||||
|
||||
Click on the `Clear Recent Tasks` button in the treeview header to remove all recent tasks from the list, or click on the `Close All Terminals` button to close all task terminals.
|
||||
|
||||
<img src="./images/recent-tasks.png" width="350" alt="Recent Tasks" />
|
||||
|
||||
</details>
|
||||
<details><summary>List & kill Gradle daemons</summary>
|
||||
|
||||
Gradle daemon processes are listed by their process ID in a seperate treeview and can have the following states: `IDLE`, `BUSY`, `STOPPED`, `STOPPING`, `CANCELED`.
|
||||
|
||||
Stop individual daemons by clicking on the `Stop Daemon` button next to the listed daemon.
|
||||
|
||||
Stop all daemons by clicking on the `Stop Daemons` button in the treeview header.
|
||||
|
||||
<img src="./images/gradle-daemons.png" width="350" alt="Recent Tasks" />
|
||||
|
||||
After stopping a daemon, it will remain in the `STOPPED` state for a while, but the underlying process won't exist. This is the default Gradle behaviour.
|
||||
|
||||
Most of the time there should be no reason to stop a daemon. View more info on the [Gradle Daemon](https://docs.gradle.org/current/userguide/gradle_daemon.html) from the Gradle website.
|
||||
|
||||
The extension uses the Gradle wrapper to list daemons, and is quite a slow process. If the daemon view is not useful for you, you can simply collapse the view, or disable it completely.
|
||||
|
||||
</details>
|
||||
<details><summary>Full features list</summary>
|
||||
|
||||
- List Gradle Tasks & Projects
|
||||
- Run [Gradle tasks](https://gradle.org/) as [VS Code tasks](https://code.visualstudio.com/docs/editor/tasks)
|
||||
- Supports massive Gradle projects (eg with 10000+ tasks)
|
||||
- Uses the [Gradle Tooling API](https://docs.gradle.org/current/userguide/third_party_integration.html#embedding) to discover and run Gradle tasks
|
||||
- Uses a long running gRPC server which provides good performance
|
||||
- Supports Kotlin & Groovy build files
|
||||
- Supports [multi-project builds](https://docs.gradle.org/current/userguide/multi_project_builds.html)
|
||||
- Supports [multi-root workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces)
|
||||
- Show flat or nested tasks in the explorer
|
||||
- Gracefully cancel a running task
|
||||
- Debug JavaExec tasks
|
||||
- Run/debug a task with custom arguments
|
||||
- Pin tasks
|
||||
- List recent tasks
|
||||
- List & stop daemons
|
||||
|
||||
</details>
|
||||
|
||||
## VS Code Settings
|
||||
|
||||
This extension contributes the following settings:
|
||||
|
||||
- `gradle.autoDetect`: Automatically detect Gradle tasks
|
||||
- `gradle.focusTaskInExplorer`: Focus the task in the explorer when running a task
|
||||
- `gradle.javaDebug`: Debug JavaExec tasks (see below for usage)
|
||||
- `gradle.debug`: Show extra debug info in the output panel
|
||||
- `gradle.disableConfirmations`: Disable the warning confirm messages when performing batch actions (eg clear tasks, stop daemons etc)
|
||||
|
||||
## Gradle & Java Settings
|
||||
|
||||
Set Gradle & Java options with standard environment variables or standard Gradle settings (eg via `gradle.properties` or task configuration).
|
||||
|
||||
### Example Environment Variables
|
||||
|
||||
- `JAVE_HOME`
|
||||
- `GRADLE_USER_HOME`
|
||||
|
||||
_Note, the VS Code settings take precedence over the environment variables._
|
||||
|
||||
<details><summary>Setting Project Environment Variables</summary>
|
||||
|
||||
You can use an environment manager like [direnv](https://direnv.net/) to set project specific environment variables, or set the variables in the terminal settings within `.vscode/settings.json`, for example:
|
||||
|
||||
```json
|
||||
{
|
||||
"terminal.integrated.env.osx": {
|
||||
"GRADLE_USER_HOME": "${workspaceFolder}/.gradle"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Compatibility with the [Java language support](https://github.com/redhat-developer/vscode-java) extension
|
||||
|
||||
### VS Code Settings
|
||||
|
||||
This extension supports the following settings which are contributed by the [Java language support](https://github.com/redhat-developer/vscode-java) extension:
|
||||
|
||||
- `java.home`: Absolute path to JDK home folder used to launch the gradle daemons
|
||||
- `java.import.gradle.user.home`: Setting for `GRADLE_USER_HOME`
|
||||
- `java.import.gradle.jvmArguments`: JVM arguments to pass to Gradle
|
||||
- `java.import.gradle.wrapper.enabled`: Enable/disable the Gradle wrapper
|
||||
- `java.import.gradle.version`: Gradle version, used if the gradle wrapper is missing or disabled
|
||||
|
||||
### Class References
|
||||
|
||||
There are cases where Gradle tasks will generate Java classes. To ensure these Java classes are indexed correctly by the Java language server, you need to ensure the paths are added to the `.classpath`, and this is typically achieved using Gradle [`sourceSets`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html).
|
||||
|
||||
Once you've configured your `sourceSets` correctly, follow these steps:
|
||||
|
||||
1. Generate your classes by running the relevant Gradle Task
|
||||
2. Force the Language Server to index the generated classes by right-clicking on `build.gradle` and selecting `Update project configuration`.
|
||||
|
||||
At this point the gradle `sourceSet` paths will be added to the `.classpath` and the Language Server will automatically update references when those classes change.
|
||||
|
||||
## Extension API
|
||||
|
||||
This extension provides an API which you can use in your own 3rd-party vscode extension.
|
||||
This extension provides an API which can be used by 3rd-party vscode extensions.
|
||||
|
||||
👉 [Extension API](./API.md)
|
||||
|
||||
|
@ -95,13 +196,19 @@ This extension provides an API which you can use in your own 3rd-party vscode ex
|
|||
|
||||
<details><summary>View logs by selecting "Gradle Tasks" in the output panel</summary>
|
||||
|
||||
<img src="./images/output.png" width="600" />
|
||||
<img src="./images/output.png" width="800" alt="Gradle extension output" />
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Set the "gradle.debug" setting to "true" to view debug logs in the output panel</summary>
|
||||
|
||||
<img src="./images/debug-output.png" width="800" alt="Gradle extension debug output" />
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Task output will be shown in the Terminal panel</summary>
|
||||
|
||||
<img src="./images/terminal.png" width="600" />
|
||||
<img src="./images/task-output.png" width="800" alt="Gradle task output" />
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -123,12 +230,6 @@ When you open a Gradle project for the first time, the Gradle wrapper will start
|
|||
|
||||
</details>
|
||||
|
||||
<details><summary>Set the "gradle.debug" setting to "true" to view debug logs in the output panel</summary>
|
||||
|
||||
<img src="./images/debug-output.png" width="600" />
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>"No connection to the gradle server. Try restarting the server"</summary>
|
||||
|
||||
<img src="./images/no-connection.png" width="500" />
|
||||
|
@ -213,7 +314,12 @@ Refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to run the
|
|||
|
||||
- Originally forked from [Cazzar/vscode-gradle](https://github.com/Cazzar/vscode-gradle)
|
||||
- Inspired by the built-in [npm extension](https://github.com/microsoft/vscode/tree/master/extensions/npm)
|
||||
- Thanks to all who have submitted bug reports and feedback 👍
|
||||
- Thanks to [@hanct](https://github.com/hanct) for providing feature suggestions and BETA testing
|
||||
- Thanks to all who have submitted bug reports and feedback
|
||||
|
||||
## Related Extensions
|
||||
|
||||
Check out [vscode-spotless-gradle](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-spotless-gradle) which formats your source files using [Spotless](https://github.com/diffplug/spotless) & Gradle.
|
||||
|
||||
## Release Notes
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ def docsFiles = [
|
|||
"LICENSE.md",
|
||||
"ARCHITECTURE.md",
|
||||
"CONTRIBUTING.md",
|
||||
"FEATURES.md",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
|
||||
|
|
Двоичные данные
images/debug-output.png
До Ширина: | Высота: | Размер: 198 KiB После Ширина: | Высота: | Размер: 171 KiB |
После Ширина: | Высота: | Размер: 28 KiB |
После Ширина: | Высота: | Размер: 101 KiB |
Двоичные данные
images/output.png
До Ширина: | Высота: | Размер: 115 KiB После Ширина: | Высота: | Размер: 176 KiB |
После Ширина: | Высота: | Размер: 177 KiB |
После Ширина: | Высота: | Размер: 36 KiB |
После Ширина: | Высота: | Размер: 123 KiB |
Двоичные данные
images/screencast.gif
До Ширина: | Высота: | Размер: 388 KiB После Ширина: | Высота: | Размер: 545 KiB |
Двоичные данные
images/task-list.png
До Ширина: | Высота: | Размер: 197 KiB |
После Ширина: | Высота: | Размер: 58 KiB |
После Ширина: | Высота: | Размер: 63 KiB |
Двоичные данные
images/terminal.png
До Ширина: | Высота: | Размер: 139 KiB |