graalvm / native-build-tools

Native-image plugins for various build tools
https://graalvm.github.io/native-build-tools/
Other
366 stars 59 forks source link

Configuring tasksToInstrumentPredicate does not work as documented #303

Open wilkinsona opened 2 years ago

wilkinsona commented 2 years ago

Describe the bug The documentation shows the following example for configuring the predicate:

tasksToInstrumentPredicate = t -> true

Adapting this to disable instrumentation by returning false does not work.

To Reproduce Steps to reproduce the behavior:

plugins {
    id 'java'
    id 'org.graalvm.buildtools.native' version '0.9.13'
}

repositories {
    mavenCentral()
}

graalvmNative {
    agent {
        tasksToInstrumentPredicate = t -> false
    }
}
$ gradle test
[native-image-plugin] Instrumenting task with the native-image-agent: test

Expected behavior Returning false for all tasks disables instrumentation for all tasks.

System Info (please complete the following information):

Additional context It works, i.e. the log message about task instrumentation disappears, when specifically using a Predicate:

graalvmNative {
    agent {
        java.util.function.Predicate<Test> predicate = { t -> false }
        tasksToInstrumentPredicate = predicate
    }
}
wilkinsona commented 2 years ago

This may be a duplicate of https://github.com/graalvm/native-build-tools/issues/301. Sorry if it is. However, I don't think that would explain (to me anyway) why the behavior is different depending on how the predicate is declared.