Does Manifold preprocessor support splitting the code base

41 views Asked by At

Given that I use Manifold, a Java compiler plugin, and more specificaly the preprocessor, which acts very much like C/C++ directives, is it possible to split the code base based on these directives.

For example

#if VERSION_1
 old java code
#elif VERSION_2
 new java code
#else
  #error "Unsupported version"
#end if

I would like to generate the source code without the directives based on the version defined. It is not clear to me if this is possible.

1

There are 1 answers

0
Scott On

Yes. Preprocessor directives provided by manifold effectively mask away code in the body of a false #if/elif directive. Directives apply at the top level, as such you can use directives to turn on/off any and all code in a file. The manifold-preprocessor documentation explains this.

manifold preprocessor