Class AbstractLauncher

java.lang.Object
org.jdrupes.builder.startup.AbstractLauncher
All Implemented Interfaces:
Launcher
Direct Known Subclasses:
BootstrapProjectLauncher, BuildProjectLauncher

public abstract class AbstractLauncher extends Object implements Launcher
A default implementation of a Launcher.
  • Constructor Details

    • AbstractLauncher

      protected AbstractLauncher()
      Initializes a new abstract launcher.
  • Method Details

    • propertiesFromFiles

      protected static Properties propertiesFromFiles(Path buildRoot)
      Get the properties from the properties files in the user's home directory and the build root directory.
      Parameters:
      buildRoot - the build root directory
      Returns:
      the properties
    • addCliProperties

      protected static void addCliProperties(Properties jdbldProps, org.apache.commons.cli.CommandLine commandLine)
      Adds properties or overrides existing properties with those from the command line.
      Parameters:
      jdbldProps - the jdbld props
      commandLine - the command line
    • configureLogging

      protected static void configureLogging(Path buildRoot, Properties jdbldProps)
      Configure the logging from logging properties found in DefaultBuildContext.JDBLD_DIRECTORY resolved against buildRoot.
      Parameters:
      buildRoot - the build root
      jdbldProps - the jdbld properties
    • baseOptions

      protected final org.apache.commons.cli.Options baseOptions()
      Return the handled options.
      Returns:
      the options
    • findProjects

      protected void findProjects(ClassLoader clsLoader, List<Class<? extends RootProject>> rootProjects, List<Class<? extends Project>> subprojects)
      Find projects. The classpath is scanned for classes that implement Project but do not implement Masked.
      Parameters:
      clsLoader - the cls loader
      rootProjects - classes that implement RootProject
      subprojects - classes that implement Project but not RootProject
    • resources

      public <T extends Resource> Stream<T> resources(Stream<Project> projects, ResourceRequest<T> request)
      Description copied from interface: Launcher
      Provide the requested resources from the given projects.
      Specified by:
      resources in interface Launcher
      Type Parameters:
      T - the requested type
      Parameters:
      projects - the projects
      request - the request
      Returns:
      the results
    • reportBuildException

      public static final <T> T reportBuildException(Callable<T> todo)

      A utility method for reliably reporting problems as BuildExceptions. It invokes the callable. If a Throwable occurs, it unwraps the causes until it finds the root BuildException and rethrows it. Any other Throwable is wrapped in a new BuildException which is then thrown.

      Effectively, the method thus either returns the requested result or a BuildException.

      Type Parameters:
      T - the generic type
      Parameters:
      todo - the todo
      Returns:
      the result
    • formatter

      Return the default formatter for build exceptions.
      Returns:
      the builds the exception formatter