Skip to content

Commit

Permalink
Merged develop manually
Browse files Browse the repository at this point in the history
  • Loading branch information
ravihara committed Feb 27, 2022
2 parents 72bbe51 + 7c80474 commit d9322d3
Show file tree
Hide file tree
Showing 40 changed files with 634 additions and 733 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ build

# build plugin jar files
gradle-server/src/main/resources/*.jar

# Ignore user-specified .tool-versions file (asdf-vm configuration)
.tool-versions
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ A root project (`projectDir`) is defined by having a gradle wrapper script at th

Once the client has discovered the root projects for all workspaces, it requests project data for each root project via separate gRPC method calls using `getBuild`. Gradle progress and output (`STDERR` & `STDOUT`) are streamed to the client. Once the tasks have been discovered and returned to the client, it builds a single-dimensional list of vscode tasks from the Gradle project tasks. These vscode tasks have definitions that contain all the relevant task & project information.

The extension models the project hierarchical structure using the vscode treeView. The treeview data provider consumes the vscode tasks, and builds a tree of projects & tasks using the information provided in the task definitions.
The extension models the project hierarchical structure using the vscode tree view. The tree view data provider consumes the vscode tasks, and builds a tree of projects & tasks using the information provided in the task definitions.

## Running Tasks

Gradle tasks can be run through either the [treeView](https://code.visualstudio.com/api/extension-guides/tree-view) or the Command Palette.
Gradle tasks can be run through either the [Tree View](https://code.visualstudio.com/api/extension-guides/tree-view) or the Command Palette.

Tasks are run via the `runBuild` gRPC method. Similar to getting project data, Gradle progress and output (`STDERR` & `STDOUT`) is streamed to the client. Tasks are run in a custom vscode terminal. The `runBuild` gRPC method accepts a list of arguments which are passed to the `BuildLauncher`.

Expand Down
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ This extension supports both root and nested Gradle projects. A Gradle project i

Once the extension is activated you will see a new Gradle icon in the [activity bar](https://code.visualstudio.com/docs/getstarted/userinterface). Clicking on this icon will reveal some tree views in the sidebar.

> Protip: you can move drag & drop any of these treeviews into the main explorer view for easier access. This is especially useful for pinned tasks.
> Protip: you can move drag & drop any of these tree views into the main explorer view for easier access. This is especially useful for pinned tasks.
You can also run any Gradle task as a [VS Code task](https://code.visualstudio.com/docs/editor/tasks). Access the Gradle VS Code tasks by running `Run Task` from the command palette.

<details><summary>List projects and tasks</summary>

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.

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.
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 tree view header.

<img src="images/gradle-tasks-view.png" width="350" alt="Gradle Tasks View" />
</details>
Expand All @@ -43,11 +43,11 @@ The project's dependencies are included in the `Dependencies` item under the pro

Tasks can be run via:

- `Gradle Projects`, `Pinned Tasks` or `Recent Tasks` treeviews
- `Gradle Projects` or `Recent Tasks` tree views
- `Run Task` command
- `Run a Gradle Build` command

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.
A running task will be shown with an animated "spinner" icon in the tree views, 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.

<img src="images/task-run.png" width="350" alt="Gradle Tasks Running" />

Expand All @@ -57,7 +57,7 @@ Send a SIGINT signal (ctrl/cmd + c) in the terminal to gracefully cancel it.

<img src="./images/task-output.png" width="650" alt="Gradle Tasks Output" />

Tasks run via the `Run a Gradle Build` command are not reflected in any of the treeviews. Use this command to specify your own Gradle build arguments, for example to run multiple tasks or to exclude tasks.
Tasks run via the `Run a Gradle Build` command are not reflected in any of the tree views. Use this command to specify your own Gradle build arguments, for example to run multiple tasks or to exclude tasks.

<img src="./images/run-build.png" width="650" alt="Run Gradle Build" />

Expand Down Expand Up @@ -113,33 +113,33 @@ You should now see a `debug` command next to the `run` command in the Gradle Pro
</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.
As there could be many tasks in a Gradle project, it can be useful to pin commonly used tasks. Pinned tasks will be shown under their project item. 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.
To unpin a task, access the task context menu and select `Unpin Task`, or unpin all pinned tasks by clicking on the `Unpin all Tasks` button in the overflow button of tree view header.

<img src="./images/remove-pinned-task.png" width="350" alt="Remove a pinned Gradle Task" />
<img src="./images/unpin-task.png" width="350" alt="Unpin a Gradle Task" />

</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.
Recently run Gradle tasks are listed in a separate tree view. 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.
Click on the `Clear Recent Tasks` button in the tree view 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`.
Gradle daemon processes are listed by their process ID in a separate tree view 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.
Stop all daemons by clicking on the `Stop Daemons` button in the tree view header.

<img src="./images/gradle-daemons.png" width="350" alt="Recent Tasks" />

Expand Down Expand Up @@ -211,7 +211,7 @@ We will continue improving the auto completion feature to support more cases in

</details>

## VS Code Settings
## Extension Settings

This extension contributes the following settings:

Expand Down Expand Up @@ -241,15 +241,18 @@ Use an environment manager like [direnv](https://direnv.net/) to set project spe

## Compatibility with the [Java language support](https://github.com/redhat-developer/vscode-java) extension

### VS Code Java Settings
### Java-Specific 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` (**deprecated**, recommended to use `java.jdt.ls.java.home` below): Absolute path to JDK home folder used to launch the Gradle daemons
- `java.jdt.ls.java.home`: Absolute path to JDK home folder used to launch the Gradle daemons
- `java.home`: (**deprecated** Please use `java.jdt.ls.java.home` as given below) Absolute path to JDK home folder used to launch the Gradle daemons
- `java.jdt.ls.java.home`: Absolute path to JDK home folder as per the latest VS code, used to launch the Gradle daemons
- `java.import.gradle.java.home`: Absolute path to JDK home folder used to launch the Gradle daemons (if set, this value takes precedence over `java.home`)
- `java.import.gradle.user.home`: Setting for `GRADLE_USER_HOME`
- `java.import.gradle.jvmArguments`: JVM arguments to pass to Gradle (_**Note:** There should be a space ` ` between two arguments_)
- `java.import.gradle.jvmArguments`: JVM arguments to pass to Gradle

>Note: There should be a `space` between two arguments
- `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
- `java.import.gradle.home`: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.
Expand Down
78 changes: 31 additions & 47 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,17 @@
"name": "Gradle Projects",
"when": "gradle:activated && gradle:defaultView"
},
{
"id": "pinnedTasksView",
"name": "Pinned Tasks",
"when": "gradle:activated"
},
{
"id": "recentTasksView",
"name": "Recent Tasks",
"when": "gradle:activated"
"when": "gradle:activated",
"visibility": "collapsed"
},
{
"id": "gradleDaemonsView",
"name": "Gradle Daemons",
"when": "gradle:activated"
"when": "gradle:activated",
"visibility": "collapsed"
}
]
},
Expand Down Expand Up @@ -142,8 +139,8 @@
"title": "Pin Task With Args"
},
{
"command": "gradle.removePinnedTask",
"title": "Remove Pinned Task"
"command": "gradle.unpinTask",
"title": "Unpin Task"
},
{
"command": "gradle.debugTask",
Expand Down Expand Up @@ -194,8 +191,8 @@
}
},
{
"command": "gradle.clearAllPinnedTasks",
"title": "Clear Pinned Tasks",
"command": "gradle.unpinAllTasks",
"title": "Unpin all Tasks",
"icon": {
"light": "resources/light/clear-all.svg",
"dark": "resources/dark/clear-all.svg"
Expand Down Expand Up @@ -304,14 +301,6 @@
"category": "Gradle",
"title": "Find Gradle Task"
},
{
"command": "gradle.openPinHelp",
"title": "Pin Info",
"icon": {
"light": "resources/light/help.svg",
"dark": "resources/dark/help.svg"
}
},
{
"command": "gradle.cancellingTreeItemTask",
"title": "Cancelling Task",
Expand Down Expand Up @@ -383,7 +372,7 @@
"when": "false"
},
{
"command": "gradle.clearAllPinnedTasks",
"command": "gradle.unpinAllTasks",
"when": "false"
},
{
Expand Down Expand Up @@ -434,10 +423,6 @@
"command": "gradle.openSettings",
"when": "false"
},
{
"command": "gradle.openPinHelp",
"when": "false"
},
{
"command": "gradle.cancellingTreeItemTask",
"when": "false"
Expand Down Expand Up @@ -466,6 +451,10 @@
"command": "gradle.hideStoppedDaemons",
"when": "false"
},
{
"command": "gradle.unpinTask",
"when": "false"
},
{
"command": "gradle.refresh",
"when": "gradle:extensionActivated"
Expand All @@ -485,14 +474,9 @@
],
"view/title": [
{
"command": "gradle.clearAllPinnedTasks",
"when": "view == pinnedTasksView",
"group": "navigation@0"
},
{
"command": "gradle.openPinHelp",
"when": "view == pinnedTasksView",
"group": "navigation@1"
"command": "gradle.unpinAllTasks",
"when": "view == gradleTasksView",
"group": "overflow_0@0"
},
{
"command": "gradle.openSettings",
Expand Down Expand Up @@ -556,57 +540,57 @@
"view/item/context": [
{
"command": "gradle.runTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^debugTask.*$|^task.*$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^(pinned)?debugTask.*$|^(pinned)?task.*$/",
"group": "contextGroup1@0"
},
{
"command": "gradle.runTaskWithArgs",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^debugTask(WithTerminals)?$|^task(WithTerminals)?$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^(pinned)?debugTask(WithTerminals)?$|^(pinned)?task(WithTerminals)?$/",
"group": "contextGroup1@1"
},
{
"command": "gradle.debugTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^debugTask.*$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?debugTask.*$/",
"group": "contextGroup2@0"
},
{
"command": "gradle.debugTaskWithArgs",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^debugTask(WithTerminals)?$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?debugTask(WithTerminals)?$/",
"group": "contextGroup2@1"
},
{
"command": "gradle.showTaskTerminal",
"when": "view == recentTasksView && viewItem =~ /^debugTask(WithArgs)?WithTerminals.*$|^task(WithArgs)?WithTerminals.*$|^runningTask(WithArgs)?WithTerminals.*$|^runningDebugTask(WithArgs)?WithTerminals.*$/",
"when": "view == recentTasksView && viewItem =~ /^(pinned)?debugTask(WithArgs)?WithTerminals.*$|^(pinned)?task(WithArgs)?WithTerminals.*$|^(pinned)?runningTask(WithArgs)?WithTerminals.*$|^(pinned)?runningDebugTask(WithArgs)?WithTerminals.*$/",
"group": "inline@0"
},
{
"command": "gradle.closeTaskTerminals",
"when": "view == recentTasksView && viewItem =~ /^debugTask(WithArgs)?WithTerminals.*$|^task(WithArgs)?WithTerminals.*$|^runningTask(WithArgs)?WithTerminals.*$|^runningDebugTask(WithArgs)?WithTerminals.*$/",
"when": "view == recentTasksView && viewItem =~ /^(pinned)?debugTask(WithArgs)?WithTerminals.*$|^(pinned)?task(WithArgs)?WithTerminals.*$|^(pinned)?runningTask(WithArgs)?WithTerminals.*$|^(pinned)?runningDebugTask(WithArgs)?WithTerminals.*$/",
"group": "inline@1"
},
{
"command": "gradle.debugTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^debugTask.*$/ || viewItem =~ /^runningDebugTask.*$/ && allowParallelRun == true",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?debugTask.*$/ || viewItem =~ /^(pinned)?runningDebugTask.*$/ && allowParallelRun == true",
"group": "inline@2"
},
{
"command": "gradle.runTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^debugTask.*$|^task.*$/ || viewItem =~ /^runningTask.*$|^runningDebugTask.*$/ && allowParallelRun == true",
"when": "view =~ /^gradleTasksView$|^recentTasksView$|^gradleDefaultProjectsView$/ && viewItem =~ /^(pinned)?debugTask.*$|^(pinned)?task.*$/ || viewItem =~ /^(pinned)?runningTask.*$|^(pinned)?runningDebugTask.*$/ && allowParallelRun == true",
"group": "inline@3"
},
{
"command": "gradle.restartTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^runningTask.*$|^runningDebugTask.*$/ && !allowParallelRun",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?runningTask.*$|^(pinned)?runningDebugTask.*$/ && !allowParallelRun",
"group": "inline@4"
},
{
"command": "gradle.cancelTreeItemTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^runningTask.*$|^runningDebugTask.*$/ && !allowParallelRun",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?runningTask.*$|^(pinned)?runningDebugTask.*$/ && !allowParallelRun",
"group": "inline@5"
},
{
"command": "gradle.cancellingTreeItemTask",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^cancellingTask.*$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^cancellingTask.*$/",
"group": "inline@6"
},
{
Expand All @@ -616,12 +600,12 @@
},
{
"command": "gradle.pinTaskWithArgs",
"when": "view =~ /^gradleTasksView$|^recentTasksView|^pinnedTasksView$/ && viewItem =~ /^debugTask(WithTerminals)?$|^task(WithTerminals)?$/",
"when": "view =~ /^gradleTasksView$|^recentTasksView$/ && viewItem =~ /^(pinned)?debugTask(WithTerminals)?$|^(pinned)?task(WithTerminals)?$/",
"group": "contextGroup3@1"
},
{
"command": "gradle.removePinnedTask",
"when": "view == pinnedTasksView && viewItem =~ /^debugTask.*$|^task.*$/",
"command": "gradle.unpinTask",
"when": "view == gradleTasksView && viewItem =~ /^pinned.*$/",
"group": "contextGroup3@2"
},
{
Expand All @@ -646,7 +630,7 @@
},
{
"command": "gradle.openBuildFile",
"when": "view =~ /^gradleTasksView$|^pinnedTasksView$|^recentTasksView$/ && viewItem =~ /^debugTask.*$|^task.*$/",
"when": "view =~ /^gradleTasksView$$|^recentTasksView$/ && viewItem =~ /^(pinned)?debugTask.*$|^(pinned)?task.*$/",
"group": "contextGroup5@0"
}
],
Expand Down
Loading

0 comments on commit d9322d3

Please sign in to comment.