Interface BuildContext

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DefaultBuildContext

public interface BuildContext extends AutoCloseable
The context of a build.
  • Field Details

  • Method Details

    • jdbldDirectory

      default Path jdbldDirectory()
      Returns the relative path from a project directory to the JDrupes Builder directory.
      Returns:
      the path
    • commonCacheDirectory

      The path to the common cache directory. This may be used by providers to cache information that is shared between projects. Providers must create a sub-directory of this directory, preferably with the same name FQN as the provider.
      Returns:
      the path
    • commandLine

      org.apache.commons.cli.CommandLine commandLine()
      The command line as processed by Apache Commons CLI.
      Returns:
      the parsed command line
    • resources

      <T extends Resource> Stream<T> resources(ResourceProvider provider, ResourceRequest<T> request)

      Obtains the stream of resources of the given type from the given provider. The result from invoking the provider is evaluated asynchronously and cached. Only when the returned stream is terminated will the invocation block until the result from the provider becomes available.

      To avoid duplicate invocations of a non-project provider, any intends are removed from the request before such a provider is invoked.

      Type Parameters:
      T - the resource type
      Parameters:
      provider - the provider
      request - the request
      Returns:
      the results
    • property

      String property(String name, String defaultValue)

      Returns the value of the given property. Properties are defined by (in order of precedence):

      1. command line options
      2. the file .jdbld.properties in the directory of the root project
      3. the file .jdbld/jdbld.properties in the user's home directory
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the string
    • statusLine

      Returns the status line for the current thread. The status line may be used by ResourceProviders to indicate progress during the execution of ResourceProviderSpi.provide(ResourceRequest). A StatusLine is automatically allocated by the context when resources(ResourceProvider, ResourceRequest) is invoked.

      When called while not executing resources(ResourceProvider, ResourceRequest), this method returns a dummy status line that discards all updates.

      Returns:
      the status line
    • out

      Returns the PrintStream for the standard output.
      Returns:
      the prints the stream
    • error

      Returns a PrintStream for errors. The data is sent to the standard output stream as with out(), but it is marked, typically in red, to indicate an error.
      Returns:
      the prints the stream
    • close

      void close()
      Close the context. The re-declaration of this method removes the IOException, which is never thrown.
      Specified by:
      close in interface AutoCloseable