Class ProjectLayoutManager

java.lang.Object
org.machanism.machai.project.ProjectLayoutManager

public class ProjectLayoutManager extends Object
Detects and configures the ProjectLayout appropriate for a project directory.

The detector checks project descriptors in a deterministic order: Maven, Gradle, JavaScript or TypeScript, and Python. A directory without a supported descriptor receives a DefaultProjectLayout. The returned layout is configured with the supplied directory before it is returned.

Usage


 File directory = new File("path/to/project");
 ProjectLayout layout = ProjectLayoutManager.detectProjectLayout(directory);
 

Callers can use the returned layout directly or pass it to a ProjectProcessor implementation for traversal.

Since:
0.0.2
Author:
Viktor Tovstyi
  • Constructor Details

    • ProjectLayoutManager

      private ProjectLayoutManager()
      Prevents instantiation of this utility class.
  • Method Details

    • detectProjectLayout

      public static ProjectLayout detectProjectLayout(File projectDir) throws FileNotFoundException
      Detects the project layout from descriptors in the specified directory and assigns that directory to the resulting layout.
      Parameters:
      projectDir - the project directory to analyze
      Returns:
      a configured layout matching Maven, Gradle, JavaScript/TypeScript, Python, or the generic filesystem fallback
      Throws:
      FileNotFoundException - if projectDir does not exist
      NullPointerException - if projectDir is null