package org.implab.gradle.common.utils;

import java.util.function.Supplier;

import javax.inject.Inject;

import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.ProviderFactory;

import groovy.lang.Closure;

public interface ObjectsMixin {
    @Inject
    ObjectFactory getObjects();

    @Inject
    ProviderFactory getProviders();

    default <T> Provider<T> provider(Supplier<T> supplier) {
        return getProviders().provider(supplier::get);
    }

    default <T> Provider<T> provider(Closure<T> closure) {
        return getProviders().provider(closure);
    }
}
