How to override getInputs()?


(wvxvw) #1

I’ve tried:

import org.gradle.api.internal.TaskInputsInternal

class X extends DefaultTask {
@override public TaskInputsInternal getInputs() { … }
}

and am getting

build file ‘/home/olegs/work/elastifile/elfs-system/tesla/build.gradle’: 24: unable to resolve class org.gradle.api.internal.TaskInputsInternal.

The reason I need this is I want to build a project in a language where the compiler resolves the dependencies on its own, but can also print the list of dependencies. Users don’t usually know, and will find it to be very tedious and error prone to specify dependencies by hand. So, I want to write a task class, which, given the entry point resolves all dependencies. Documentation is lacking in this respect, and there doesn’t seem to be any debugging support for the Gradle language, so I came to you for answers.
TIA


(Chris Doré) #2

What are the dependencies, other source files from the project or external dependencies that need to be resolved from some external source?

EDIT: I guess I was kind of bored tonight :slight_smile: I made a small sample that can read extra input source files from an initial source file https://github.com/oesolutions/gradle-embeddedinputs-test The key to this is not overriding getInputs but instead providing the annotated methods, which Gradle will call.


How to add dependencies based on C file contents?