Interface LibraryResolver


public interface LibraryResolver
Service for resolving library resources to one or more local paths for compilation. Look up available LibraryResolver.Provider via service loader to create instances. Instances are not intended to be reusable and so may maintain their own cache of previously resolved entries.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Context providing access to existing resolved libraries and files, the Lookup for resource resolution, and a LogBuilder for reporting information and errors.
    static final class 
    Data type giving a resource and the additional, resolved local files that were added for that resource.
    static interface 
    Provider interface for creating instances of LibraryResolver.
    static interface 
    Provider interface for pre-seeding the list of provided libraries with those built into the current PraxisCORE system.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Optional hook for disposing of cached resources.
    Resolve the provided resource to an LibraryResolver.Entry with local files to add for compilation.
  • Method Details

    • resolve

      Resolve the provided resource to an LibraryResolver.Entry with local files to add for compilation. The resolved entry will be from the first resolver to return a result. The entry should only contain additional files required to resolve the requested resource on top of the already resolved resources in the provided context.

      The resolver may return an alternative primary resource in the entry if an earlier resolution provides the required library, eg. at a different version. The entry may also report additional resources that have been provided by the additional files, such as additional transitive dependencies or alternative identifiers.

      The resolver should throw an exception if the resource is a type it should be able to resolve but for some reason cannot.

      Parameters:
      resource - library resource
      context - context, including already resolved paths
      Returns:
      optional list of paths
      Throws:
      Exception - if the resolver claims the resource but cannot resolve
    • dispose

      default void dispose()
      Optional hook for disposing of cached resources. The instance should not be used after this method has been called.