A set of Gradle plugins to propagate CODEOWNERS of classes to runtime for JVM and Kotlin Multiplatform
MIT License
io.github.gmazzo.codeowners.jvm
pluginPropagates CODEOWNERS to JVM classes, by generating a package-level .codeowners
resource files.
[!NOTE] This plugin aggregates the
io.github.gmazzo.codeowners
plugin, so you don't need to apply it too.
This plugin is mean to work at JVM level: compatible with java
, groovy
and kotlin
and Android.
The plugin binds by default on the compilation toolchain, inspecting the source folders and generating a set of java .codeowners
resources that later the provided xxx.codeowners
function will use to resolve the ownership information (or getCodeOwners
on Java, see Usage)
You can later query its ownership information as described at Usage.
The plugin will do its best to provide a reliable owners attribution on classes, even by inspecting dependencies looking for collision of packages.
For instance, multiple source folders
src/main/java/com/test/myapp/aaa
src/main/kotlin/com/test/myapp/bbb
may be contributing to the same com.test.myapp
package.
If you .CODEOWNERS
file looks similar to this:
aaaOwner src/*/java
bbbOwner src/*/kotlin
The final owners for classes located at the given package will be:
pacakge | owners |
---|---|
com.test.myapp |
aaaOwner and bbbOwner
|
com.test.myapp.aaa |
aaaOwner |
com.test.myapp.bbb |
bbbOwner |
Given the known limitations on the JVM resources approach, here is a list tips to have a 100% owners attributes accuracy:
SourceSet
s (Java)You can use the codeOwners.enabled
property to configure it.
For instance, the following code will disable it for the test
source set:
sourceSets.test {
codeOwners.enabled = false
}
Variant
s (Android)You can use the codeOwners.enabled
property to configure it.
For instance, the following code will enable it only for variants of debug
build type:
androidComponents.onVariants { variant ->
variant.codeOwners.enabled = false
}