Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

opt: build the rust sdk while running the flutter program

appflowyd30ee5db8929
diff --git a/Makefile.toml b/Makefile.toml
index 2757668fb0..dfa24f39ea 100644
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -10,7 +10,7 @@ CARGO_MAKE_CRATE_NAME = "dart-ffi"
DEV = true
LIB_OUT_DIR = "debug"
RELEASE = false
-TARGET_OS = "unknown"
+#TARGET_OS = "unknown"
[tasks.setup-crate-type]
private = true
diff --git a/app_flowy/.vscode/launch.json b/app_flowy/.vscode/launch.json
index 836c8b2753..0660f0d670 100644
--- a/app_flowy/.vscode/launch.json
+++ b/app_flowy/.vscode/launch.json
@@ -9,7 +9,8 @@
"request": "launch",
"program": "${workspaceRoot}/lib/main.dart",
"type": "dart",
- // "preLaunchTask": "build rust sdk"
+ "preLaunchTask": "BuildRust",
+ "cwd": "${workspaceRoot}"
},
{
"name": "app_flowy (profile mode)",
diff --git a/app_flowy/.vscode/tasks.json b/app_flowy/.vscode/tasks.json
index 78b1eae1c7..539b284ce9 100644
--- a/app_flowy/.vscode/tasks.json
+++ b/app_flowy/.vscode/tasks.json
@@ -13,7 +13,7 @@
// ${cwd}: the current working directory of the spawned process
"type": "shell",
- "command": "sh ${workspaceFolder}/../scripts/build_sdk.sh",
+ "command": "sh ./scripts/build_sdk.sh",
"group": "build",
"options": {
"cwd": "${workspaceFolder}/../"
@@ -21,7 +21,7 @@
"problemMatcher": [
"$rustc"
],
- "label": "build rust sdk"
+ "label": "BuildRust"
}
]
}
\ No newline at end of file
diff --git a/rust-lib/flowy-observable/src/entities/subject.rs b/rust-lib/flowy-observable/src/entities/subject.rs
index 89ed245db0..d2b3b14211 100644
--- a/rust-lib/flowy-observable/src/entities/subject.rs
+++ b/rust-lib/flowy-observable/src/entities/subject.rs
@@ -21,7 +21,7 @@ impl std::default::Default for ObservableSubject {
category: "".to_string(),
ty: 0,
subject_id: "".to_string(),
- subject_payload: None,
+ subject_payload: None
}
}
}
diff --git a/rust-lib/rust-toolchain b/rust-lib/rust-toolchain
index 1c2e7f3628..e6fe48400e 100644
--- a/rust-lib/rust-toolchain
+++ b/rust-lib/rust-toolchain
@@ -1,3 +1,4 @@
[toolchain]
+#rustup override set nightly-2021-04-24
channel = "nightly-2021-04-24"
targets = [ "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "x86_64-apple-ios" ]
\ No newline at end of file
diff --git a/scripts/build_sdk.sh b/scripts/build_sdk.sh
index 8dc74c6d27..f4939d0d24 100755
--- a/scripts/build_sdk.sh
+++ b/scripts/build_sdk.sh
@@ -3,4 +3,14 @@
echo 'Start building rust sdk'
rustup show
-cargo make desktop
\ No newline at end of file
+#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
+
diff --git a/scripts/makefile/desktop.toml b/scripts/makefile/desktop.toml
index 5c9aea45e9..fb23e40580 100644
--- a/scripts/makefile/desktop.toml
+++ b/scripts/makefile/desktop.toml
@@ -16,6 +16,7 @@ condition = { env_true = ["RELEASE"] }
env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
private = true
run_task = "desktop-build"
+
[tasks.desktop-build]
category = "Build"
condition = { platforms = ["mac"], env_true = ["DEV"] }