How do you define buildConfigField in Gradle Java-library Project build script

In my Android projects, I can specify Gradle constants as follows: -

buildConfigField 'Boolean', 'analyticsEnabled', 'false'

and access them in my android application as follows: -

public boolean isAnalyticsEnabled() {
        return BuildConfig.analyticsEnabled;
}

How can I get the same functions in the Java Gradle build script library?

To be more precise, I am developing a custom annotation processor as a pure Java project (library), which my Android application depends on.

I would like to define the constants in my Java Gradle assembly file that are available to my annotation processor.

If this is possible, then how can I achieve it?

+4
source share

Source: https://habr.com/ru/post/1687707/


All Articles