Skip to content

Agent instrumentation prevents the use of Gradle's configuration cache #302

@wilkinsona

Description

@wilkinsona

Describe the bug
When the agent instruments a task, it breaks Gradle's configuration cache.

To Reproduce
Steps to reproduce the behavior:

plugins {	id 'java'	id 'org.graalvm.buildtools.native' version '0.9.13' } repositories {	mavenCentral() } graalvmNative { toolchainDetection = false }
$ gradle test --configuration-cache Configuration cache is an incubating feature. Calculating task graph as no configuration cache is available for tasks: test [native-image-plugin] Instrumenting task with the native-image-agent: test FAILURE: Build failed with an exception. * What went wrong: Configuration cache problems found in this build. 7 problems were found storing the configuration cache, 4 of which seem unique. - Task `:test` of type `org.gradle.api.tasks.testing.Test`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache. See https://docs.gradle.org/7.5.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types - Task `:test` of type `org.gradle.api.tasks.testing.Test`: cannot serialize object of type 'org.gradle.api.internal.tasks.DefaultSourceSetContainer', a subtype of 'org.gradle.api.tasks.SourceSetContainer', as these are not supported with the configuration cache. See https://docs.gradle.org/7.5.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types - Task `:test` of type `org.gradle.api.tasks.testing.Test`: cannot serialize object of type 'org.gradle.api.internal.tasks.DefaultTaskContainer', a subtype of 'org.gradle.api.tasks.TaskContainer', as these are not supported with the configuration cache. See https://docs.gradle.org/7.5.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types - Task `:test` of type `org.gradle.api.tasks.testing.Test`: value 'map(map(org.gradle.api.file.Directory property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/awilkinson/dev/temp/native-image-instrumentation-problem/build)) org.gradle.api.internal.file.DefaultFilePropertyFactory$PathToDirectoryTransformer@76ce53fc))' failed to unpack provider

Expected behavior
Agent instrumentation does not prevent the use of Gradle features.

Logs
configuration-cache-report.zip

System Info (please complete the following information):

  • OS: N/A
  • GraalVM Version: N/A
  • Java Version: N/A
  • Plugin version: 0.9.13
  • Gradle version: 7.5.1

Additional context
Disabling the agent does not help:

graalvmNative {	agent {	enabled = false	}	toolchainDetection = false }

7 problems are still reported. However, configuring the predicate to avoid any instrumentation does help:

graalvmNative {	agent { java.util.function.Predicate<Test> predicate = { t -> false }	tasksToInstrumentPredicate = predicate	}	toolchainDetection = false }

With this configuration in place, 0 problems are reported.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions