forked from Blendman974/faceclaw
Move Kotlin shared code
This commit is contained in:
1 parent
1e1c3f799d
commit
c0f8f7e9c2
2 files changed
+19
-1
No files matched your search
@@ -255,6 +255,10 @@ def faceclawVersionCode = {
|
|||||||
return parts[0] * 10000 + parts[1] * 100 + parts[2]
|
return parts[0] * 10000 + parts[1] * 100 + parts[2]
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// ios-port packages commonMain in an AAR. Keeping this conditional lets the
|
||||||
|
// source relocation merge there without compiling the shared classes twice.
|
||||||
|
def faceclawDependencies = new groovy.json.JsonSlurper().parse(file("$rootDir/../../package.json")).dependencies ?: [:]
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 35
|
compileSdkVersion 35
|
||||||
buildToolsVersion "35"
|
buildToolsVersion "35"
|
||||||
@@ -262,6 +266,11 @@ android {
|
|||||||
|
|
||||||
sourceSets.main {
|
sourceSets.main {
|
||||||
jniLibs.srcDirs += ["$projectDir/src/main/jniLibs"]
|
jniLibs.srcDirs += ["$projectDir/src/main/jniLibs"]
|
||||||
|
// Keep portable Kotlin at the same path as ios-port's KMP commonMain.
|
||||||
|
// main compiles it directly with the existing Android Kotlin plugin.
|
||||||
|
if (!faceclawDependencies.containsKey("@faceclaw/kotlin")) {
|
||||||
|
java.srcDirs += ["$rootDir/../../native/kotlin/shared/src/commonMain/kotlin"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -288,6 +297,15 @@ 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")
|
||||||
|
}
|
||||||
|
tasks.matching { it.name.startsWith("compile") && it.name.endsWith("Kotlin") }.configureEach {
|
||||||
|
dependsOn removeLegacyKotlinBridgeSource
|
||||||
|
}
|
||||||
|
|
||||||
tasks.matching { it.name == "preBuild" }.configureEach {
|
tasks.matching { it.name == "preBuild" }.configureEach {
|
||||||
dependsOn tasks.named("prepareFaceclawNativeLibs")
|
dependsOn tasks.named("prepareFaceclawNativeLibs")
|
||||||
dependsOn tasks.named("prepareFaceclawLlama")
|
dependsOn tasks.named("prepareFaceclawLlama")
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ interface KotlinBridgeListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First step toward commonMain: only portable Kotlin, with no Android/JVM APIs.
|
* Portable Kotlin at the same commonMain source path used by ios-port.
|
||||||
* Calls and callbacks are synchronous on the caller's thread. The listener is
|
* Calls and callbacks are synchronous on the caller's thread. The listener is
|
||||||
* used only during roundTrip and is never retained.
|
* used only during roundTrip and is never retained.
|
||||||
*/
|
*/
|
||||||
Reference in new issue
Block a user