abstract class EasierDefaultTask : DefaultTask() { @get:Inject abstract val objects: ObjectFactory @get:Inject abstract val providers: ProviderFactory @get:Inject abstract val layout: ProjectLayout inline fun input(convention: T): PropertyDelegateProvider>> = PropertyDelegateProvider { thisRef: EasierDefaultTask, _ -> val value: Property = thisRef.objects.property().convention(convention) ReadOnlyProperty> { _, _ -> value } } fun input(convention: RegularFile): PropertyDelegateProvider> = PropertyDelegateProvider { thisRef: EasierDefaultTask, _ -> val value: RegularFileProperty = thisRef.objects.fileProperty().convention(convention) ReadOnlyProperty { _: Any, _ -> value } } } abstract class MyTask : EasierDefaultTask() { @get:Input val stringInput: Property by input(convention = "foo") @get:Input val boolInput: Property by input(convention = false) @get:InputFile val fileInput: RegularFileProperty by input(convention = layout.projectDirectory.file("input.txt")) @TaskAction fun doStuff() { //... } }