Skip to content

Commit f9a26b5

Browse files
authored
Merge pull request #43 from badsyntax/multi-project-builds
Multi project builds
2 parents eec674a + cf661f9 commit f9a26b5

File tree

24 files changed

+732
-135
lines changed

24 files changed

+732
-135
lines changed

.vscode/launch.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@
109109
],
110110
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
111111
"preLaunchTask": "npm: watch"
112+
},
113+
{
114+
"name": "Test: Multi-Project",
115+
"type": "extensionHost",
116+
"request": "launch",
117+
"runtimeExecutable": "${execPath}",
118+
"args": [
119+
"--disable-extensions",
120+
"--extensionDevelopmentPath=${workspaceFolder}",
121+
"--extensionTestsPath=${workspaceFolder}/out/test/multi-project/",
122+
"${workspaceFolder}/test-fixtures/multi-project"
123+
],
124+
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
125+
"preLaunchTask": "npm: watch"
112126
}
113127
]
114128
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 2.1.6
4+
5+
- Add support for multi-project builds (subprojects)
6+
7+
## 2.1.5
8+
9+
- Improve error handling
10+
311
## 2.1.4
412

513
- Fix refresh tasks error handling

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Run gradle tasks in VS Code.
1212

1313
- Run gradle tasks as [VS Code tasks](https://code.visualstudio.com/docs/editor/tasks)
1414
- List & run gradle tasks in the Explorer
15-
- Multi-root workspaces supported
16-
- Default Groovy/Kotlin and custom build files supported
15+
- Multi-root workspace folders supported
16+
- Default Groovy/Kotlin & custom build files supported
17+
- Multi-project builds supported
1718

1819
> **Note:** Local gradle wrapper executables must exist at the root of the workspace folders (either `./gradlew` or `.\gradlew.bat`, depending on your environment).
1920
@@ -25,6 +26,7 @@ This extension contributes the following settings:
2526
- `gradle.tasksArgs`: Custom gradle tasks arguments
2627
- `gradle.enableTasksExplorer`: Enable an explorer view for gradle tasks
2728
- `gradle.customBuildFile`: Custom gradle build filename
29+
- `gradle.explorerNestedSubProjects`: Show nested subprojects in the explorer
2830

2931
## Slow Task Provider Warning
3032

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@
136136
"default": "",
137137
"scope": "resource",
138138
"description": "Filename of the gradle build file"
139+
},
140+
"gradle.explorerNestedSubProjects": {
141+
"type": "boolean",
142+
"default": true,
143+
"scope": "resource",
144+
"description": "Show nested sub-projects in the explorer"
139145
}
140146
}
141147
},
@@ -159,6 +165,10 @@
159165
"buildFile": {
160166
"type": "string",
161167
"description": "The build file that provides the task"
168+
},
169+
"subProjectBuildFile": {
170+
"type": "string",
171+
"description": "The subproject build file that provides the task"
162172
}
163173
}
164174
}

src/config.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { workspace, WorkspaceFolder } from 'vscode';
1+
import { workspace, WorkspaceFolder, Uri } from 'vscode';
22

33
type AutoDetect = 'on' | 'off';
44

5-
export function getCustomBuildFile(folder: WorkspaceFolder): string {
5+
export function getCustomBuildFile(uri: Uri): string {
66
return workspace
7-
.getConfiguration('gradle', folder.uri)
7+
.getConfiguration('gradle', uri)
88
.get<string>('customBuildFile', '');
99
}
1010

@@ -27,3 +27,9 @@ export function getIsTasksExplorerEnabled(): boolean {
2727
.getConfiguration('gradle')
2828
.get<boolean>('enableTasksExplorer', true);
2929
}
30+
31+
export function getHasExplorerNestedSubProjects(): boolean {
32+
return workspace
33+
.getConfiguration('gradle')
34+
.get<boolean>('explorerNestedSubProjects', true);
35+
}

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function registerTaskProvider(
3535
const defaultKotlinBuildFile = 'build.gradle.kts';
3636
const buildFiles = new Set<string>();
3737
for (const folder of workspace.workspaceFolders) {
38-
const customBuildFile = getCustomBuildFile(folder);
38+
const customBuildFile = getCustomBuildFile(folder.uri);
3939
if (customBuildFile) {
4040
buildFiles.add(customBuildFile);
4141
} else {

0 commit comments

Comments
 (0)