Slackbot
12/01/2023, 3:38 PMJohn
12/01/2023, 3:38 PMVampire
12/01/2023, 3:39 PMinterface whenever you can, which you can here.
On why the things are null is hard to say without seeing some code. 😉John
12/01/2023, 3:39 PMJohn
12/01/2023, 3:43 PMabstract 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:
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 NPEJohn
12/01/2023, 3:46 PMThomas Broyer
12/01/2023, 4:02 PMJohn
12/01/2023, 4:26 PMJohn
12/01/2023, 4:27 PMJohn
12/01/2023, 4:31 PMVampire
12/01/2023, 4:48 PMBuildServiceParameters 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. 😕John
12/01/2023, 5:08 PMJohn
12/01/2023, 5:19 PMJohn
12/01/2023, 5:19 PM