Refactor Java to shared kotlin

This commit is contained in:
James Babcock committed 2026-09-18 22:48:20 -07:00
1 parent bc8e80c533
commit 68810197a8
173 files changed
+9855 -6252

No files matched your search

+19
View File
@@ -262,6 +262,7 @@ android {
sourceSets.main {
jniLibs.srcDirs += ["$projectDir/src/main/jniLibs"]
// Shared Kotlin is packaged by the local @faceclaw/kotlin plugin.
}
defaultConfig {
@@ -288,7 +289,25 @@ android {
}
}
// NativeScript can retain deleted App_Resources sources in its generated
// project. Remove the former copy before Kotlin compilation after this move.
def removeLegacyKotlinBridgeSource = tasks.register("removeLegacyKotlinBridgeSource", Delete) {
delete file("$projectDir/src/main/java/com/faceclaw/shared/KotlinBridge.kt")
// Explicit, reviewed source moves: never infer deletions from class names.
def migrations = new groovy.json.JsonSlurper().parse(file("$rootDir/../../native/kotlin/migrated-java-sources.json"))
migrations.each { migration ->
if (!file("$rootDir/../../native/kotlin/${migration.kotlin}").isFile()) {
throw new GradleException("Missing Kotlin replacement: ${migration.kotlin}")
}
delete file("$projectDir/src/main/java/${migration.java}")
}
}
tasks.matching { it.name.startsWith("compile") && it.name.endsWith("Kotlin") }.configureEach {
dependsOn removeLegacyKotlinBridgeSource
}
tasks.matching { it.name == "preBuild" }.configureEach {
dependsOn removeLegacyKotlinBridgeSource
dependsOn tasks.named("prepareFaceclawNativeLibs")
dependsOn tasks.named("prepareFaceclawLlama")
}