This message was deleted.
# community-support
s
This message was deleted.
j
all of my properties are Property<String> and Property<Boolean>
v
I would indeed use an
interface
whenever you can, which you can here. On why the things are
null
is hard to say without seeing some code. 😉
j
ok let me switch back to that method and then get some more details
👌 1
the task is defined as
Copy code
abstract class CheckIfBufImageNeededTask : DockerInspectImage() {
    companion object {
        fun create(project: Project): CheckIfBufImageNeededTask {
            return  project.tasks.create<CheckIfBufImageNeededTask>("checkIfBufImageNeeded") {
                imageId.set(bufService.flatMap { it.parameters.bufPluginImageId })

                onNext(
                    Action<InspectImageResponse> {
                        project.logger.lifecycle("Found image=$id with tags=$repoTags")
                        val service = bufService.get()
                        val params = service.parameters
                        params.bufImageExists.set(true)
                    }
                )
            }
       }
    }

    @get:Internal
    abstract val bufService: Property<BufService>
}
the task is registered like this:
Copy code
val checkIfBufImageNeededTask = CheckIfBufImageNeededTask.create(project).apply {
        bufService.set(bufSharedService)
        usesService(bufSharedService)
    }
bufService is my build service.
params.bufImageExists.set(true)
is the line that generates NPE
i am building this custom task/plugin on top of the bmuschko gradle docker plugin
t
It's not clear to me why you attempt to modify the parameters of a service that has already been created. If you want to share values through a build service, then set it on the service instance, not in its parameters.
j
ohhh
i thought the parameters object was the holder of all the data...
so i should also put properties on the build service itsself and bind those to the parameter's properties in the constructor?
v
Yes, the
BuildServiceParameters
is just the parameters given on construction, thing about them like constructor arguments. Later on to set and get values through the build service you would use properties on the build service. But actually, I would still expect the property on the parameters object not be
null
. 😕
j
ill try this change and see what happens
well it is working now
thanks everyone!
👌 1