Files
app/plugins/sample-hello/build.gradle.kts
T
Cursor Agent b2ef7be57a Add Kotlin plugin system (SDK, host, hooks, settings UI)
Implement exteraGram-style plugin architecture for Android and desktop:
- plugins/sdk: BasePlugin API, hook types, settings DSL
- plugins/host: PluginEngine, typed send hooks, FeatureGate, HookRegistry
- JVM ByteBuddy and Android Pine hook backends
- DevServer on port 42690 (JVM)
- Plugins settings screens and PluginUiHost bulletin overlay
- hello_world sample plugin packaged as .fcplugin
- ProGuard keepnames for ru.fromchat.** with shrinking enabled

Co-authored-by: denis0001-dev <denis0001.dev@ya.ru>
2026-09-16 22:15:42 +00:00

63 lines
2.0 KiB
Kotlin

plugins {
kotlin("jvm")
}
dependencies {
implementation(project(":plugins:sdk"))
}
tasks.register("packageFcPlugin") {
group = "plugins"
description = "Build hello_world.fcplugin with desktop JAR"
dependsOn(tasks.named("compileKotlin"))
doLast {
val buildDir = layout.buildDirectory.get().asFile
val staging = buildDir.resolve("fcplugin-staging")
staging.deleteRecursively()
staging.mkdirs()
staging.resolve("desktop").mkdirs()
staging.resolve("android").mkdirs()
val jvmClasses = buildDir.resolve("classes/kotlin/main")
val jarFile = staging.resolve("desktop/plugin.jar")
val jarProcess = ProcessBuilder(
"jar",
"cf",
jarFile.absolutePath,
"-C",
jvmClasses.absolutePath,
".",
).inheritIO().start()
check(jarProcess.waitFor() == 0) { "jar failed" }
staging.resolve("manifest.json").writeText(
"""
{
"id": "hello_world",
"name": "Hello World",
"description": "Rewrites .hello commands into a friendly greeting",
"author": "FromChat",
"version": "1.0.0",
"app_version": ">=1.0.0",
"sdk_version": ">=1.0.0",
"entry_class": "ru.fromchat.plugins.sample.hello.HelloWorldPlugin",
"artifacts": {
"android": "android/plugin.dex",
"desktop": "desktop/plugin.jar"
}
}
""".trimIndent(),
)
val archive = buildDir.resolve("distributions/hello_world.fcplugin")
archive.parentFile.mkdirs()
if (archive.exists()) archive.delete()
val zipProcess = ProcessBuilder("zip", "-r", archive.absolutePath, ".")
.directory(staging)
.inheritIO()
.start()
check(zipProcess.waitFor() == 0) { "zip failed" }
println("Created ${archive.absolutePath}")
}
}