Class GragleProjectLayout
java.lang.Object
org.machanism.machai.project.layout.ProjectLayout
org.machanism.machai.project.layout.GragleProjectLayout
A Gradle-specific
ProjectLayout implementation.
This layout uses the Gradle Tooling API to load a GradleProject model and expose a minimal set of layout
information:
- module names (based on the Gradle project children)
- conventional source roots (defaults to
src/main) - conventional test roots (defaults to
src/test) - documentation inputs (defaults to
src/site)
Note: This implementation does not currently parse custom source sets; it returns conventional directories only.
- Since:
- 0.0.2
- Author:
- Viktor Tovstyi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns conventional documentation roots for Gradle projects.Returns a list of child module names for multi-project Gradle builds.Returns the Gradle project name as a stable identifier.Returns the Gradle project name.Returns conventional production source roots for Gradle projects.getTests()Returns conventional test source roots for Gradle projects.static booleanisGradleProject(File projectDir) Checks whether the given directory appears to be a Gradle project.projectDir(File projectDir) Sets the project directory and narrows the return type for fluent usage.Methods inherited from class org.machanism.machai.project.layout.ProjectLayout
findDirectories, findFiles, getExcludeDirs, getParentId, getProjectDir, getProjectLayoutType, getRelativePath, getRelativePath, getRelativePath
-
Constructor Details
-
GragleProjectLayout
public GragleProjectLayout()
-
-
Method Details
-
isGradleProject
Checks whether the given directory appears to be a Gradle project.- Parameters:
projectDir- directory to check- Returns:
trueifbuild.gradleexists in the directory;falseotherwise
-
getModules
Returns a list of child module names for multi-project Gradle builds.- Overrides:
getModulesin classProjectLayout- Returns:
- list of child project names (root-relative module identifiers), or empty list if the build has no children
-
getSources
Returns conventional production source roots for Gradle projects.- Specified by:
getSourcesin classProjectLayout- Returns:
- list containing
src/main
-
getDocuments
Returns conventional documentation roots for Gradle projects.- Specified by:
getDocumentsin classProjectLayout- Returns:
- list containing
src/site
-
getTests
Returns conventional test source roots for Gradle projects.- Specified by:
getTestsin classProjectLayout- Returns:
- list containing
src/test
-
projectDir
Sets the project directory and narrows the return type for fluent usage.- Overrides:
projectDirin classProjectLayout- Parameters:
projectDir- project root directory- Returns:
- this layout instance
-
getProjectId
Returns the Gradle project name as a stable identifier.- Overrides:
getProjectIdin classProjectLayout- Returns:
- project name or empty string if the model cannot be loaded
-
getProjectName
Returns the Gradle project name.- Overrides:
getProjectNamein classProjectLayout- Returns:
- project name or empty string if the model cannot be loaded
-