I am looking to utilize KSP to generate a comprehensive list of feature flags across various modules in my project, including the 'app', 'module1', 'module2', up to 'moduleN'.
Currently, I have a code processor in place that gathers each @FeatureFlag annotation, and the KSP processor serves as a dependency for each module.
Here is a snapshot of how feature flags are collected in each module:
Module 1:
#build/generated/ksp/main/kotlin/package
internal val featuresFlags : Set<FeatureFlag> = setOf(settingsFeatureFlag, profileFeatureFlag)
Module 2:
#build/generated/ksp/main/kotlin/package
internal val featuresFlags : Set<FeatureFlag> = setOf(fingerprintFeatureFlag)
Module N
#build/generated/ksp/main/kotlin/package
internal val featuresFlags : Set<FeatureFlag> = setOf(0...N)
Now, I'm seeking a way to consolidate these individual results into a single variable or use case. The desired outcome is as follows:
Feature flag module
internal val featuresFlags : Set<FeatureFlag> = setOf(settingsFeatureFlag, profileFeatureFlag, fingerprintFeatureFlag, ...) # contact all modules result
I am also grappling with a potential limitation in KSP -ksp-issue. Also, when I try to write outcome out of each module I get
[ksp] java.lang.IllegalStateException: requested path is outside the bounds of the required directory
None of the options I have tried myself, just spitting ideas.
Have you tried to pass the target build directory as KSP argument to the submodules?
Try adding this to the app module gradle:
Alternatively, after each ksp task is done:
This will append directory as command line argument
Or