Selaa lähdekoodia

opt: build the rust sdk while running the flutter program

appflowy 3 vuotta sitten
vanhempi
commit
d30ee5db89

+ 1 - 1
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

+ 2 - 1
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)",

+ 2 - 2
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"
 		}
 	]
 }

+ 1 - 1
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
         }
     }
 }

+ 1 - 0
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" ]

+ 11 - 1
scripts/build_sdk.sh

@@ -3,4 +3,14 @@
 echo 'Start building rust sdk'
 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
+

+ 1 - 0
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"] }