Gradle Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 9: Line 9:
==Debug a Gradle Build==
==Debug a Gradle Build==
{{External|https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic}}
{{External|https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic}}
<font color=darkgray>TODO: [[IntelliJ_Gradle_Support#Configuring_Gradle_Sources|IntelliJ Gradle Support &#124; Configuring Gradle Sources]]</font>
===External Gradle Process===
===External Gradle Process===
====Gradle Process Instrumentation====
====Gradle Process Instrumentation====
 
Use [[Gradle_System_Properties#org.gradle.debug|-Dorg.gradle.debug=true]]. Experimented with Gradle 6.8.3.
Experimented with Gradle 6.8.3.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
./gradlew -Dorg.gradle.debug=true --no-daemon <task-to-debug>
./gradlew -Dorg.gradle.debug=true --no-daemon <task-to-debug>
</syntaxhighlight>
</syntaxhighlight>
Even if --no-daemon was specified, Gradle will issue a message similar to:
Even if [[Gradle_Command_Line#--no-daemon|--no-daemon]] was specified, Gradle will issue a message similar to:
<syntaxhighlight lang='text'>
<syntaxhighlight lang='text'>
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.8.3/userguide/gradle_daemon.html#sec:disabling_the_daemon.
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.8.3/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Line 23: Line 21:
</syntaxhighlight>
</syntaxhighlight>
and will stop there waiting for the debugger to attach. The JVM will listen on 5005.
and will stop there waiting for the debugger to attach. The JVM will listen on 5005.
If you need to use a Gradle daemon, the daemon JVM can also be instrumented to start in debug mode:
{{Internal|Gradle_System_Properties#Attaching_a_Debugger_to_a_Gradle_Daemon|Gradle System Properties &#124; org.gradle.jvmargs &#124; Attaching a Debugger to a Gradle Daemon}}


====IDE Configuration====
====IDE Configuration====
{{External|https://medium.com/dan-on-coding/debugging-gradle-source-code-in-intellij-e1224bec9b6e}}
{{External|https://medium.com/dan-on-coding/debugging-gradle-source-code-in-intellij-e1224bec9b6e}}
<font color=darkgray>
<font color=darkgray>
TODO: [[IntelliJ_Gradle_Support#Configuring_Gradle_Sources|IntelliJ Gradle Support &#124; Configuring Gradle Sources]]</font>
* Get sources from GitHub. "Subproject" sources are available in subprojects/bootstrap/src/main/java, subprojects/launcher/src/main/java, etc.
* Get sources from GitHub. "Subproject" sources are available in subprojects/bootstrap/src/main/java, subprojects/launcher/src/main/java, etc.
* Script that collects sources and builds a consolidated source JAR file is available here:  
* Script that collects sources and builds a consolidated source JAR file is available here:  
Line 34: Line 35:
* Attach them to External Libraries → gradle-api-6.2.2.jar → Right click → Open Library Settings → Right click → Edit → +  
* Attach them to External Libraries → gradle-api-6.2.2.jar → Right click → Open Library Settings → Right click → Edit → +  
</font>
</font>
====No Gradle Daemon is Used====
====Gradle Daemon is Used====
{{Internal|Gradle_System_Properties#Attaching_a_Debugger_to_a_Gradle_Daemon|Gradle System Properties &#124; org.gradle.jvmargs &#124; Attaching a Debugger to a Gradle Daemon}}


===Gradle runs in IntelliJ===
===Gradle runs in IntelliJ===
Edit configurations → + → Gradle
Edit configurations → + → Gradle
==Debug a Test Executed with Gradle==
{{Internal|Debugging Gradle Tests|Debugging Gradle Tests}}


==Gradle Daemon Operations==
==Gradle Daemon Operations==

Latest revision as of 22:09, 1 June 2021

Internal

Installation

Gradle Installation

Command Line

Gradle Command Line

Operations

Debug a Gradle Build

https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic

External Gradle Process

Gradle Process Instrumentation

Use -Dorg.gradle.debug=true. Experimented with Gradle 6.8.3.

./gradlew -Dorg.gradle.debug=true --no-daemon <task-to-debug>

Even if --no-daemon was specified, Gradle will issue a message similar to:

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.8.3/userguide/gradle_daemon.html#sec:disabling_the_daemon.
> Starting Daemon

and will stop there waiting for the debugger to attach. The JVM will listen on 5005.

If you need to use a Gradle daemon, the daemon JVM can also be instrumented to start in debug mode:

Gradle System Properties | org.gradle.jvmargs | Attaching a Debugger to a Gradle Daemon

IDE Configuration

https://medium.com/dan-on-coding/debugging-gradle-source-code-in-intellij-e1224bec9b6e

TODO: IntelliJ Gradle Support | Configuring Gradle Sources

Gradle runs in IntelliJ

Edit configurations → + → Gradle

Debug a Test Executed with Gradle

Debugging Gradle Tests

Gradle Daemon Operations

Gradle Daemon Operations

TODEPLETE

Operations TODEPLETE