Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 2.44 KB

README.md

File metadata and controls

83 lines (61 loc) · 2.44 KB

Design Patterns

See books in /books directory
See principles of programming in /principles directory

Patterns:

Running patterns using gradle

Available Tasks:

patternsHelp - Prints all generated tasks for patterns

# Input:
./gradlew patternsHelp

# Output:
adapter
    build :adapterBuild
    jar   :adapterJar
    run   :adapterRun
    clean :adapterClean
# and so on...

patternsRunAll - Runs all :*Run tasks of patterns

# Input:
./gradlew patternsRunAll

# Output:
:adapterBuild
:adapterJar
:adapterRun
# and so on for each pattern...

patternsCleanAll - Runs all :*Clean tasks of patterns

./gradlew patternsCleanAll

Register pattern within build.gradle

To register a pattern use following function in build.gradle

def pattern(String dirName, String taskPrefix = null) {}
  • dirName - Directory which contains source code of pattern
  • taskPrefix - [Optional] Prefix of generated tasks of each pattern. Default value is equal to dirName

It registers four tasks associated with the pattern. They have the following format (see short descriptions):

  • <taskPrefix>Build - Compiles sources files into build/classes/<dirName>/<dirName>/
  • <taskPrefix>Jar - Builds compiled class files into a single jar build/libs/<dirName>.jar
  • <taskPrefix>Run - Runs the generated jar file
  • <taskPrefix>Clean - Cleans generated files

Each directory of pattern MUST have Example class because it is considered as initial point

See some additional functionality in buildSrc

TODOs, Notes

Note #1: Some of examples are taken from external resources.
Note #2: The repository is open to modifications.