fix(build): scope Build Artifacts to the active file's module (#2491)

* fix(build): scope Build Artifacts to the active file's module

Build Artifacts always packaged the whole reactor (all 57 modules in the
reporter's project) because the frontend passed a null file. Route it
through moduleTarget like Build Module does, so Maven runs
'-pl <module> -am package' and Gradle runs '<module>:assemble'; with no
active file it still falls back to the whole project. Backend already
supported module-scoped artifacts for Maven and Gradle, no Rust change.

Refs #2476

* fix(build): translate the module-scoped Build Artifacts description

The new action description needs a zh catalog entry (the only complete
locale) and the old text must go from every catalog (the stale-entry
check covers all locales); otherwise textCatalog.test.ts fails.

Refs #2476
Цей коміт міститься в:
arookieofc authored and GitHub committed 2026-11-10 17:29:54 +08:00
1 джерело d1bef52041
коміт da3db5cbd6
8 files changed
+28 -9

No files matched your search

+24
Переглянути файл
@@ -324,6 +324,30 @@ describe("build feature", () => {
});
});
it("scopes Build Artifacts to the active file's module, or the whole project without one", async () => {
provideEditorService({
openFile,
saveAll: () => Promise.resolve(),
activePath: () => "/p/core/src/A.java",
} as unknown as EditorService);
await executeAction("build.buildArtifacts", { activate: false });
expect(fake.calls.at(-1)).toMatchObject({ kind: "artifacts", file: "/p/core/src/A.java" });
await act(async () => {
fake.resolve(result([], true));
});
provideEditorService({
openFile,
saveAll: () => Promise.resolve(),
activePath: () => null,
} as unknown as EditorService);
await executeAction("build.buildArtifacts", { activate: false });
expect(fake.calls.at(-1)).toMatchObject({ kind: "artifacts", file: null });
await act(async () => {
fake.resolve(result([], true));
});
});
it("starts a build without a workbench", async () => {
show.mockImplementation(() => {
throw new Error("No workbench");
+3 -3
Переглянути файл
@@ -102,14 +102,14 @@ export function activate(): () => void {
{
id: "build.buildArtifacts",
title: "Build Artifacts",
description: "Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)",
description: "Packages the current module's artifacts, or the whole project when no file is active",
category: "Build",
when: WHEN,
keywords: ["package", "assemble", "jar", "release"],
keywords: ["package", "assemble", "jar", "release", "module"],
run: ({ arg }) => {
const options = typeof arg === "object" && arg !== null ? arg : {};
const activate = !("activate" in options && options.activate === false);
const build = startBuild("artifacts", null, activate);
const build = startBuild("artifacts", moduleTarget(arg), activate);
if ("wait" in options && options.wait === true) return build.then(() => undefined);
},
},