fix(android): fix uniffi bindgen (#11500)
This commit is contained in:
@@ -83,3 +83,7 @@ codegen-units = 1
|
|||||||
lto = true
|
lto = true
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
strip = "symbols"
|
strip = "symbols"
|
||||||
|
|
||||||
|
# android uniffi bindgen requires symbols
|
||||||
|
[profile.release.package.affine_mobile_native]
|
||||||
|
strip = "none"
|
||||||
@@ -38,6 +38,8 @@ proguard/
|
|||||||
# Android Studio captures folder
|
# Android Studio captures folder
|
||||||
captures/
|
captures/
|
||||||
|
|
||||||
|
.kotlin/
|
||||||
|
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
*.iml
|
*.iml
|
||||||
.idea/workspace.xml
|
.idea/workspace.xml
|
||||||
@@ -89,9 +91,6 @@ lint/tmp/
|
|||||||
# Android Profiling
|
# Android Profiling
|
||||||
*.hprof
|
*.hprof
|
||||||
|
|
||||||
# Cordova plugins for Capacitor
|
|
||||||
capacitor-cordova-android-plugins
|
|
||||||
|
|
||||||
# Copied web assets
|
# Copied web assets
|
||||||
app/src/main/assets/public
|
app/src/main/assets/public
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ cargo {
|
|||||||
module = "../../../../mobile-native"
|
module = "../../../../mobile-native"
|
||||||
libname = "affine_mobile_native"
|
libname = "affine_mobile_native"
|
||||||
targets = ["arm64"]
|
targets = ["arm64"]
|
||||||
pythonCommand = "python3.12"
|
pythonCommand = "python3"
|
||||||
targetDirectory = "../../../../../../target"
|
targetDirectory = "../../../../../../target"
|
||||||
apiLevel = 28
|
apiLevel = 28
|
||||||
targetIncludes = ["libaffine_mobile_native.so"]
|
targetIncludes = ["libaffine_mobile_native.so"]
|
||||||
@@ -125,7 +125,7 @@ android.applicationVariants.configureEach { variant ->
|
|||||||
def t = tasks.register("generate${variant.name.capitalize()}UniFFIBindings", Exec) {
|
def t = tasks.register("generate${variant.name.capitalize()}UniFFIBindings", Exec) {
|
||||||
workingDir "${project.projectDir}"
|
workingDir "${project.projectDir}"
|
||||||
// Runs the bindings generation, note that you must have uniffi-bindgen installed and in your PATH environment variable
|
// Runs the bindings generation, note that you must have uniffi-bindgen installed and in your PATH environment variable
|
||||||
commandLine "${System.getenv("CARGO_HOME")}/bin/cargo", 'run', '--bin', 'uniffi-bindgen', 'generate', '--library', "${buildDir}/rustJniLibs/android/arm64-v8a/libaffine_mobile_native.so", '--language', 'kotlin', '--out-dir', "${project.projectDir}/src/main/java"
|
commandLine "cargo", 'run', '--bin', 'uniffi-bindgen', 'generate', '--library', "${buildDir}/rustJniLibs/android/arm64-v8a/libaffine_mobile_native.so", '--language', 'kotlin', '--out-dir', "${project.projectDir}/src/main/java"
|
||||||
dependsOn("cargoBuild")
|
dependsOn("cargoBuild")
|
||||||
}
|
}
|
||||||
variant.javaCompileProvider.get().dependsOn(t)
|
variant.javaCompileProvider.get().dependsOn(t)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -39,4 +39,4 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
ext {
|
||||||
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
||||||
|
cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '10.1.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:8.7.2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "capacitor.cordova.android.plugins"
|
||||||
|
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
||||||
|
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_21
|
||||||
|
targetCompatibility JavaVersion.VERSION_21
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
flatDir{
|
||||||
|
dirs 'src/main/libs', 'libs'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])
|
||||||
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||||
|
implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
|
||||||
|
// SUB-PROJECT DEPENDENCIES START
|
||||||
|
|
||||||
|
// SUB-PROJECT DEPENDENCIES END
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN GRADLE EXTENSIONS START
|
||||||
|
apply from: "cordova.variables.gradle"
|
||||||
|
// PLUGIN GRADLE EXTENSIONS END
|
||||||
|
|
||||||
|
for (def func : cdvPluginPostBuildExtras) {
|
||||||
|
func()
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||||
|
ext {
|
||||||
|
cdvMinSdkVersion = project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
||||||
|
// Plugin gradle extensions can append to this to have code run at the end.
|
||||||
|
cdvPluginPostBuildExtras = []
|
||||||
|
cordovaConfig = [:]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:amazon="http://schemas.amazon.com/apk/res/android">
|
||||||
|
<application >
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -5,7 +5,8 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "affine bundle",
|
"build": "affine bundle",
|
||||||
"dev": "affine bundle --dev"
|
"dev": "affine bundle --dev",
|
||||||
|
"studio": "cap open android"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
|
|||||||
Reference in New Issue
Block a user