java.lang.Object
io.inverno.tool.buildtools.Project
All Implemented Interfaces:
Artifact

public abstract class Project extends Object implements Artifact

The Artifact representing the project to build.

A proper implementation must provide project information like group, name and version as well as the paths to project resources such as project's classes, working folder uded for intermediary build resources and a target folder where project's deliverables are generated.

Build tasks execution is hierarchical, some tasks depends on the others, consistent sequences of build tasks are fluently created from the Project. For instance, the following shows how to package an application:


 Project project = ...
 
 project
     .modularizeDependencies()           // Modularize project's dependencies
     .buildJmod()                        // Build the project's module JMOD
     .buildRuntime()                     // Create the project's runtime
     .packageApplication()               // Create the project's application package (image + .deb)
         .types(Set.of(PackageType.DEB)) 
     .archive()                          // Archive the project's application package (.zip)
         .formats(Set.of("zip"))
     .execute();
 

Note that build tasks does not operate on project sources but on compiled sources and packaged dependencies (JAR) which results from external build tools execution (e.g. Maven, Gradle...) for which specific Project implementations shall be provided.

Since:
1.4
Author:
Jeremy Kuhn
  • Field Details

    • PROPERY_DISPLAY_PROGRESS_BAR

      public static final String PROPERY_DISPLAY_PROGRESS_BAR
      System property to set to display or not the progress bar while executing the build tasks.
      See Also:
  • Constructor Details

    • Project

      public Project(Path targetPath, Path workingPath)

      Creates a project.

      Parameters:
      targetPath - the target path where project deliverables are generated
      workingPath - the working path used to generate intermediate build states, default to targetPath if null
  • Method Details

    • getClassesPath

      public abstract Path getClassesPath()

      Returns the path to the classes directory which contains project module .class files.

      Returns:
      the path to the project module classes
    • getDependencies

      public abstract Set<? extends Dependency> getDependencies()

      Returns project module dependencies.

      Returns:
      a set of dependency modules
    • getTargetPath

      public Path getTargetPath()

      Returns the target path where project deliverables are generated.

      Returns:
      the target path
    • getWorkingPath

      public Path getWorkingPath()

      the working path where intermediate build states are generated.

      Returns:
      the working path
    • getFinalName

      public String getFinalName()

      Returns the final name to use when generating project deliverables.

      Defaults to Artifact.getName()-Artifact.getVersion()

      Returns:
      the final name of the project
    • modularizeDependencies

      public final ModularizeDependenciesTask modularizeDependencies()

      Creates a modularize dependencies task.

      Returns:
      a modularized dependencies task
    • modularizeDependencies

      public final ModularizeDependenciesTask modularizeDependencies(Consumer<ModularizeDependenciesTask> configurer)

      Creates and configure a modularize dependencies task.

      Parameters:
      configurer - a configurer
      Returns:
      a configured modularized dependencies task
    • stop

      public final StopTask stop()

      Creates a stop task.

      Returns:
      a stop task
    • stop

      public final StopTask stop(Consumer<StopTask> configurer)

      Creates and configures a stop task.

      Parameters:
      configurer - a configurer
      Returns:
      a configured stop task