дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
feat(run): detect SwiftPM executable products as run configurations (#6792)
A Swift package now gets one run configuration per executable product, read from the manifest source without running it: declared .executable products plus executable targets no product builds (and legacy targets with main.swift). Each runs swift run --skip-build <product> after a swift build --product <product> before-launch task, and Debug launches .build/debug/<product> under lldb-dap with the configured arguments. Closes #6786 Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
1 джерело
f2641b9697
коміт
77e669c189
6 files changed
+143
-3
No files matched your search
@@ -557,6 +557,22 @@ describe("run config → launch config", () => {
|
||||
expect(gdb.extraJson).toBeNull();
|
||||
});
|
||||
|
||||
it("swift run under lldb-dap debugs the built product with the arguments after it", () => {
|
||||
const run = rc({
|
||||
kind: "swiftpm",
|
||||
command: "swift",
|
||||
args: ["run", "--skip-build", "greet", "--loud"],
|
||||
cwd: "pkg",
|
||||
debugAdapter: "lldb-dap",
|
||||
params: { product: "greet", program: ".build/debug/greet" },
|
||||
});
|
||||
expect(launchConfigFor(run, "/p")).toMatchObject({
|
||||
program: "/p/pkg/.build/debug/greet",
|
||||
args: ["--loud"],
|
||||
cwd: "/p/pkg",
|
||||
});
|
||||
});
|
||||
|
||||
it.each(["native", "cmake-application"])(
|
||||
"maps %s CMake debug-info paths to the editor's canonical source root",
|
||||
(kind) => {
|
||||
|
||||
@@ -398,6 +398,11 @@ function godotLaunch(rc: RunConfig, cwd: string): LaunchConfig {
|
||||
/** A native program under CodeLLDB, lldb-dap or GDB: program, args, cwd, env. */
|
||||
function nativeLaunch(rc: RunConfig, cwd: string, adapter: string): LaunchConfig {
|
||||
const out: LaunchConfig = { ...base(rc, adapter, cwd), program: resolveCommand(rc.command, cwd), args: [...rc.args] };
|
||||
// `swift run <product> <args…>`: debug the product its before launch build left behind.
|
||||
if (rc.kind === "swiftpm" && rc.params?.program && rc.params.product) {
|
||||
out.program = join(cwd, rc.params.program);
|
||||
out.args = rc.args.slice(rc.args.indexOf(rc.params.product) + 1);
|
||||
}
|
||||
// lldb-dap takes the environment as `KEY=VALUE` strings.
|
||||
if (adapter === "lldb-dap") {
|
||||
const from = rc.params?.cmakeSourceRoot;
|
||||
|
||||
Reference in new issue
Заблокувати користувача