GhidraJupyter / ghidra-jupyter-kotlin

MIT License
115 stars 10 forks source link

Building for Ghidra 10.3 fails with unknown property `GRADLE_MIN` #37

Closed fmagin closed 1 year ago

fmagin commented 1 year ago

Trying to build the extension for Ghidra 10.3 fails with:

* Where:
Script '/home/fmagin/ghidras/ghidra_10.3_PUBLIC/support/buildExtension.gradle' line: 340

* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'GRADLE_MIN' for root project 'ghidra-jupyter-kotlin' of type org.gradle.api.Project.

I'm not sure yet what is going on, other plugins don't seem to have this problem

tmr232 commented 1 year ago

Grrr...

I have no idea what's causing this, and I kinda don't wanna mess with this. But if you don't have the time, I might give it a go...

fmagin commented 1 year ago

Roughly: the new buildExtension.gradle has a function checkGradleVersion() that is called early on.

https://github.com/NationalSecurityAgency/ghidra/blob/2daddb7d7c2ffda98a4efa8ea49ba5c6c0a98fc6/Ghidra/RuntimeScripts/Common/support/buildExtension.gradle#L331-L363

The relevant part is

import org.gradle.util.GradleVersion;
def checkGradleVersion() {
    GradleVersion min = null;
    GradleVersion max = null;
    try {
        min = GradleVersion.version("${rootProject.GRADLE_MIN}") // This is line 340
    }
    catch (IllegalArgumentException e) {
        String defaultMin = "1.0"
        println "Invalid minimum Gradle version specified in application.properties...using ${defaultMin}"
        min = GradleVersion.version(defaultMin)
    }
    try {

rootProject at that time is root project 'ghidra-jupyter-kotlin' (by just throwing a println rootProject in there).

If I comment out the call to it, I get errors during compileJava:

* What went wrong:
Execution failed for task ':GhidraJupyterKotlin:compileJava'.
> invalid source release: 17

but I think those are related to something about my local setup being broken, somehow gradle uses java8.

So the problem is why this property is missing, and why it is only missing with this plugin, the other plugins I tested don't seem to have this problem

fmagin commented 1 year ago

Okay, I understood what is going on, found workarounds and opened an issue in the Ghidra repo itself. https://github.com/NationalSecurityAgency/ghidra/issues/5540