mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
First Phase 2 verb wired through to the Android App Functions runtime so
Gemini (and other system agents) can drive Amethyst.
Scope is intentionally narrow:
* One read-only verb (searchProfiles), built on top of the existing
SearchActions in commons. No write verbs yet — they need a story
for NIP-46 / NIP-55 signer prompts from a background dispatcher.
* Play channel only. appfunctions 1.0.0-alpha09 is a Google AI alpha;
F-Droid builds continue to ship without any Google AI dependencies.
Architecture:
* AmethystAppFunctions — plain Kotlin host with @AppFunction methods.
The KSP-driven appfunctions-compiler discovers them and generates
the dispatch metadata XML at build time.
* PlayAmethyst — play-only Application subclass implementing
AppFunctionConfiguration.Provider; supplies the factory the
library uses to construct the host class. Manifest replaces
android:name in the play flavor only; F-Droid keeps the unmodified
Amethyst class.
* The androidx-provided PlatformAppFunctionService is registered in
the play manifest as the bind point — Amethyst doesn't ship a
custom Service.
KSP is now a project-wide plugin (apply false at the root); applied in
amethyst/ to run the appfunctions-compiler over the play sourceSet.
Amethyst becomes `open class` so PlayAmethyst can extend it. No other
behavior change.
91 lines
2.8 KiB
Kotlin
91 lines
2.8 KiB
Kotlin
import com.diffplug.gradle.spotless.SpotlessExtensionPredeclare
|
|
|
|
plugins {
|
|
alias(libs.plugins.androidApplication) apply false
|
|
alias(libs.plugins.androidLibrary) apply false
|
|
alias(libs.plugins.jetbrainsKotlinJvm) apply false
|
|
alias(libs.plugins.androidBenchmark) apply false
|
|
alias(libs.plugins.diffplugSpotless)
|
|
alias(libs.plugins.googleServices) apply false
|
|
alias(libs.plugins.jetbrainsComposeCompiler) apply false
|
|
alias(libs.plugins.composeMultiplatform) apply false
|
|
alias(libs.plugins.kotlinMultiplatform) apply false
|
|
alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false
|
|
alias(libs.plugins.serialization)
|
|
alias(libs.plugins.googleKsp) apply false
|
|
}
|
|
|
|
// Shared app version for all subprojects — read from gradle/libs.versions.toml.
|
|
// Android versionCode stays local in amethyst/build.gradle.kts (must be monotonic int).
|
|
// Desktop packageVersion inherits via project.version in desktopApp/build.gradle.kts.
|
|
val appVersion = libs.versions.app.get()
|
|
|
|
allprojects {
|
|
version = appVersion
|
|
|
|
configurations.configureEach {
|
|
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
|
|
}
|
|
|
|
apply(plugin = "com.diffplug.spotless")
|
|
|
|
if (project === rootProject) {
|
|
spotless {
|
|
predeclareDeps()
|
|
}
|
|
configure<SpotlessExtensionPredeclare> {
|
|
kotlin {
|
|
ktlint("1.7.1")
|
|
}
|
|
}
|
|
} else {
|
|
spotless {
|
|
kotlin {
|
|
target("src/**/*.kt")
|
|
|
|
ktlint("1.7.1")
|
|
licenseHeaderFile(
|
|
rootProject.file(".spotless/copyright.kt"),
|
|
"@file:|package|import|class|object|sealed|open|interface|abstract ",
|
|
)
|
|
}
|
|
|
|
kotlinGradle {
|
|
target("*.gradle.kts")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
afterEvaluate {
|
|
try {
|
|
tasks.named("preBuild") {
|
|
dependsOn("spotlessApply")
|
|
}
|
|
} catch (ignored: UnknownTaskException) {
|
|
tasks.matching {
|
|
it.name.startsWith("pre") && it.name.endsWith("Build")
|
|
}.configureEach {
|
|
dependsOn("spotlessApply")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
val installGitHook = tasks.register<Copy>("installGitHook") {
|
|
val dotGit = File(rootProject.rootDir, ".git")
|
|
val hooksDir: File = if (dotGit.isFile) {
|
|
// Git worktree: .git is a file with "gitdir: <path>"
|
|
val gitDir = File(dotGit.readText().trim().replace("gitdir: ", ""))
|
|
File(gitDir, "hooks")
|
|
} else {
|
|
File(dotGit, "hooks")
|
|
}
|
|
from(File(rootProject.rootDir, ".git-hooks/pre-commit"))
|
|
from(File(rootProject.rootDir, ".git-hooks/pre-push"))
|
|
into(hooksDir)
|
|
filePermissions { unix("0777") }
|
|
}
|
|
tasks.getByPath(":amethyst:preBuild").dependsOn(installGitHook)
|