Based on <#FreeMarker> C like preprocessor for Java. It helps you generate different Java source code base - depending on <#FreeMarker> based control flow in the sources.
.
|-- LICENSE.md - MIT license file
|-- README.md - this README.md file
|-- bin
| `-- jpp.sh - wrapper to make running more convenient
|-- build.xml - ant based build script for the project
|-- images
| |-- debug_vs_release.png - illustration of sample debug vs. release
| `-- java_version.png - illustration of different JVM's version APIs
|-- resources
| `-- log4j2.xml - we want to format error and info differently
|-- sample
| `-- src
| |-- DebugVsRelease.java - debug vs. release passed as arg
| |-- DebugVsReleaseDefine.java - debug vs. release defined in the code
| `-- somepackage
| `-- JavaVersion.java - sample code for getting Java version
`-- src
`-- org
`-- owsiak
`-- preprocessor
|-- CLIParser.java - handling cli args is done here
`-- JavaPreprocessor.java - main class for Preprocessor
> git clone https://github.com/mkowsiak/jpp.git
> cd jpp
> ant dist
> java -jar dist/jpp.jar
or
> ant run
or
> export PATH=${PATH}:`pwd`/bin
> jpp.sh
# if we plan to use the code with version < 9
./bin/jpp.sh -Dversion=6 -s sample/src -d sample/preprocessed -f somepackage/JavaVersion.java
# if we plan to use the code with version >= 9
./bin/jpp.sh -Dversion=9 -s sample/src -d sample/preprocessed -f somepackage/JavaVersion.java
# if we plan to compile code with all debug stuff
./bin/jpp.sh -Ddebug=true -s sample/src -d sample/preprocessed -f DebugVsRelease.java
# if we plan to compile code in "release" mode
./bin/jpp.sh -Ddebug=false -s sample/src -d sample/preprocessed -f DebugVsRelease.java
./bin/jpp.sh -s sample/src -d sample/preprocessed -f DebugVsReleaseDefine.java