This message was deleted.
# plugin-development
s
This message was deleted.
r
This is my BuildService
Copy code
abstract class MyService : BuildService<MyService.MyParams>,
    OperationCompletionListener,
    AutoCloseable {

    interface MyParams : BuildServiceParameters {
        val project: Property<Project>
    }

   override fun close() {
     // Do something with `parameters.project.get()`
    }
}
And this is how I register it
Copy code
val myServiceProvider = gradle.sharedServices.registerIfAbsent(clazz.simpleName, clazz) {
  with(it.parameters) {
    project.set(gradle.rootProject)
  }
}
v
No, you cannot give a project to the build service. You need to give the actual details you need from the project as separate properties.
r
Got it. I tried to find this info on the docs but doesn’t seem to be there, feels like it’s common sense if the person understands gradle
👌 1
a
I agree, it's often hard to find info in the docs! It's probably a Configuration Cache problem rather than a something related to a Build Service https://docs.gradle.org/8.4/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
👌 1
thank you 1