Class AbstractLauncher
java.lang.Object
org.jdrupes.builder.startup.AbstractLauncher
- All Implemented Interfaces:
Launcher
- Direct Known Subclasses:
BootstrapProjectLauncher, BuildProjectLauncher
A default implementation of a
Launcher.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddCliProperties(Properties jdbldProps, org.apache.commons.cli.CommandLine commandLine) Adds properties or overrides existing properties with those from the command line.protected final org.apache.commons.cli.OptionsReturn the handled options.protected static voidconfigureLogging(Path buildRoot, Properties jdbldProps) Configure the logging from logging properties found inDefaultBuildContext.JDBLD_DIRECTORYresolved againstbuildRoot.protected voidfindProjects(ClassLoader clsLoader, List<Class<? extends RootProject>> rootProjects, List<Class<? extends Project>> subprojects) Find projects.static BuildExceptionFormatterReturn the default formatter for build exceptions.protected static PropertiespropertiesFromFiles(Path buildRoot) Get the properties from the properties files in the user's home directory and the build root directory.static final <T> TreportBuildException(Callable<T> todo) A utility method for reliably reporting problems asBuildExceptions.resources(Stream<Project> projects, ResourceRequest<T> request) Provide the requested resources from the given projects.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Launcher
rootProject
-
Constructor Details
-
AbstractLauncher
protected AbstractLauncher()Initializes a new abstract launcher.
-
-
Method Details
-
propertiesFromFiles
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 propscommandLine- the command line
-
configureLogging
Configure the logging from logging properties found inDefaultBuildContext.JDBLD_DIRECTORYresolved againstbuildRoot.- Parameters:
buildRoot- the build rootjdbldProps- the jdbld properties
-
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 implementProjectbut do not implementMasked.- Parameters:
clsLoader- the cls loaderrootProjects- classes that implementRootProjectsubprojects- classes that implementProjectbut notRootProject
-
resources
-
reportBuildException
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 rootBuildExceptionand rethrows it. Any otherThrowableis wrapped in a newBuildExceptionwhich 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
-