chore: add tauri build config (#1717)

Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
Nathan.fooo 2023-01-17 21:54:25 +08:00 committed by GitHub
parent f64346c955
commit ceb39a4fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 46 deletions

View File

@ -4,9 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
// This task only builds the Dart code of AppFlowy.
"name": "AF-desktop: Build Dart Only",
"request": "launch",
"program": "./lib/main.dart",
"type": "dart",
"env": {
"RUST_LOG": "debug"
},
"cwd": "${workspaceRoot}/app_flowy"
},
{ {
// This task builds the Rust and Dart code of AppFlowy. // This task builds the Rust and Dart code of AppFlowy.
"name": "AF: Build All", "name": "AF-desktop: Build All",
"request": "launch", "request": "launch",
"program": "./lib/main.dart", "program": "./lib/main.dart",
"type": "dart", "type": "dart",
@ -17,31 +28,13 @@
"cwd": "${workspaceRoot}/app_flowy" "cwd": "${workspaceRoot}/app_flowy"
}, },
{ {
// This task builds the Rust and Dart code of AppFlowy for android. "name": "AF-desktop: Build All (rustlog: trace)",
"name": "AF: Run Android",
"request": "launch", "request": "launch",
"program": "./lib/main.dart", "program": "./lib/main.dart",
"type": "dart", "type": "dart",
"preLaunchTask": "AF: build_mobile_sdk", "preLaunchTask": "AF: build_flowy_sdk",
"env": { "env": {
"RUST_LOG": "info" "RUST_LOG": "trace"
},
"cwd": "${workspaceRoot}/app_flowy"
},
{
"name": "AF: Debug Rust",
"request": "attach",
"type": "lldb",
"pid": "${command:pickMyProcess}"
},
{
// This task only builds the Dart code of AppFlowy.
"name": "AF: Build Dart Only",
"request": "launch",
"program": "./lib/main.dart",
"type": "dart",
"env": {
"RUST_LOG": "debug"
}, },
"cwd": "${workspaceRoot}/app_flowy" "cwd": "${workspaceRoot}/app_flowy"
}, },
@ -50,7 +43,7 @@
// - call the clean task, // - call the clean task,
// - rebuild all the generated Files (including freeze and language files) // - rebuild all the generated Files (including freeze and language files)
// - rebuild the the Rust and Dart code of AppFlowy. // - rebuild the the Rust and Dart code of AppFlowy.
"name": "AF: Clean + Rebuild All", "name": "AF-desktop: Clean + Rebuild All",
"request": "launch", "request": "launch",
"program": "./lib/main.dart", "program": "./lib/main.dart",
"type": "dart", "type": "dart",
@ -60,12 +53,35 @@
}, },
"cwd": "${workspaceRoot}/app_flowy" "cwd": "${workspaceRoot}/app_flowy"
}, },
{
// This task builds the Rust and Dart code of AppFlowy for android.
"name": "AF-android: Build All",
"request": "launch",
"program": "./lib/main.dart",
"type": "dart",
"preLaunchTask": "AF: build_mobile_sdk",
"env": {
"RUST_LOG": "info"
},
"cwd": "${workspaceRoot}/app_flowy"
},
{
"name": "AF-android: Build All (rustlog: trace)",
"request": "launch",
"program": "./lib/main.dart",
"type": "dart",
"preLaunchTask": "AF: build_mobile_sdk",
"env": {
"RUST_LOG": "trace"
},
"cwd": "${workspaceRoot}/app_flowy"
},
{ {
// This task builds will: // This task builds will:
// - call the clean task, // - call the clean task,
// - rebuild all the generated Files (including freeze and language files) // - rebuild all the generated Files (including freeze and language files)
// - rebuild the the Rust and Dart code of AppFlowy. // - rebuild the the Rust and Dart code of AppFlowy.
"name": "AF: Clean + Rebuild All (Android)", "name": "AF-android: Clean + Rebuild All",
"request": "launch", "request": "launch",
"program": "./lib/main.dart", "program": "./lib/main.dart",
"type": "dart", "type": "dart",
@ -76,26 +92,24 @@
"cwd": "${workspaceRoot}/app_flowy" "cwd": "${workspaceRoot}/app_flowy"
}, },
{ {
"name": "AF: Build All (rustlog: trace)", "type": "lldb",
"request": "launch", "request": "launch",
"program": "./lib/main.dart", "name": "AF: Tauri dev",
"type": "dart", "cargo": {
"preLaunchTask": "AF: build_flowy_sdk", "args": [
"env": { "build",
"RUST_LOG": "trace" "--manifest-path=./appflowy_tauri/src-tauri/Cargo.toml",
"--no-default-features"
]
}, },
"cwd": "${workspaceRoot}/app_flowy" "preLaunchTask": "tauri:dev",
"cwd": "${workspaceRoot}/appflowy_tauri/"
}, },
{ {
"name": "AF: Build All Android (rustlog: trace)", "name": "AF: Debug Rust",
"request": "launch", "request": "attach",
"program": "./lib/main.dart", "type": "lldb",
"type": "dart", "pid": "${command:pickMyProcess}"
"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)",

View File

@ -168,7 +168,7 @@
{ {
"label": "AF: Rust Clean", "label": "AF: Rust Clean",
"type": "shell", "type": "shell",
"command": "cargo make af_dart_clean", "command": "cargo make dart_clean",
"group": "build", "group": "build",
"options": { "options": {
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}"
@ -185,6 +185,16 @@
"group": "build", "group": "build",
"problemMatcher": [], "problemMatcher": [],
"detail": "app_flowy" "detail": "app_flowy"
} },
{
"label": "tauri:dev",
"type": "shell",
"isBackground": true,
"command": "npm run dev",
"problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}/appflowy_tauri"
}
},
] ]
} }

View File

@ -8,10 +8,9 @@ mod init;
mod request; mod request;
use event::*; use event::*;
use flowy_core::FlowySDK;
use init::*; use init::*;
use request::*; use request::*;
use tauri::{Manager, State}; use tauri::Manager;
fn main() { fn main() {
let sdk = init_flowy_core(); let sdk = init_flowy_core();

View File

@ -120,7 +120,7 @@ mod tests {
#[test] #[test]
fn utc_to_native_test() { fn utc_to_native_test() {
let native_timestamp = 1647251762; let native_timestamp = 1647251762;
let native = NaiveDateTime::from_timestamp(native_timestamp, 0); let native = NaiveDateTime::from_timestamp_opt(native_timestamp, 0).unwrap();
let utc = chrono::DateTime::<chrono::Utc>::from_utc(native, chrono::Utc); let utc = chrono::DateTime::<chrono::Utc>::from_utc(native, chrono::Utc);
// utc_timestamp doesn't carry timezone // utc_timestamp doesn't carry timezone

View File

@ -230,7 +230,7 @@ script = [
cd rust-lib/ cd rust-lib/
rustup show rustup show
echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" RUST_LOG=${TEST_RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
cd ../ cd ../
""", """,
] ]