Further work and debugging on plugin integration

This commit is contained in:
grimsi
2024-10-11 10:18:48 +02:00
parent bfcd3d83c9
commit cc6056fce8
12 changed files with 158 additions and 78 deletions
+55
View File
@@ -0,0 +1,55 @@
val pluginDir: File by rootProject.extra
plugins {
kotlin("jvm")
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
dependencies {
implementation(project(":plugin-api"))
}
tasks.register<Jar>("plugin") {
archiveBaseName.set("plugin-${project.name}")
// first taking the classes generated by the jar task
into("classes") {
with(tasks.named<Jar>("jar").get())
}
// and then we also need to include any libraries that are needed by the plugin
dependsOn(configurations.runtimeClasspath)
into("lib") {
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }
})
}
archiveExtension.set("jar")
}
tasks.register<Copy>("assemblePlugin") {
from(project.tasks.named("plugin"))
into(pluginDir)
}
tasks.jar {
manifest {
from("./src/main/resources/MANIFEST.MF")
}
}
tasks.named("build") {
dependsOn(tasks.named("plugin"))
}
}
tasks.register<Copy>("assemblePlugins") {
dependsOn(subprojects.map { it.tasks.named("assemblePlugin") })
}
tasks {
"build" {
dependsOn(named("assemblePlugins"))
}
}
+2 -19
View File
@@ -1,24 +1,7 @@
plugins {
kotlin("jvm")
id("kotlin-kapt")
}
group = "de.grimsi.gameyfin.plugins"
repositories {
mavenCentral()
id("com.google.devtools.ksp") version "2.0.20-1.0.24"
}
dependencies {
implementation(project(":plugin-api"))
}
tasks.jar {
manifest {
from("./src/main/resources/MANIFEST.MF")
}
}
tasks.test {
useJUnitPlatform()
ksp("care.better.pf4j:pf4j-kotlin-symbol-processing:2.0.20-1.0.1")
}
@@ -1,35 +1,48 @@
package de.grimsi.gameyfin.plugins.igdb
import de.grimsi.gameyfin.pluginapi.gamemetadata.GameMetadata
import de.grimsi.gameyfin.pluginapi.gamemetadata.GameMetadataPlugin
import de.grimsi.gameyfin.pluginapi.gamemetadata.GameMetadataFetcher
import org.pf4j.Extension
import org.pf4j.Plugin
import org.pf4j.PluginWrapper
import java.time.Instant
@Extension
class IgdbPlugin : GameMetadataPlugin {
override fun getConfig(): Map<String, String> {
TODO("Not yet implemented")
class IgdbPlugin(wrapper: PluginWrapper) : Plugin(wrapper) {
override fun start() {
println("IgdbPlugin.start()")
}
override fun setConfig(config: Map<String, String>) {
TODO("Not yet implemented")
override fun stop() {
println("IgdbPlugin.stop()")
}
override fun fetchMetadata(gameId: String): GameMetadata {
return GameMetadata(
title = "Test Game",
description = "This is a test game",
release = Instant.now(),
userRating = 0,
criticRating = 0,
developedBy = listOf("Test Developer"),
publishedBy = listOf("Test Publisher"),
genres = listOf(),
themes = listOf(),
screenshotUrls = listOf(),
videoUrls = listOf(),
features = listOf(),
perspectives = listOf()
)
@Extension
class IgdbMetadataFetcher : GameMetadataFetcher {
override fun getConfig(): Map<String, String> {
TODO("Not yet implemented")
}
override fun setConfig(config: Map<String, String>) {
TODO("Not yet implemented")
}
override fun fetchMetadata(gameId: String): GameMetadata {
return GameMetadata(
title = "Test Game",
description = "This is a test game",
release = Instant.now(),
userRating = 0,
criticRating = 0,
developedBy = listOf("Test Developer"),
publishedBy = listOf("Test Publisher"),
genres = listOf(),
themes = listOf(),
screenshotUrls = listOf(),
videoUrls = listOf(),
features = listOf(),
perspectives = listOf()
)
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
Plugin-Id: igdb
Plugin-Class: de.grimsi.gameyfin.plugins.igdb.IgdbPlugin
Plugin-Version: 1.0.0
Plugin-Version: 1.0.0-SNAPSHOT
Plugin-Provider: grimsi