-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/src/commonMain/kotlin/io/github/gmazzo/codeowners/CodeOwner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.gmazzo.codeowners | ||
|
||
@Repeatable | ||
@Retention(AnnotationRetention.RUNTIME) | ||
annotation class CodeOwner( | ||
val value: String | ||
) |
10 changes: 10 additions & 0 deletions
10
core/src/commonMain/kotlin/io/github/gmazzo/codeowners/CodeOwners.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.github.gmazzo.codeowners | ||
|
||
import kotlin.reflect.KClass | ||
|
||
inline fun <reified Type> codeOwnersOf() = | ||
Type::class.codeOwners | ||
|
||
expect val KClass<*>.codeOwners: Set<String> | ||
|
||
expect val Throwable.codeOwners: Set<String> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
core/src/nonJvmMain/kotlin/io/github/gmazzo/codeowners/CodeOwners.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.github.gmazzo.codeowners | ||
|
||
import kotlin.reflect.KClass | ||
|
||
actual val KClass<*>.codeOwners: Set<String> | ||
get() = annotations.asSequence() | ||
.filterIsInstance<CodeOwner>() | ||
.map { it.value } | ||
|
||
actual val Throwable.codeOwners: Set<String> | ||
get() = this::class.codeOwners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters