@@ -2,19 +2,19 @@ import groovy.json.JsonSlurper
22
33plugins {
44 alias(libs.plugins.android.library)
5- alias(libs.plugins.kotlin.android)
65 alias(libs.plugins.kotlin.compose)
76 alias(libs.plugins.rust.android)
87}
98
109android {
1110 namespace = " rs.clash.android.ffi"
12- compileSdk = 36
11+ compileSdk = 37
1312
1413 ndkVersion = rootProject.extra[" ndkVersion" ] as String
14+ buildToolsVersion = rootProject.extra[" buildToolsVersion" ] as String
1515 defaultConfig {
1616 minSdk = 23
17-
17+ compileSdk = 37
1818 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
1919 }
2020
@@ -28,6 +28,15 @@ android {
2828 }
2929}
3030
31+ androidComponents {
32+ onVariants { variant ->
33+ val variantName = variant.name.replaceFirstChar(Char ::titlecase)
34+ tasks
35+ .matching { it.name == " compile${variantName} Kotlin" || it.name == " compile${variantName} JavaWithJavac" }
36+ .configureEach { dependsOn(" cargoBuild" ) }
37+ }
38+ }
39+
3140kotlin {
3241 jvmToolchain(25 )
3342}
@@ -62,21 +71,3 @@ cargo {
6271 profile = " release"
6372}
6473
65- android {
66- buildToolsVersion = rootProject.extra[" buildToolsVersion" ] as String
67- compileOptions {
68- sourceCompatibility = JavaVersion .VERSION_25
69- targetCompatibility = JavaVersion .VERSION_25
70- }
71- libraryVariants.all {
72- val variantName = name.replaceFirstChar(Char ::titlecase)
73-
74- // Make Java compilation depend on generating UniFFI bindings
75- javaCompileProvider.get().dependsOn(" cargoBuild" )
76-
77- // Also hook into Kotlin compilation
78- tasks.named(" compile${variantName} Kotlin" ).configure {
79- dependsOn(" cargoBuild" )
80- }
81- }
82- }
0 commit comments