дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
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 <[email protected]>
32 рядки
1.6 KiB
Groovy
32 рядки
1.6 KiB
Groovy
// OpenIDEA: runs a main class on its Gradle source set's runtime classpath, like IntelliJ
|
|
// IDEA's "Build and run using: Gradle" (ApplicationTaskInitScript.gradle). Parameters come
|
|
// as system properties so this file never changes: see `gradleRun.ts`.
|
|
import groovy.json.JsonSlurper
|
|
|
|
def target = System.getProperty('openidea.run.project')
|
|
if (target != null) {
|
|
allprojects { p ->
|
|
// `target` is an identity path (`:lib:core` for a project of an included build).
|
|
def id = { try { p.identityPath.toString() } catch (ignored) { p.path } }
|
|
if (id() != target) return
|
|
p.plugins.withId('java') {
|
|
def json = new JsonSlurper()
|
|
def list = { String key -> (List) json.parseText(System.getProperty(key, '[]')) }
|
|
p.tasks.register('openideaRun', JavaExec) { t ->
|
|
t.description = 'Runs a main class for OpenIDEA.'
|
|
t.classpath = p.sourceSets.getByName(System.getProperty('openidea.run.sourceSet', 'main')).runtimeClasspath
|
|
t.mainClass.set(System.getProperty('openidea.run.main'))
|
|
t.args(list('openidea.run.args'))
|
|
t.jvmArgs(list('openidea.run.jvmArgs'))
|
|
// The IDE attaches to this JVM, not to the Gradle daemon; port 0 prints the one picked.
|
|
if (Boolean.getBoolean('openidea.run.debug')) {
|
|
t.jvmArgs('-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:0')
|
|
}
|
|
def dir = System.getProperty('openidea.run.workingDir')
|
|
if (dir) t.workingDir = dir
|
|
t.standardInput = System.in
|
|
}
|
|
}
|
|
}
|
|
}
|