Proper way of using a Range Property

I’d like to use a Range Property in my custom task:

    public abstract Property<Range<Integer>> getDatasetSubstring();

This does not work since Gradle wants a ListProperty. I guess because of Range extending AbstractList.

If I use ListProperty<Range<Integer>> I need to use explicitly a property in the build script:

datasetSubstring = objects.listProperty(Range).set(0..4)

For the sake of simplicity I’d like to use:

datasetSubstring = 0..4

Is there a way to achieve this?


1 Like