mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
feat(gradle): import modules from Gradle itself (includeFlat, included builds, computed includes) (#715)
The Gradle model came from a static parse of settings.gradle, which cannot follow includeFlat, projectDir assignments, computed include lists or included builds, so those modules were missing from the Gradle tool window, the Project view, indexing and run. Sync now runs an init script that prints every evaluated project (identity path, directory, build directory, source sets with test classification, Java version) without resolving dependencies; the static parser stays as the fallback before the first sync. Modules outside the root become content roots, the Project view lists the build's module group above the project folder, an unsynced Gradle build is imported once when opened, and staleness ignores comments and whitespace in build scripts. Application / Spring Boot configurations of a Gradle module run through a JavaExec task on the source set's runtime classpath by default (Settings › Build Tools › Gradle › Build and run using), with the debugger attached to the forked JVM. The build model reaches run and the Project view through a platform store rather than a cross-feature import. Fixes #737 Fixes #861 Co-authored-by: ntbang0901 <121003585+ntbang0901@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { executeAction } from "@/platform/actions";
|
||||
import type { RunConfig } from "@/platform/ipc";
|
||||
import { isJvmApplication, JDWP_AGENT, jdwpListeningPort } from "@/platform/javaLaunch";
|
||||
import { startRun, useRun } from "./store";
|
||||
import { DELEGATED_DEBUG, DELEGATED_MAIN } from "./gradleRun";
|
||||
|
||||
const isMavenTestGoal = (a: string) =>
|
||||
/^(test|verify|integration-test|surefire:test|failsafe:integration-test)$/.test(a);
|
||||
@@ -55,6 +56,9 @@ export function jdwpLaunch(config: RunConfig): RunConfig | null {
|
||||
return null;
|
||||
}
|
||||
if (config.kind === "gradle" || /(^|\/)gradlew?(\.bat)?$/.test(config.command)) {
|
||||
// A delegated Application: its init script adds the agent (port 0) to the JavaExec JVM.
|
||||
if (args.some((a) => a.startsWith(DELEGATED_MAIN)))
|
||||
return args.includes(DELEGATED_DEBUG) ? config : { ...config, args: [...args, DELEGATED_DEBUG] };
|
||||
if (!args.some(isGradleJvmTask)) return null;
|
||||
return args.includes("--debug-jvm") ? config : { ...config, args: [...args, "--debug-jvm"] };
|
||||
}
|
||||
@@ -74,7 +78,8 @@ export async function debugWithAgent(config: RunConfig): Promise<boolean> {
|
||||
const runId = useRun.getState().sessions.find((s) => s.id === sessionId)?.runId ?? null;
|
||||
void executeAction("debug.attach", {
|
||||
name: config.name,
|
||||
module: config.cwd ?? "",
|
||||
// The application's module (a delegated run's working directory is the Gradle build).
|
||||
module: config.module ?? config.cwd ?? "",
|
||||
hostName: "127.0.0.1",
|
||||
port,
|
||||
process: runId,
|
||||
|
||||
Reference in New Issue
Block a user