package org.implab.gradle.variants.artifacts;

import org.gradle.api.Task;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileSystemLocation;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.TaskProvider;

/**
 * Materialized body of an {@link ArtifactSlot}.
 *
 * <p>
 * An assembly is a stateful build object obtained on demand from
 * {@link ArtifactAssemblies#require(ArtifactSlot)}. It describes how the
 * slot artifact is produced and
 * where that single published artifact will appear.
 */
public interface ArtifactAssembly {

    /**
     * Returns the published artifact produced for the slot.
     *
     * <p>
     * A slot is expected to produce exactly one artifact represented by one file or
     * one directory.
     *
     * @return provider of the produced artifact location
     */
    Provider<? extends FileSystemLocation> getArtifact();

    /**
     * Returns the task that assembles the slot artifact.
     *
     * @return provider of the assembly task
     */
    TaskProvider<? extends Task> getAssemblyTask();

    /**
     * File collection, contains {@link #getArtifact()} and build dependency on
     * {@link #getAssemblyTask()}. This is a conventional property.
     */
    FileCollection getFileCollection();
}
