Skip to content

dvpermyakov/feature-toggles-gradle

Repository files navigation

Feature toggles generated by gradle plugin

CircleCI License: MIT

This gradle plugin allows you to generate Kotlin classes (.kt) using the interfaces:

interface FeatureToggle {
    val id: FeatureToggleId
    val enabled: Boolean
    val name: String
}
interface FeatureToggleConfig {
    val featureToggles: List<FeatureToggle>
}

For example, you set FeatureToggleId:

enum class FeatureToggleId {
    FEATURE;
}

And you apply and configure plugin in build.gradle.kts:

apply<FeatureTogglePlugin>()
configure<FeatureTogglePluginExtension> {
    configName = "default"
    toggles = listOf(
        FeatureToggle(
            id = "FEATURE",
            enabled = true,
            name = "Default feature"
        )
    )
}

Plugin generates these classes:

@Generated
object FeatureToggle_FEATURE : FeatureToggle {
  override val id: FeatureToggleId = FeatureToggleId.FEATURE
  override val enabled: Boolean = true
  override val name: String = "Default feature"
}
@Generated
object FeatureToggleConfig_default : FeatureToggleConfig {
  override val featureToggles: List<FeatureToggle> = listOf(FeatureToggle_FEATURE)
}

Releases

No releases published

Packages

No packages published

Languages