joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

Avoid deprecation warning with Gradle plugin re Gradle 8.0 and IncrementalTaskInputs #1454

Closed TobiPeterG closed 1 year ago

TobiPeterG commented 1 year ago

Hey there,

this plugin won't be compatible to gradle 8.0, as the following error occurs when syncing my project with the plugin enabled: IncrementalTaskInputs has been deprecated. This is scheduled to be removed in Gradle 8.0. On method 'GenerateJsonSchemaAndroidTask.generate' use 'org.gradle.work.InputChanges' instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.5/userguide/upgrading_version_7.html#incremental_task_inputs_deprecation

Could this plugin be updated please to conform to these changes?

Should any additional information be required, I'd be happy to help

unkish commented 1 year ago

It looks like changing

import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
import org.jsonschema2pojo.GenerationConfig
import org.jsonschema2pojo.Jsonschema2Pojo

...

  @TaskAction
  def generate(IncrementalTaskInputs inputs) {

to

import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.TaskAction
import org.gradle.work.InputChanges
import org.jsonschema2pojo.GenerationConfig
import org.jsonschema2pojo.Jsonschema2Pojo

...
  @TaskAction
  def generate(InputChanges inputs) {

should be enough as both IncrementalTaskInputs as well as InputChanges have boolean isIncremental(); which seems to be the only method that is being used