CLI generating modularized Gradle projects based on different shapes
./projectGenerator --shape triangle --layers 5 --modules 100
This command generates a project with 100 modules using Kotlin DSL. The project is divided in 5 layers + 1 layer acting as a main entry point of the project. The project generated guarantee relationships for project dependencies in the contiguous layers.
curl -L https://github.com/cdsap/ProjectGenerator/releases/download/v0.1.6/projectGenerator --output projectGenerator
chmod 0757 projectGenerator
./projectGenerator --shape triangle --layers 5 --modules 100
ProjectGenerator(
modules = 50,
shape = Shape.MIDDLE_BOTTLENECK,
layers = 5
).write()
implementation("io.github.cdsap:projectgenerator:0.1.6")
Number of modules to create in the project
Number of layers where the modules will be distributed.
Defines the shape of the project dependency graph based on the distribution of modules by layer. Current shapes supported:
default
The project generated includes modules build scripts in Kotlin DSL
The project generated includes modules build scripts in Groovy
Two projects will be generated using Kotlin DSL and Groovy
// dependency
ProjectGenerator(
modules = 50,
shape = Shape.MIDDLE_BOTTLENECK,
layers = 5,
language = Language.GROOVY
).write()
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --language groovy
Type of project generated:
default
Android project
Kotlin-JVM project
// dependency
ProjectGenerator(
modules = 50,
shape = Shape.MIDDLE_BOTTLENECK,
layers = 5,
typeOfProjectRequested = TypeProjectRequested.JVM
).write()
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --type jvm
Classes generated per module, options:
- classes: Classes to generate per module. Default 5.
- type:
- Fixed(default): Each module will create n classes where n represents the argument
classes
. - Random: Each module will create
Random.nextInt(2, classesPerModule.classes)
classes.
- Fixed(default): Each module will create n classes where n represents the argument
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
classesPerModule = ClassesPerModule(ClassesPerModuleType.RANDOM,100)
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --classes-module-type random --classes-module 150
Android Gradle Plugin version (default 8.5.1)
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
versions = Versions(agp = "8.1.3")
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --agp-version 8.1.3
Kotlin Gradle Plugin version (default 1.9.24)
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
versions = Versions(kgp = "1.9.0")
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --kgp-version 1.9.0
Each module generated includes 8 string resources in the file strings.xml
. Default.
Each module generated includes 900 string resources in the file strings.xml
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
typeOfStringResources = TypeOfStringResources.LARGE
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --type-of-string-rresources large
default false
If enabled, each module will generate n unit tests, where n is the argument classes
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
generateUnitTest = true
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --generate-unit-test true
Gradle used, versions supported:
- Gradle 8.2
- Gradle 8.5
- Gradle 8.9. default
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
gradle = GradleWrapper(Gradle.GRADLE_7_6_2)
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --gradle 7.6.2
default false
Includes in the root build gradle the plugins:
- jraska/modules-graph-assert
- autonomousapps/dependency-analysis-gradle-plugin
- siggijons/graph-untangler-plugin
// dependency
ProjectGenerator(
modules = 50,
layers = 5,
shape = Shape.INVERSE_TRIANGLE,
dependencyPlugins = true
)
// cli
./projectGenerator --shape triangle --layers 5 --modules 100 --dependency-plugins true
The default project generated is composed by the modules and one convention plugin defined as composite build. This convention plugin is used in all the modules of the project.
If you want to extend the build logic used in the project: