saker.build Documentation TaskDoc JavaDoc Packages
public interface SakerRepository extends AutoCloseable
Interface for repositories which are the main extension points for the build system.

Repositories are loaded and used by the build environment to provide the appropriate services. They currently provide two functionalities:

A view to the repositories can be configured to provide services configured for build executions. This is necessary as different build configurations might need the same repository to act in different ways. (See createBuildRepository(RepositoryBuildEnvironment))

Repositories can optionally provide access to actions which basically act as a main function for the repository. It can be used to execute code with the given parameters. Via actions, repositories can provide access to core features of it without the need of intializing a build execution.

Repositories are instantiated using SakerRepositoryFactory factory class that receives the environment for repositories to work with.

Methods
public void
Closes the repository and any child build repositories.
public BuildRepository
Creates a build repository for the configuration specified by the environment parameter.
public default void
executeAction(String... arguments)
Executes an arbitrary action on this repository with the given parameters.
public abstract void close() throws IOException
Closes the repository and any child build repositories.

Subsequent calls to this method should be a no-op. I.e. this method should be idempotent.

IOExceptionIn case of closing error.
Creates a build repository for the configuration specified by the environment parameter.

The created build repository should operate based on the configuration available from the parameter environment.

Build repositories are required to set the class lookup resolution appropriately in order for proper incremental build handling. (See RepositoryBuildEnvironment.getClassLoaderResolverRegistry())

Repository implementations should keep track of the created build repositories, and call close() on them if this parent repository is closed. If the created build repositories handle no unmanaged data, this behaviour can be omitted.

If this method throws an exception, the build execution will be aborted.

environmentThe build repository environment to use.
The created build repository.
public default void executeAction(String... arguments) throws Exception, UnsupportedOperationException
Executes an arbitrary action on this repository with the given parameters.

This method servers as a main method to the repository. Calling it will execute custom actions specified by the repository implementation.

Implementations are not recommended to call System.exit(int) after finishing the action, but they are allowed to do so. Make sure to document exit related behaviour for the callers.

The default implementation throws an UnsupportedOperationException.

argumentsThe arguments for the action.
ExceptionIn case of any error occurring during execution of the action.
UnsupportedOperationExceptionIf this repository action is not supported.