opt: build the rust sdk while running the flutter program

This commit is contained in:
appflowy 2021-07-25 11:08:59 +08:00
parent c5881daddd
commit d30ee5db89
7 changed files with 19 additions and 6 deletions

View File

@ -10,7 +10,7 @@ CARGO_MAKE_CRATE_NAME = "dart-ffi"
DEV = true DEV = true
LIB_OUT_DIR = "debug" LIB_OUT_DIR = "debug"
RELEASE = false RELEASE = false
TARGET_OS = "unknown" #TARGET_OS = "unknown"
[tasks.setup-crate-type] [tasks.setup-crate-type]
private = true private = true

View File

@ -9,7 +9,8 @@
"request": "launch", "request": "launch",
"program": "${workspaceRoot}/lib/main.dart", "program": "${workspaceRoot}/lib/main.dart",
"type": "dart", "type": "dart",
// "preLaunchTask": "build rust sdk" "preLaunchTask": "BuildRust",
"cwd": "${workspaceRoot}"
}, },
{ {
"name": "app_flowy (profile mode)", "name": "app_flowy (profile mode)",

View File

@ -13,7 +13,7 @@
// ${cwd}: the current working directory of the spawned process // ${cwd}: the current working directory of the spawned process
"type": "shell", "type": "shell",
"command": "sh ${workspaceFolder}/../scripts/build_sdk.sh", "command": "sh ./scripts/build_sdk.sh",
"group": "build", "group": "build",
"options": { "options": {
"cwd": "${workspaceFolder}/../" "cwd": "${workspaceFolder}/../"
@ -21,7 +21,7 @@
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
"label": "build rust sdk" "label": "BuildRust"
} }
] ]
} }

View File

@ -21,7 +21,7 @@ impl std::default::Default for ObservableSubject {
category: "".to_string(), category: "".to_string(),
ty: 0, ty: 0,
subject_id: "".to_string(), subject_id: "".to_string(),
subject_payload: None, subject_payload: None
} }
} }
} }

View File

@ -1,3 +1,4 @@
[toolchain] [toolchain]
#rustup override set nightly-2021-04-24
channel = "nightly-2021-04-24" channel = "nightly-2021-04-24"
targets = [ "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "x86_64-apple-ios" ] targets = [ "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "x86_64-apple-ios" ]

View File

@ -3,4 +3,14 @@
echo 'Start building rust sdk' echo 'Start building rust sdk'
rustup show rustup show
cargo make desktop #Env check
#1. rustc --version will be the same as cargo --version
#2. override the toolchain if the current toolchain not equal to the rust-toolchain file specified.
# rustup override set nightly-2021-04-24
#3. Check your cargo env using the same source by: which cargo
# 1. ~/.bash_profile,
# 2. ~/.bashrc
# 3. ~/.profile
# 4. ~/.zshrc
cargo make desktop

View File

@ -16,6 +16,7 @@ condition = { env_true = ["RELEASE"] }
env = { DESKTOP_TARGET = "x86_64-apple-darwin" } env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
private = true private = true
run_task = "desktop-build" run_task = "desktop-build"
[tasks.desktop-build] [tasks.desktop-build]
category = "Build" category = "Build"
condition = { platforms = ["mac"], env_true = ["DEV"] } condition = { platforms = ["mac"], env_true = ["DEV"] }