package org.implab.gradle.variants.sources;

import org.gradle.api.Action;
import org.implab.gradle.common.core.lang.Closures;

import groovy.lang.Closure;

public interface VariantSourcesExtension {

    /**
     * Invoked when finalized variants-derived source context becomes available.
     *
     * Replayable:
     * - if called before variants finalization, action is queued
     * - if called after variants finalization, action is invoked immediately
     */
    void whenFinalized(Action<? super VariantSourcesContext> action);

    default void whenFinalized(Closure<?> closure) {
        whenFinalized(Closures.action(closure));
    }
}