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.
    • Method Detail

      • resolve

        Optional<LibraryResolver.Entry> resolve​(PResource resource,
                                                LibraryResolver.Context context)
                                         throws Exception
        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.