дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
Run and Debug now share one Java preparation path: save documents, build with the configured policy, resolve the module classpath and JDK, and stop on a failed build. Incremental Make is the default; Rebuild, NoBuild and Build-no-error-check are persisted on the run configuration, and the form offers only what a build tool supports. Delegated Gradle goes through the same path, Debug reports save failures, Maven snapshots honour Rebuild, and scoped diagnostics are retained so incremental Maven cannot erase compilation errors. Co-authored-by: misswell <[email protected]>
45 рядки
1.4 KiB
TypeScript
45 рядки
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { RunConfig } from "@/platform/ipc";
|
|
import { applyBuildPolicyToCommand } from "./buildCommand";
|
|
|
|
const cfg = (extra: Partial<RunConfig>): RunConfig => ({
|
|
id: "m",
|
|
name: "m",
|
|
kind: "maven",
|
|
command: "mvn",
|
|
args: ["-B", "spring-boot:run"],
|
|
cwd: null,
|
|
env: {},
|
|
detected: false,
|
|
isTest: false,
|
|
debugAdapter: null,
|
|
...extra,
|
|
});
|
|
|
|
describe("build policy for build-tool commands", () => {
|
|
it("puts clean first for Maven and Gradle Rebuild", () => {
|
|
expect(applyBuildPolicyToCommand({ ...cfg({ buildPolicy: "rebuild" }), kind: "maven" }).args).toEqual([
|
|
"clean",
|
|
"-B",
|
|
"spring-boot:run",
|
|
]);
|
|
expect(
|
|
applyBuildPolicyToCommand({ ...cfg({ kind: "gradle", args: ["bootRun"] }), buildPolicy: "rebuild" }).args,
|
|
).toEqual(["clean", "bootRun"]);
|
|
});
|
|
|
|
it("lets Maven continue on compile errors only when asked", () => {
|
|
expect(applyBuildPolicyToCommand({ ...cfg({ buildPolicy: "makeAndContinueOnErrors" }) }).args).toContain(
|
|
"-Dmaven.compiler.failOnError=false",
|
|
);
|
|
expect(applyBuildPolicyToCommand({ ...cfg({ buildPolicy: "make" }) }).args).not.toContain(
|
|
"-Dmaven.compiler.failOnError=false",
|
|
);
|
|
});
|
|
|
|
it("leaves Automatic and NoBuild commands alone", () => {
|
|
for (const buildPolicy of ["automatic", "noBuild"] as const)
|
|
expect(applyBuildPolicyToCommand(cfg({ buildPolicy }))).toEqual(cfg({ buildPolicy }));
|
|
});
|
|
});
|