mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-25 07:07:32 -04:00
Android vscode workflow (#912)
* fix: fix linux build * Merge pull request #599 from AppFlowy-IO/refactor/grid_decode_cell_data Refactor/grid decode cell data * feat: ⭐ configured android vscode workflow * chore: clean up android vscode * fix: fixed typo * chore: remove unused code Co-authored-by: Nathan.fooo <86001920+appflowy@users.noreply.github.com> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
parent
70f9a289a4
commit
69e3aed6b5
27 changed files with 287 additions and 36 deletions
38
frontend/.vscode/launch.json
vendored
38
frontend/.vscode/launch.json
vendored
|
@ -16,6 +16,18 @@
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceRoot}/app_flowy"
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// This task builds the Rust and Dart code of AppFlowy for android.
|
||||||
|
"name": "AF: Run Android",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "./lib/main.dart",
|
||||||
|
"type": "dart",
|
||||||
|
"preLaunchTask": "AF: build_mobile_sdk",
|
||||||
|
"env": {
|
||||||
|
"RUST_LOG": "info"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "AF: Debug Rust",
|
"name": "AF: Debug Rust",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
|
@ -48,6 +60,21 @@
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceRoot}/app_flowy"
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// This task builds will:
|
||||||
|
// - call the clean task,
|
||||||
|
// - rebuild all the generated Files (including freeze and language files)
|
||||||
|
// - rebuild the the Rust and Dart code of AppFlowy.
|
||||||
|
"name": "AF: Clean + Rebuild All (Android)",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "./lib/main.dart",
|
||||||
|
"type": "dart",
|
||||||
|
"preLaunchTask": "AF: Clean + Rebuild All (Android)",
|
||||||
|
"env": {
|
||||||
|
"RUST_LOG": "info"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "AF: Build All (rustlog: trace)",
|
"name": "AF: Build All (rustlog: trace)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
@ -59,6 +86,17 @@
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceRoot}/app_flowy"
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "AF: Build All Android (rustlog: trace)",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "./lib/main.dart",
|
||||||
|
"type": "dart",
|
||||||
|
"preLaunchTask": "AF: build_mobile_sdk",
|
||||||
|
"env": {
|
||||||
|
"RUST_LOG": "trace"
|
||||||
|
},
|
||||||
|
"cwd": "${workspaceRoot}/app_flowy"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "AF: app_flowy (profile mode)",
|
"name": "AF: app_flowy (profile mode)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
|
27
frontend/.vscode/tasks.json
vendored
27
frontend/.vscode/tasks.json
vendored
|
@ -27,6 +27,33 @@
|
||||||
"panel": "new"
|
"panel": "new"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "AF: Clean + Rebuild All (Android)",
|
||||||
|
"type": "shell",
|
||||||
|
"dependsOrder": "sequence",
|
||||||
|
"dependsOn": [
|
||||||
|
"AF: Rust Clean",
|
||||||
|
"AF: Flutter Clean",
|
||||||
|
"AF: build_flowy_sdk_for_android",
|
||||||
|
"AF: Flutter Pub Get",
|
||||||
|
"AF: Flutter Package Get",
|
||||||
|
"AF: Generate Language Files",
|
||||||
|
"AF: Generate Freezed Files",
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "AF: build_flowy_sdk_for_android",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "cargo make --profile development-android flowy-sdk-dev-android",
|
||||||
|
"group": "build",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "AF: build_flowy_sdk",
|
"label": "AF: build_flowy_sdk",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
|
|
@ -161,6 +161,11 @@ TARGET_OS = "ios"
|
||||||
FLUTTER_OUTPUT_DIR = "Release"
|
FLUTTER_OUTPUT_DIR = "Release"
|
||||||
PRODUCT_EXT = "ipa"
|
PRODUCT_EXT = "ipa"
|
||||||
|
|
||||||
|
[env.development-android]
|
||||||
|
BUILD_FLAG = "debug"
|
||||||
|
TARGET_OS = "android"
|
||||||
|
CRATE_TYPE = "cdylib"
|
||||||
|
FLUTTER_OUTPUT_DIR = "Debug"
|
||||||
|
|
||||||
[tasks.setup-crate-type]
|
[tasks.setup-crate-type]
|
||||||
private = true
|
private = true
|
||||||
|
|
64
frontend/app_flowy/android/README.md
Normal file
64
frontend/app_flowy/android/README.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# Description
|
||||||
|
|
||||||
|
This is a guide on how to build the rust SDK for AppFlowy on android.
|
||||||
|
Compiling the sdk is easy it just needs a few tweaks.
|
||||||
|
When compiling for android we need the following pre-requisites:
|
||||||
|
|
||||||
|
- Android NDK Tools. (v24 has been tested).
|
||||||
|
- Cargo NDK. (@latest version).
|
||||||
|
|
||||||
|
**Getting the tools**
|
||||||
|
- Install cargo-ndk ```bash cargo install cargo-ndk```.
|
||||||
|
- [Download](https://developer.android.com/ndk/downloads/) Android NDK version 24.
|
||||||
|
- When downloading Android NDK you can get the compressed version as a standalone from the site.
|
||||||
|
Or you can download it through [Android Studio](https://developer.android.com/studio).
|
||||||
|
- After downloading the two you need to set the environment variables. For Windows that's a seperate process.
|
||||||
|
On MacOs and Linux the process is similar.
|
||||||
|
- The variables needed are '$ANDROID_NDK_HOME', this will point to where the NDK is located.
|
||||||
|
---
|
||||||
|
|
||||||
|
**Cargo Config File**
|
||||||
|
This code needs to be written in ~/.cargo/config, this helps cargo know where to locate the android tools(linker and archiver).
|
||||||
|
**NB** Keep in mind just replace 'user' with your own user name. Or just point it to the location of where you put the NDK.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[target.aarch64-linux-android]
|
||||||
|
ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||||
|
linker = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang"
|
||||||
|
|
||||||
|
[target.armv7-linux-androideabi]
|
||||||
|
ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||||
|
linker = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi29-clang"
|
||||||
|
|
||||||
|
[target.i686-linux-android]
|
||||||
|
ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||||
|
linker = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android29-clang"
|
||||||
|
|
||||||
|
[target.x86_64-linux-android]
|
||||||
|
ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||||
|
linker = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android29-clang"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Clang Fix**
|
||||||
|
In order to get clang to work properly with version 24 you need to create this file.
|
||||||
|
libgcc.a, then add this one line.
|
||||||
|
```
|
||||||
|
INPUT(-lunwind)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Folder path: 'Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux'.**
|
||||||
|
After that you have to copy this file into three different folders namely aarch64, arm, i386 and x86_64.
|
||||||
|
We have to do this so we Android NDK can find clang on our system, if we used NDK 22 we wouldnt have to do this process.
|
||||||
|
Though using NDK v22 will not give us alot of features to work with.
|
||||||
|
This github [issue](https://github.com/fzyzcjy/flutter_rust_bridge/issues/419) explains the reason why we are doing this.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Android NDK**
|
||||||
|
|
||||||
|
After installing the NDK tools for android you should export the PATH to your config file
|
||||||
|
(.vimrc, .zshrc, .profile, .bashrc file), That way it can be found.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
export PATH=/home/sean/Android/Sdk/ndk/24.0.8215888
|
||||||
|
```
|
|
@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
ndkVersion "24.0.8215888"
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
@ -39,21 +40,26 @@ android {
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
main.jniLibs.srcDirs += 'jniLibs/'
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.example.app_flowy"
|
applicationId "com.example.app_flowy"
|
||||||
minSdkVersion 16
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
// TODO: Add your own signing config for the release build.
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,4 +71,5 @@ flutter {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation "com.android.support:multidex:2.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
package="com.example.app_flowy">
|
package="com.example.app_flowy">
|
||||||
<application
|
<application
|
||||||
android:label="app_flowy"
|
android:label="app_flowy"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:name="${applicationName}">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#Fri Jun 23 08:50:38 CEST 2017
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
|
||||||
|
|
|
@ -9,3 +9,19 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||||
|
|
||||||
|
|
||||||
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
|
||||||
|
def plugins = new Properties()
|
||||||
|
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||||
|
|
||||||
|
if(pluginsFile.exists()){
|
||||||
|
pluginsFile.withReader('UTF-8'){reader -> plugins.load(reader)}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.each{name, path ->
|
||||||
|
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||||
|
include ":$name"
|
||||||
|
project(":$name").projectDir = pluginDirectory
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ class _MultiBoardListExampleState extends State<MultiBoardListExample> {
|
||||||
RichTextItem(title: "Card 8", subtitle: 'Aug 1, 2020 4:05 PM'),
|
RichTextItem(title: "Card 8", subtitle: 'Aug 1, 2020 4:05 PM'),
|
||||||
TextItem("Card 9"),
|
TextItem("Card 9"),
|
||||||
];
|
];
|
||||||
|
|
||||||
final column1 = AFBoardColumnData(id: "To Do", name: "To Do", items: a);
|
final column1 = AFBoardColumnData(id: "To Do", name: "To Do", items: a);
|
||||||
final column2 = AFBoardColumnData(
|
final column2 = AFBoardColumnData(
|
||||||
id: "In Progress",
|
id: "In Progress",
|
||||||
|
|
|
@ -2,6 +2,7 @@ group 'com.example.flowy_infra_ui'
|
||||||
version '1.0'
|
version '1.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -24,8 +24,16 @@ if (flutterVersionName == null) {
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
//apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
|
|
||||||
|
//androidExtensions {
|
||||||
|
// experimental = true
|
||||||
|
//}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
compileSdkVersion flutter.compileSdkVersion
|
||||||
|
ndkVersion flutter.ndkVersion
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
@ -43,20 +51,23 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.example.flowy_infra_ui_example"
|
applicationId "com.example.flowy_infra_ui_example"
|
||||||
minSdkVersion 16
|
minSdkVersion flutter.minSdkVersion
|
||||||
targetSdkVersion 30
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
// TODO: Add your own signing config for the release build.
|
// TODO: Add your own signing config for the release build.
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileSdkVersion 30
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
|
@ -65,4 +76,5 @@ flutter {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation 'com.android.support:multidex:2.0.1'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.example.flowy_infra_ui_example;
|
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity;
|
|
||||||
|
|
||||||
public class MainActivity extends FlutterActivity {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -9,3 +9,19 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
|
||||||
|
def plugins = new Properties()
|
||||||
|
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||||
|
if (pluginsFile.exists()) {
|
||||||
|
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.each { name, path ->
|
||||||
|
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||||
|
include ":$name"
|
||||||
|
project(":$name").projectDir = pluginDirectory
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package example.android.app.src.main.java.com.example.flowy_infra_ui_example;
|
||||||
|
|
||||||
|
public class FlutterActivity {
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ group 'com.plugin.flowy_sdk'
|
||||||
version '1.0-SNAPSHOT'
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
|
|
@ -36,7 +36,7 @@ android {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.plugin.flowy_sdk_example"
|
applicationId "com.plugin.flowy_sdk_example"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
|
@ -14,11 +14,14 @@ final DynamicLibrary dl = _dl;
|
||||||
DynamicLibrary _open() {
|
DynamicLibrary _open() {
|
||||||
if (Platform.environment.containsKey('FLUTTER_TEST')) {
|
if (Platform.environment.containsKey('FLUTTER_TEST')) {
|
||||||
final prefix = "${Directory.current.path}/.sandbox";
|
final prefix = "${Directory.current.path}/.sandbox";
|
||||||
if (Platform.isLinux) return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
if (Platform.isLinux)
|
||||||
if (Platform.isAndroid) return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
||||||
|
if (Platform.isAndroid)
|
||||||
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
||||||
if (Platform.isMacOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
if (Platform.isMacOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
||||||
if (Platform.isIOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
if (Platform.isIOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
||||||
if (Platform.isWindows) return DynamicLibrary.open('${prefix}/dart_ffi.dll');
|
if (Platform.isWindows)
|
||||||
|
return DynamicLibrary.open('${prefix}/dart_ffi.dll');
|
||||||
} else {
|
} else {
|
||||||
if (Platform.isLinux) return DynamicLibrary.open('libdart_ffi.so');
|
if (Platform.isLinux) return DynamicLibrary.open('libdart_ffi.so');
|
||||||
if (Platform.isAndroid) return DynamicLibrary.open('libdart_ffi.so');
|
if (Platform.isAndroid) return DynamicLibrary.open('libdart_ffi.so');
|
||||||
|
@ -39,7 +42,8 @@ void async_event(
|
||||||
_invoke_async(port, input, len);
|
_invoke_async(port, input, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _invoke_async_Dart _invoke_async = _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
|
final _invoke_async_Dart _invoke_async =
|
||||||
|
_dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
|
||||||
typedef _invoke_async_C = Void Function(
|
typedef _invoke_async_C = Void Function(
|
||||||
Int64 port,
|
Int64 port,
|
||||||
Pointer<Uint8> input,
|
Pointer<Uint8> input,
|
||||||
|
@ -59,7 +63,8 @@ Pointer<Uint8> sync_event(
|
||||||
return _invoke_sync(input, len);
|
return _invoke_sync(input, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _invoke_sync_Dart _invoke_sync = _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
|
final _invoke_sync_Dart _invoke_sync =
|
||||||
|
_dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
|
||||||
typedef _invoke_sync_C = Pointer<Uint8> Function(
|
typedef _invoke_sync_C = Pointer<Uint8> Function(
|
||||||
Pointer<Uint8> input,
|
Pointer<Uint8> input,
|
||||||
Uint64 len,
|
Uint64 len,
|
||||||
|
@ -76,7 +81,8 @@ int init_sdk(
|
||||||
return _init_sdk(path);
|
return _init_sdk(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _init_sdk_Dart _init_sdk = _dl.lookupFunction<_init_sdk_C, _init_sdk_Dart>('init_sdk');
|
final _init_sdk_Dart _init_sdk =
|
||||||
|
_dl.lookupFunction<_init_sdk_C, _init_sdk_Dart>('init_sdk');
|
||||||
typedef _init_sdk_C = Int64 Function(
|
typedef _init_sdk_C = Int64 Function(
|
||||||
Pointer<ffi.Utf8> path,
|
Pointer<ffi.Utf8> path,
|
||||||
);
|
);
|
||||||
|
@ -90,7 +96,8 @@ int set_stream_port(int port) {
|
||||||
}
|
}
|
||||||
|
|
||||||
final _set_stream_port_Dart _set_stream_port =
|
final _set_stream_port_Dart _set_stream_port =
|
||||||
_dl.lookupFunction<_set_stream_port_C, _set_stream_port_Dart>('set_stream_port');
|
_dl.lookupFunction<_set_stream_port_C, _set_stream_port_Dart>(
|
||||||
|
'set_stream_port');
|
||||||
|
|
||||||
typedef _set_stream_port_C = Int32 Function(
|
typedef _set_stream_port_C = Int32 Function(
|
||||||
Int64 port,
|
Int64 port,
|
||||||
|
@ -104,8 +111,8 @@ void link_me_please() {
|
||||||
_link_me_please();
|
_link_me_please();
|
||||||
}
|
}
|
||||||
|
|
||||||
final _link_me_please_Dart _link_me_please =
|
final _link_me_please_Dart _link_me_please = _dl
|
||||||
_dl.lookupFunction<_link_me_please_C, _link_me_please_Dart>('link_me_please');
|
.lookupFunction<_link_me_please_C, _link_me_please_Dart>('link_me_please');
|
||||||
typedef _link_me_please_C = Void Function();
|
typedef _link_me_please_C = Void Function();
|
||||||
typedef _link_me_please_Dart = void Function();
|
typedef _link_me_please_Dart = void Function();
|
||||||
|
|
||||||
|
@ -116,8 +123,9 @@ void store_dart_post_cobject(
|
||||||
_store_dart_post_cobject(ptr);
|
_store_dart_post_cobject(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _store_dart_post_cobject_Dart _store_dart_post_cobject =
|
final _store_dart_post_cobject_Dart _store_dart_post_cobject = _dl
|
||||||
_dl.lookupFunction<_store_dart_post_cobject_C, _store_dart_post_cobject_Dart>('store_dart_post_cobject');
|
.lookupFunction<_store_dart_post_cobject_C, _store_dart_post_cobject_Dart>(
|
||||||
|
'store_dart_post_cobject');
|
||||||
typedef _store_dart_post_cobject_C = Void Function(
|
typedef _store_dart_post_cobject_C = Void Function(
|
||||||
Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>> ptr,
|
Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>> ptr,
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,3 +6,19 @@ rustflags=["-C", "link-arg=-mmacosx-version-min=10.11"]
|
||||||
|
|
||||||
[target.aarch64-apple-darwin]
|
[target.aarch64-apple-darwin]
|
||||||
rustflags=["-C", "link-arg=-mmacosx-version-min=10.11"]
|
rustflags=["-C", "link-arg=-mmacosx-version-min=10.11"]
|
||||||
|
|
||||||
|
[target.aarch64-linux-android]
|
||||||
|
ar = "path-to-ndk/llvm-ar"
|
||||||
|
linker = "path-to-ndk/aarch64-linux-android29-clang"
|
||||||
|
|
||||||
|
[target.armv7-linux-androideabi]
|
||||||
|
ar = "path-to-ndk/llvm-ar"
|
||||||
|
linker = "path-to-ndk/armv7a-linux-androideabi29-clang"
|
||||||
|
|
||||||
|
[target.i686-linux-android]
|
||||||
|
ar = "path-to-ndk/llvm-ar"
|
||||||
|
linker = "path-to-ndk/i686-linux-android29-clang"
|
||||||
|
|
||||||
|
[target.x86_64-linux-android]
|
||||||
|
ar = "path-to-ndk/llvm-ar"
|
||||||
|
linker = "path-to-ndk/x86_64-linux-android29-clang"
|
11
frontend/rust-lib/Cargo.lock
generated
11
frontend/rust-lib/Cargo.lock
generated
|
@ -1796,6 +1796,7 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libsqlite3-sys",
|
"libsqlite3-sys",
|
||||||
"log",
|
"log",
|
||||||
|
"openssl",
|
||||||
"r2d2",
|
"r2d2",
|
||||||
"scheduled-thread-pool",
|
"scheduled-thread-pool",
|
||||||
]
|
]
|
||||||
|
@ -2096,6 +2097,15 @@ version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-src"
|
||||||
|
version = "111.22.0+1.1.1q"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.72"
|
version = "0.9.72"
|
||||||
|
@ -2105,6 +2115,7 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
"openssl-src",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,6 +15,6 @@ lazy_static = "1.4.0"
|
||||||
scheduled-thread-pool = "0.2.5"
|
scheduled-thread-pool = "0.2.5"
|
||||||
error-chain = "=0.12.0"
|
error-chain = "=0.12.0"
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
|
openssl = { version = "0.10.38", features = ["vendored"] }
|
||||||
#[features]
|
#[features]
|
||||||
#windows = ["libsqlite3-sys/bundled-windows"]
|
#windows = ["libsqlite3-sys/bundled-windows"]
|
|
@ -13,6 +13,11 @@ mac_alias = "flowy-sdk-dev-macos"
|
||||||
windows_alias = "flowy-sdk-dev-windows"
|
windows_alias = "flowy-sdk-dev-windows"
|
||||||
linux_alias = "flowy-sdk-dev-linux"
|
linux_alias = "flowy-sdk-dev-linux"
|
||||||
|
|
||||||
|
[tasks.flowy-sdk-dev-android]
|
||||||
|
category = "Build"
|
||||||
|
dependencies = ["env_check"]
|
||||||
|
run_task = { name = ["setup-crate-type","sdk-build-android", "restore-crate-type"] }
|
||||||
|
|
||||||
[tasks.flowy-sdk-dev-macos]
|
[tasks.flowy-sdk-dev-macos]
|
||||||
category = "Build"
|
category = "Build"
|
||||||
dependencies = ["env_check"]
|
dependencies = ["env_check"]
|
||||||
|
@ -42,6 +47,32 @@ script = [
|
||||||
]
|
]
|
||||||
script_runner = "@shell"
|
script_runner = "@shell"
|
||||||
|
|
||||||
|
[tasks.sdk-build-android]
|
||||||
|
private = true
|
||||||
|
script = [
|
||||||
|
"""
|
||||||
|
cd rust-lib/
|
||||||
|
rustup show
|
||||||
|
rustup target add aarch64-linux-android \
|
||||||
|
armv7-linux-androideabi \
|
||||||
|
i686-linux-android \
|
||||||
|
x86_64-linux-android
|
||||||
|
DEST=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/android/app/src/main/jniLibs
|
||||||
|
rm -rf $DEST/arm64-v8a \
|
||||||
|
$DEST/armeabi-v7a \
|
||||||
|
$DEST/x86 \
|
||||||
|
$DEST/x86_64
|
||||||
|
cargo ndk \
|
||||||
|
-t arm64-v8a \
|
||||||
|
-t armeabi-v7a \
|
||||||
|
-t x86 \
|
||||||
|
-t x86_64 \
|
||||||
|
-o $DEST build
|
||||||
|
cd ../
|
||||||
|
""",
|
||||||
|
]
|
||||||
|
script_runner = "@shell"
|
||||||
|
|
||||||
[tasks.sdk-build.windows]
|
[tasks.sdk-build.windows]
|
||||||
private = true
|
private = true
|
||||||
script = [
|
script = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue