Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hfhbd/serviceloader
https://github.com/hfhbd/serviceloader
Last synced: about 4 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/hfhbd/serviceloader
- Owner: hfhbd
- License: apache-2.0
- Created: 2023-01-16T20:54:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T00:24:00.000Z (1 day ago)
- Last Synced: 2024-11-18T01:26:05.017Z (1 day ago)
- Language: Kotlin
- Size: 480 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# serviceloader
A Kotlin compiler and ksp plugin that generate and validate your service providers.
The Kotlin compiler plugin does not support Java source code. In this case, you need to use the ksp plugin.
## Usage
This plugin is uploaded to mavenCentral, so you need to add `mavenCentral()` to your plugin repositories:
```kotlin
// settings.gradle.kts
pluginManagement {
repositories {
mavenCentral()
}
}
```### Use as Kotlin compiler plugin
Apply the Kotlin compiler plugin.
```kotlin
// build.gradle.ktsplugins {
id("app.softwork.serviceloader-compiler") version "LATEST"
}
```You might also want to enable the compiler plugin in IntelliJ by setting `kotlin.k2.only.bundled.compiler.plugins.enabled` to `false` in the registry.
### Use with ksp
Apply the ksp plugin.
```kotlin
// build.gradle.ktsplugins {
id("com.google.devtools.ksp")
id("app.softwork.serviceloader") version "LATEST"
}
```## Annotate the code
And use the `app.softwork.serviceloader.ServiceLoader` annotation:
```kotlin
import app.softwork.serviceloader.ServiceLoaderinterface Provider
@ServiceLoader(Provider::class)
class Impl : Provider
```## License
Apache 2.0