java.lang.Object
com.github.sormuras.bach.Builder
A modular Java project builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbach()voidbuild()Builds a modular Java project.voidbuildAllSpaces(CodeSpaces spaces)Builds all code spaces.voidbuildMainCodeSpace(MainCodeSpace main)Builds the main space.voidbuildMainSingleReleaseVintageModules(int mainRelease)Builds all modules targeting Java 7 or Java 8.voidbuildTestCodeSpace(TestCodeSpace test)Builds the test space.computeMainJarCall(ModuleDeclaration module)computeMainJarFileName(ModuleDeclaration module)computeMainJavacCall(int release)computeMainJavacCall(String module, SourceFolder folder)Returns a module lookup composed of external module links and best-effort lookup.computeTestJarCall(ModuleDeclaration declaration)computeTestJUnitCall(ModuleDeclaration declaration)computeToolCallArgumentsDescription(ToolCall call, int maxLineLength)Returns a description of the given tool call.booleanbooleanbooleanbooleanvoidLoad required and missing modules in a best-effort manner.project()voidRuns the given tool call.voidRuns tool calls of the given stream in parallel.
-
Constructor Details
-
Builder
Initialize this builder with the given components.- Parameters:
bach- the underlying Bach instanceproject- the project to build
-
-
Method Details
-
bach
- Returns:
- the underlying Bach instance
-
project
- Returns:
- the project to build
-
build
public void build()Builds a modular Java project. -
loadRequiredAndMissingModules
public void loadRequiredAndMissingModules()Load required and missing modules in a best-effort manner. -
computeModuleLookup
Returns a module lookup composed of external module links and best-effort lookup.- Returns:
- a module lookup
-
buildAllSpaces
Builds all code spaces.- Parameters:
spaces- the code spaces to build
-
buildMainCodeSpace
Builds the main space.- javac + jar
- javadoc
- jlink
- jpackage
- Parameters:
main- the main space to build
-
computeMainJavacCall
- Parameters:
release- the release- Returns:
- the
javaccall to compile all modules of the main space
-
computeMainJavacCall
- Parameters:
module- the name of the module to compilefolder- the source folder to compile- Returns:
- the
javaccall to compile a version of a multi-release module
-
buildMainSingleReleaseVintageModules
public void buildMainSingleReleaseVintageModules(int mainRelease)Builds all modules targeting Java 7 or Java 8.- Parameters:
mainRelease- the main classes release feature number
-
computeMainJarCall
- Parameters:
module- the module declaration to create an archive for- Returns:
- the
jarcall to archive all assets for the given module
-
computeMainJarFileName
- Parameters:
module- the module declaration- Returns:
- the name of the JAR file for the given module declaration
-
computeMainJarTargetedDirectories
- Parameters:
module- the module declaration- Returns:
- a map with "release to list-of-path" entries
-
computeMainDocumentationJavadocCall
- Returns:
- the javadoc call generating the API documentation for all main modules
-
computeMainDocumentationJarCall
- Returns:
- the jar call generating the API documentation archive
-
computeMainJLinkCall
- Returns:
- the jllink call
-
buildTestCodeSpace
Builds the test space.- javac + jar
- junit
- Parameters:
test- the test space to build
-
computeTestJavacCall
- Returns:
- the
javaccall to compile all modules of the test space.
-
computeTestJarCall
- Parameters:
declaration- the module declaration to create an archive for- Returns:
- the
jarcall to archive all assets for the given module
-
computeTestJUnitCall
- Parameters:
declaration- the module declaration to scan for tests- Returns:
- the
junitcall to launch the JUnit Platform for
-
isGenerateApiDocumentation
public boolean isGenerateApiDocumentation()- Returns:
trueif an API documenation should be generated, elsefalse
-
isGenerateCustomRuntimeImage
public boolean isGenerateCustomRuntimeImage()- Returns:
trueif a custom runtime image should be generated, elsefalse
-
isGenerateMavenPomFiles
public boolean isGenerateMavenPomFiles()- Returns:
trueif a custom runtime image should be generated, elsefalse
-
isIncludeSourcesInModules
public boolean isIncludeSourcesInModules()- Returns:
trueif a custom runtime image should be generated, elsefalse
-
run
Runs the given tool call.- Parameters:
call- the tool call to run
-
run
Runs tool calls of the given stream in parallel.- Parameters:
calls- the tool calls to run
-
computeToolCallArgumentsDescription
Returns a description of the given tool call.- Parameters:
call- the tool call to describemaxLineLength- the maximum number of characters to return- Returns:
- a string that describes a tool call
-