manifold-systems / manifold

Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
http://manifold.systems/
Apache License 2.0
2.43k stars 125 forks source link

`manifold-preprocessor`: Add an SPI to provide symbols to the preprocessor dynamically e.g., to support android build variant/flavors #322

Closed rsmckinney closed 3 years ago

rsmckinney commented 3 years ago

Add an SPI to provide symbols to the preprocessor dynamically e.g., to support android build variant/flavors.

The SPI will look something like this:

public interface SymbolProvider {
  boolean isDefined(IFile sourceFileContext, String symbol);
  String getValue(IFile sourceFileContext, String symbol);
}

This interface generalizes symbol lookup so that it can be done dynamically, as opposed to providing a Map.

rsmckinney commented 3 years ago

Feature available with release 2021.1.33. See docs for manifold-preprocessor-android-syms, also see additional docs for manifold-preprocessor.