Welcome to the Popcorn Gradle Plugin!
The goal of this plugin is to help enforce architectural rules in your project. Once you apply the plugin and specify your architecture guidelines, the plugin will automatically verify whether your architecture adheres to these rules.
📚 Take a look at our documentation
Go to your build-logic folder, in the build-logic/build.gradle.kts
, add the following dependency:
implementation("io.github.codandotv:popcornguineapig:<version>")
You can chose a conventional gradle plugin to define your rules.
For example, I have a gradle plugin applied to all modules kmp-library-setup.gradle.kts
. In this conventional plugin, you can add:
plugins {
...
id("io.github.codandotv.popcorngp")
}
After apply the plugin, you can sync and define the architecture rules:
popcornGuineapigConfig {
// You also can skip rules to help duing migration
skippedRules = listOf(DoNotWithRule::class)
configuration = PopcornConfiguration(
project = PopcornProject(
type = ProjectType.JAVA
),
rules = listOf(
NoDependencyRule(),
DoNotWithRule(
notWith = listOf("[a-z]+-data")
)
)
)
}
You also can create custom rules, you just need to do:
class MyRule : PopcornGuineaPigRule {
override fun check(deps: List<InternalDependenciesMetadata>): ArchitectureViolationError? {
return null
}
}
popcornGuineapigConfig {
configuration = PopcornConfiguration(
project = PopcornProject(
type = ProjectType.JAVA
),
rules = listOf(
MyRule(),
)
)
}
./gradlew popcorn
It is simple as a popcorn 🍿 + 🐹
The Popcorn Gradle Plugin supports:
-
Kotlin Multiplatform Projects (KMP)
-
Java Projects
-
Android Projects