Przeglądaj źródła

refactor: clean script

appflowy 2 lat temu
rodzic
commit
824c7c0e8d

+ 5 - 17
frontend/.vscode/tasks.json

@@ -10,13 +10,13 @@
 	// ${cwd}: the current working directory of the spawned process
 	"tasks": [
 		{
-			"label": "AF: Clean + Rebuild All",
+			"label": "AF: Rust Clean + Rebuild All",
 			"type": "shell",
 			"dependsOrder": "sequence",
 			"dependsOn": [
-				"AF: Clean",
-				"AF: build_flowy_sdk",
+				"AF: Rust Clean",
 				"AF: Flutter Clean",
+				"AF: build_flowy_sdk",
 				"AF: Flutter Pub Get",
 				"AF: Flutter Package Get",
 				"AF: Generate Language Files",
@@ -139,21 +139,9 @@
 			}
 		},
 		{
-			"label": "AF: Clean",
+			"label": "AF: Rust Clean",
 			"type": "shell",
-			"command": "sh ./scripts/clean.sh",
-			"windows": {
-				"options": {
-					"shell": {
-						"executable": "cmd.exe",
-						"args": [
-							"/d",
-							"/c",
-							".\\scripts\\clean.cmd"
-						]
-					}
-				}
-			},
+			"command": "cargo make rust_clean",
 			"group": "build",
 			"options": {
 				"cwd": "${workspaceFolder}"

+ 0 - 8
frontend/scripts/clean.cmd

@@ -1,8 +0,0 @@
-cd rust-lib
-cargo clean
-
-cd ../../shared-lib
-
-if exist "lib-infra/.cache" (
-    rmdir /s/q "lib-infra/.cache"
-)

+ 0 - 16
frontend/scripts/clean.sh

@@ -1,16 +0,0 @@
-#!/bin/sh
-#!/usr/bin/env fish
-
-cd rust-lib
-cargo clean
-
-cd ../../shared-lib
-cargo clean
-
-CACHE_FILE=lib-infra/.cache
-if [ -d "$CACHE_FILE" ]; then
-  echo "Remove $CACHE_FILE"
-  rm -rf $CACHE_FILE
-fi
-
-

+ 19 - 13
frontend/scripts/makefile/tool.toml

@@ -1,29 +1,35 @@
 [tasks.rust_clean]
+run_task = { name = ["cargo_clean","rm_macro_build_cache", "rm_generated_protobuf_files"] }
+
+[tasks.cargo_clean]
 script = [
   """
     cd rust-lib
-    cargo clean
+    cargo clean -q
 
     cd ../../shared-lib
-    cargo clean
-
-    CACHE_FILE=lib-infra/.cache
-    if [ -d "$CACHE_FILE" ]; then
-      echo "Remove $CACHE_FILE"
-      rm -rf $CACHE_FILE
-    fi
+    cargo clean -q
   """,
 ]
 script_runner = "@shell"
 
-[tasks.rust_clean.windows]
+
+[tasks.rm_macro_build_cache]
+script = [
+  """
+    path = canonicalize ../shared-lib/lib-infra/.cache
+    if is_path_exists ${path}
+      rm -rf ${path}
+    end
+  """,
+]
+script_runner = "@duckscript"
+
+
+[tasks.rm_generated_protobuf_files]
 script = [
   """
-    cd rust-lib
-    cargo clean
 
-    cd ../../shared-lib
-    rmdir /s/q "lib-infra/.cache"
   """,
 ]
 script_runner = "@duckscript"