дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
fix(maven): reuse an existing build configuration for Maven goal runs (#4503)
Running a lifecycle goal such as package from the Maven tool window always created a temporary '<project> [package]' configuration, even when a saved or detected configuration already ran the same goal. adoptTemporary only matched by id or main class. Maven and Gradle runs now also match a kept configuration with the same build tool, command, directory and exact arguments, which is then selected and run instead; a different flag set (for example -DskipTests) still gets its own temporary configuration. Co-authored-by: Inf1mum <[email protected]>
Цей коміт міститься в:
1 джерело
e93ac42489
коміт
22a5e4c9e6
2 files changed
+60
-1
No files matched your search
@@ -668,6 +668,52 @@ describe("temporary configurations", () => {
|
||||
await saveTemporary(app.id).catch(() => undefined);
|
||||
expect(useRun.getState().temporary).toEqual([]);
|
||||
});
|
||||
|
||||
it("reuse the detected configuration of the same Maven goal instead of adding a temporary one", () => {
|
||||
const detected = cfg({ id: "maven:package", kind: "maven", name: "mvn package", args: ["package"] });
|
||||
useRun.setState({ configs: [detected] });
|
||||
const goal = cfg({
|
||||
id: "maven:goal:pom.xml:package",
|
||||
kind: "maven",
|
||||
name: "demo [package]",
|
||||
args: ["package"],
|
||||
detected: false,
|
||||
});
|
||||
expect(adoptTemporary(goal)).toBe(detected);
|
||||
expect(useRun.getState().temporary).toEqual([]);
|
||||
expect(useRun.getState().selectedId).toBe(detected.id);
|
||||
});
|
||||
|
||||
it("reuse a Maven goal configuration with the same command line, but not across goals, flags, builds or tools", () => {
|
||||
const detected = cfg({ id: "maven:package", kind: "maven", name: "mvn package", args: ["package"] });
|
||||
useRun.setState({ configs: [detected] });
|
||||
const goal = (over: Partial<RunConfig>): RunConfig =>
|
||||
cfg({ id: "maven:goal:pom.xml:package", kind: "maven", args: ["package"], detected: false, ...over });
|
||||
expect(adoptTemporary(goal({}))).toBe(detected);
|
||||
expect(
|
||||
adoptTemporary(goal({ id: "maven:goal:pom.xml:package.skipTests", args: ["package", "-DskipTests"] })).id,
|
||||
).toBe("maven:goal:pom.xml:package.skipTests");
|
||||
expect(adoptTemporary(goal({ id: "maven:goal:pom.xml:clean", args: ["clean"] })).id).toBe(
|
||||
"maven:goal:pom.xml:clean",
|
||||
);
|
||||
expect(adoptTemporary(goal({ id: "maven:goal:core/pom.xml:package", args: ["package"], cwd: "core" })).id).toBe(
|
||||
"maven:goal:core/pom.xml:package",
|
||||
);
|
||||
expect(adoptTemporary(goal({ id: "gradle:task:...:package", kind: "gradle", command: "gradle" })).id).toBe(
|
||||
"gradle:task:...:package",
|
||||
);
|
||||
const { configs, temporary } = useRun.getState();
|
||||
expect(temporary).toHaveLength(4);
|
||||
expect(configs.filter((c) => !temporary.includes(c.id))).toEqual([detected]);
|
||||
});
|
||||
|
||||
it("reuse the detected configuration of the same Gradle tasks", () => {
|
||||
const detected = cfg({ id: "gradle:test", kind: "gradle", name: "gradle test", args: ["test"], isTest: true });
|
||||
useRun.setState({ configs: [detected] });
|
||||
const task = cfg({ id: "gradle:task:...:test", kind: "gradle", args: ["test"], detected: false });
|
||||
expect(adoptTemporary(task)).toBe(detected);
|
||||
expect(useRun.getState().temporary).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("jvmMainCandidates", () => {
|
||||
|
||||
Reference in new issue
Заблокувати користувача