Skip to content
Merged
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
22 changes: 19 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@
"title": "%contributes.commands.java.project.build.workspace%",
"icon": "$(tools)"
},
{
"command": "java.project.rebuild.workspace",
"title": "%contributes.commands.java.project.rebuild.workspace%",
"icon": "$(refresh)"
},
{
"command": "java.project.build.project",
"title": "%contributes.commands.java.project.build.project%",
"category": "Java"
},
{
"command": "java.project.clean.workspace",
"title": "%contributes.commands.java.project.clean.workspace%"
Expand All @@ -178,7 +188,8 @@
},
{
"command": "java.project.rebuild",
"title": "%contributes.commands.java.project.rebuild%"
"title": "%contributes.commands.java.project.rebuild%",
"category": "Java"
},
{
"command": "java.view.package.revealInProjectExplorer",
Expand Down Expand Up @@ -732,6 +743,11 @@
"when": "view == javaProjectExplorer && java:serverMode == Standard && config.java.project.explorer.showNonJavaResources",
"group": "overflow_10@30"
},
{
"command": "java.project.rebuild.workspace",
"when": "view == javaProjectExplorer && java:serverMode == Standard && !java:noJavaProjects && !java:importFailed",
"group": "overflow_20@5"
},
{
"command": "java.project.clean.workspace",
"when": "view == javaProjectExplorer && java:serverMode == Standard && !java:noJavaProjects",
Expand Down Expand Up @@ -790,7 +806,7 @@
"group": "7_modification@20"
},
{
"command": "java.project.build.workspace",
"command": "java.project.build.project",
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+java\\b)(?=.*?\\b\\+uri\\b)/",
"group": "8_execution@5"
},
Expand Down Expand Up @@ -1075,7 +1091,7 @@
},
"isFullBuild": {
"type": "boolean",
"default": "true",
"default": false,
"description": "%taskDefinitions.java.project.build.isFullBuild%"
}
}
Expand Down
4 changes: 3 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"contributes.commands.java.project.addLibraryFolders": "Add Library Folders to Project Classpath...",
"contributes.commands.java.project.removeLibrary": "Remove from Project Classpath",
"contributes.commands.java.view.package.refresh": "Refresh",
"contributes.commands.java.project.build.workspace": "Rebuild All",
"contributes.commands.java.project.build.workspace": "Build All",
"contributes.commands.java.project.rebuild.workspace": "Rebuild All",
"contributes.commands.java.project.build.project": "Build Project",
"contributes.commands.java.project.clean.workspace": "Clean Workspace",
"contributes.commands.java.project.rebuild": "Rebuild Project",
"contributes.commands.java.project.update": "Reload Project",
Expand Down
6 changes: 4 additions & 2 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"contributes.commands.java.project.addLibraryFolders": "添加文件夹至项目 Classpath...",
"contributes.commands.java.project.removeLibrary": "从项目 Classpath 中移除",
"contributes.commands.java.view.package.refresh": "刷新",
"contributes.commands.java.project.build.workspace": "重新构建所有项目",
"contributes.commands.java.project.build.workspace": "构建所有项目",
"contributes.commands.java.project.rebuild.workspace": "重新构建所有项目",
"contributes.commands.java.project.build.project": "构建项目",
"contributes.commands.java.project.clean.workspace": "清理工作空间",
"contributes.commands.java.project.rebuild": "重新构建项目",
"contributes.commands.java.project.update": "重新加载项目",
Expand Down Expand Up @@ -56,7 +58,7 @@
"taskDefinitions.java.project.build.path": "被构建项目的根目录路径。绝对路径或者相对于工作空间目录的相对路径都可以使用。",
"taskDefinitions.java.project.build.path.workspace": "工作空间中的所有项目。",
"taskDefinitions.java.project.build.path.exclude": "'!' 后的路径将会从待构建项目路径中移除。",
"taskDefinitions.java.project.build.isFullBuild": "是否要重新构建项目。",
"taskDefinitions.java.project.build.isFullBuild": "是否要执行清理构建。",
"viewsWelcome.workbench.createNewJavaProject": "您也可以[打开一个 Java 项目目录](command:_java.project.open),或点击下方按钮创建一个新的 Java 项目。\n[创建 Java 项目](command:_java.project.create.from.fileexplorer.welcome)",
"viewsWelcome.workbench.noJavaProject": "当前工作空间未发现 Java 项目,您可以[打开一个 Java 项目目录](command:_java.project.open),或点击下方按钮创建一个新的 Java 项目。\n[创建 Java 项目](command:_java.project.create.from.javaprojectexplorer.welcome)",
"viewsWelcome.workbench.importFailed": "加载 Java 项目时出现错误,请通过以下方式查看错误相关信息:\n[打开问题视图](command:workbench.panel.markers.view.focus)",
Expand Down
8 changes: 5 additions & 3 deletions package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"contributes.commands.java.project.addLibraryFolders": "新增資料夾至專案 Classpath...",
"contributes.commands.java.project.removeLibrary": "從專案 Classpath 中移除",
"contributes.commands.java.view.package.refresh": "重新整理",
"contributes.commands.java.project.build.workspace": "重新建置所有專案",
"contributes.commands.java.project.build.workspace": "建置所有專案",
"contributes.commands.java.project.rebuild.workspace": "重新建置所有專案",
"contributes.commands.java.project.build.project": "建置專案",
"contributes.commands.java.project.clean.workspace": "清理工作區",
"contributes.commands.java.project.rebuild": "重新建置專案",
"contributes.commands.java.project.update": "重新載入專案",
Expand Down Expand Up @@ -48,10 +50,10 @@
"taskDefinitions.java.project.build.path": "被建置專案的根目錄路徑。絕對路徑或者相對於工作區目錄的相對路徑都可以使用。",
"taskDefinitions.java.project.build.path.workspace": "工作區中的所有專案。",
"taskDefinitions.java.project.build.path.exclude": "'!' 後的路徑將會從待建置專案路徑中移除。",
"taskDefinitions.java.project.build.isFullBuild": "是否要重新建置專案。",
"taskDefinitions.java.project.build.isFullBuild": "是否要執行清理建置。",
"viewsWelcome.workbench.createNewJavaProject": "您也可以[開啟一個 Java 專案目錄](command:_java.project.open),或點擊下方按鈕建立一個新的 Java 專案。\n[建立 Java 專案](command:_java.project.create.from.fileexplorer.welcome)",
"viewsWelcome.workbench.noJavaProject": "當前工作區未發現 Java 專案,您可以[開啟一個 Java 專案目錄](command:_java.project.open),或點擊下方按鈕建立一個新的 Java 專案。\n[建立 Java 專案](command:_java.project.create.from.javaprojectexplorer.welcome)",
"viewsWelcome.workbench.importFailed": "加載 Java 專案時出現錯誤,請通過以下方式查看錯誤相關信息:\n[打開問題視圖](command:workbench.panel.markers.view.focus)",
"viewsWelcome.workbench.inLightWeightMode": "若要檢視各專案,你可以將專案匯入到工作區中。\n[匯入專案](command:java.server.mode.switch?%5B%22Standard%22,true%5D)",
"viewsWelcome.workbench.installLanguageSupport": "Java 專案視圖需要安裝並啟用 [Extension Pack for Java](command:extension.open?%5B%22vscjava.vscode-java-pack%22%5D) 以提供完整的功能。\n[安裝](command:java.project.installExtension?%5B%22vscjava.vscode-java-pack%22%5D)"
}
}
4 changes: 4 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export namespace Commands {

export const JAVA_PROJECT_BUILD_WORKSPACE = "java.project.build.workspace";

export const JAVA_PROJECT_REBUILD_WORKSPACE = "java.project.rebuild.workspace";

export const JAVA_PROJECT_BUILD_PROJECT = "java.project.build.project";

export const JAVA_PROJECT_CLEAN_WORKSPACE = "java.project.clean.workspace";

export const JAVA_PROJECT_UPDATE = "java.project.update";
Expand Down
5 changes: 4 additions & 1 deletion src/tasks/build/buildTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class BuildTaskProvider implements TaskProvider {
const defaultTaskDefinition = {
type: BuildTaskProvider.type,
paths: [ BuildTaskProvider.workspace ],
isFullBuild: true,
isFullBuild: false,
};
const defaultTask = new Task(
defaultTaskDefinition,
Expand Down Expand Up @@ -58,6 +58,9 @@ export class BuildTaskProvider implements TaskProvider {
.filter(Boolean);
task.definition = taskDefinition;
}
if (taskDefinition.isFullBuild === undefined) {
taskDefinition.isFullBuild = false;
}
Comment thread
wenytang-ms marked this conversation as resolved.
task.execution = new CustomExecution(async (resolvedDefinition: IBuildTaskDefinition): Promise<Pseudoterminal> => {
return new BuildTaskTerminal(resolvedDefinition, task.scope ?? TaskScope.Workspace);
});
Expand Down
16 changes: 13 additions & 3 deletions src/views/dependencyDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_OUTLINE, (uri, range) =>
window.showTextDocument(Uri.parse(uri), { selection: range })));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_BUILD_WORKSPACE, () =>
commands.executeCommand(Commands.JAVA_BUILD_WORKSPACE, false /*fullCompile*/)));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_REBUILD_WORKSPACE, () =>
commands.executeCommand(Commands.JAVA_BUILD_WORKSPACE, true /*fullCompile*/)));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_CLEAN_WORKSPACE, () =>
commands.executeCommand(Commands.JAVA_CLEAN_WORKSPACE)));
Expand All @@ -75,13 +77,21 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
commands.executeCommand(Commands.JAVA_PROJECT_CONFIGURATION_UPDATE, uris[0]);
}
}));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_REBUILD, async (node: INodeData) => {
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_BUILD_PROJECT, async (node: INodeData) => {
if (!node.uri) {
sendError(new Error("Uri not available when building project"));
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Rebuild Projects' from Command Palette.");
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Build Project' from Command Palette.");
Comment thread
wenytang-ms marked this conversation as resolved.
return;
}
return commands.executeCommand(Commands.BUILD_PROJECT, Uri.parse(node.uri), false /*isFullBuild*/);
}));
Comment thread
wenytang-ms marked this conversation as resolved.
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_REBUILD, async (node: INodeData) => {
if (!node.uri) {
sendError(new Error("Uri not available when rebuilding project"));
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Rebuild Project' from Command Palette.");
Comment thread
wenytang-ms marked this conversation as resolved.
return;
}
commands.executeCommand(Commands.BUILD_PROJECT, Uri.parse(node.uri), true);
return commands.executeCommand(Commands.BUILD_PROJECT, Uri.parse(node.uri), true /*isFullBuild*/);
}));

this.setRefreshDebounceFunc();
Expand Down
13 changes: 13 additions & 0 deletions test/suite/buildTask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ suite("Build Task Tests", () => {
&& t.source === BuildTaskProvider.type;
});
assert.ok(exportJarTask !== undefined);
assert.strictEqual(exportJarTask.definition.isFullBuild, false);
});

test("test resolving build task defaults to incremental build", async function() {
const task: Task = new Task({
type: BuildTaskProvider.type,
paths: [ BuildTaskProvider.workspace ],
}, TaskScope.Workspace, BuildTaskProvider.defaultTaskName, BuildTaskProvider.type);

const resolvedTask: Task | undefined = await new BuildTaskProvider().resolveTask(task);

assert.ok(resolvedTask !== undefined);
assert.strictEqual(resolvedTask.definition.isFullBuild, false);
});

test("test categorizePaths()", async function() {
Expand Down
Loading