Package org.machanism.machai.project.layout


package org.machanism.machai.project.layout
APIs for detecting, describing, and working with a repository's on-disk project layout.

This package defines ProjectLayout, a common abstraction for representing a project as a root directory together with conventional, root-relative locations such as source, test, and documentation directories. Implementations encapsulate the rules used by different ecosystems to infer those locations from directory conventions or build metadata.

Core concepts

  • Project directory: the filesystem root against which all discovered relative locations are resolved.
  • Root-relative path: layout accessors typically return path relative to the project directory rather than absolute filesystem locations.
  • Modules: child projects that may be declared by build metadata or discovered from common multi-module conventions.

Package responsibilities

  • Provide a uniform way to query source, test, and documentation folders across build systems.
  • Expose module identifiers and module directories for repositories that contain nested projects.
  • Offer specialized implementations for common build ecosystems while preserving a consistent programming model.

Implementations

  • MavenProjectLayout reads Maven-oriented layout information from conventional structure and pom.xml metadata.
  • GradleProjectLayout represents Gradle-style project locations and module structure.
  • JScriptProjectLayout resolves JavaScript project folders and workspace modules from package.json configuration.
  • PythonProjectLayout identifies Python project structure from pyproject.toml conventions.
  • DefaultProjectLayout provides a fallback implementation when no ecosystem-specific model applies.

Typical usage


 java.io.File projectDir = new java.io.File("repo");

 ProjectLayout layout = new MavenProjectLayout().projectDir(projectDir);
 java.util.List<String> modules = layout.getModules();
 java.util.Collection<String> sources = layout.getSources();
 java.util.Collection<String> tests = layout.getTests();
 java.util.Collection<String> documents = layout.getDocuments();