java.lang.Object
com.github.sormuras.bach.Builder
A modular Java project builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbach()
void
build()
Builds a modular Java project.void
buildAllSpaces(CodeSpaces spaces)
Builds all code spaces.void
buildMainCodeSpace(MainCodeSpace main)
Builds the main space.void
buildMainSingleReleaseVintageModules(int mainRelease)
Builds all modules targeting Java 7 or Java 8.void
buildTestCodeSpace(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.boolean
boolean
boolean
boolean
void
Load required and missing modules in a best-effort manner.project()
void
Runs the given tool call.void
Runs 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
javac
call 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
javac
call 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
jar
call 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
javac
call to compile all modules of the test space.
-
computeTestJarCall
- Parameters:
declaration
- the module declaration to create an archive for- Returns:
- the
jar
call to archive all assets for the given module
-
computeTestJUnitCall
- Parameters:
declaration
- the module declaration to scan for tests- Returns:
- the
junit
call to launch the JUnit Platform for
-
isGenerateApiDocumentation
public boolean isGenerateApiDocumentation()- Returns:
true
if an API documenation should be generated, elsefalse
-
isGenerateCustomRuntimeImage
public boolean isGenerateCustomRuntimeImage()- Returns:
true
if a custom runtime image should be generated, elsefalse
-
isGenerateMavenPomFiles
public boolean isGenerateMavenPomFiles()- Returns:
true
if a custom runtime image should be generated, elsefalse
-
isIncludeSourcesInModules
public boolean isIncludeSourcesInModules()- Returns:
true
if 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
-