소스 검색

chore: remove rust/dart generated files

appflowy 2 년 전
부모
커밋
64e43fa1f3
2개의 변경된 파일64개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 2
      frontend/.vscode/tasks.json
  2. 62 3
      frontend/scripts/makefile/tool.toml

+ 2 - 2
frontend/.vscode/tasks.json

@@ -10,7 +10,7 @@
 	// ${cwd}: the current working directory of the spawned process
 	"tasks": [
 		{
-			"label": "AF: Rust Clean + Rebuild All",
+			"label": "AF: Clean + Rebuild All",
 			"type": "shell",
 			"dependsOrder": "sequence",
 			"dependsOn": [
@@ -141,7 +141,7 @@
 		{
 			"label": "AF: Rust Clean",
 			"type": "shell",
-			"command": "cargo make rust_clean",
+			"command": "cargo make flowy_clean",
 			"group": "build",
 			"options": {
 				"cwd": "${workspaceFolder}"

+ 62 - 3
frontend/scripts/makefile/tool.toml

@@ -1,5 +1,5 @@
-[tasks.rust_clean]
-run_task = { name = ["cargo_clean","rm_macro_build_cache", "rm_generated_protobuf_files"] }
+[tasks.flowy_clean]
+run_task = { name = ["cargo_clean","rm_macro_build_cache", "rm_rust_generated_files", "rm_dart_generated_files"] }
 
 [tasks.cargo_clean]
 script = [
@@ -25,10 +25,69 @@ script = [
 ]
 script_runner = "@duckscript"
 
+#Rust Clean
+[tasks.rm_rust_generated_files]
+run_task = { name = ["rm_rust_lib_generated_protobuf_files", "rm_shared_lib_generated_protobuf_files"] }
 
-[tasks.rm_generated_protobuf_files]
+[tasks.rm_rust_lib_generated_protobuf_files]
+private = true
+env = { "rm_proto_path" = "./rust-lib/**/resources/proto", "rm_protobuf_path" = "./rust-lib/**/protobuf" }
+run_task = { name = "remove_files_with_pattern" }
+
+[tasks.rm_shared_lib_generated_protobuf_files]
+private = true
+env = { "rm_proto_path" = "./shared-lib/**/resources/proto", "rm_protobuf_path" = "./shared-lib/**/protobuf" }
+run_task = { name = "remove_files_with_pattern" }
+
+
+#Dart Clean
+[tasks.rm_dart_generated_files]
+private = true
+env = { "dart_flowy_sdk_path" = "./app_flowy/packages/flowy_sdk/" }
+run_task = { name = ["rm_dart_generated_protobuf_files"] }
+
+[tasks.rm_dart_generated_protobuf_files]
+private = true
+script = [
+  """
+  protobuf_file_paths = glob_array ${dart_flowy_sdk_path}/lib/protobuf
+  if array_is_empty ${protobuf_file_paths}
+    return
+  end
+
+  echo Remove generated protobuf files:
+  for path in ${protobuf_file_paths}
+      echo remove ${path}
+      rm -rf ${path}
+  end
+  """,
+]
+script_runner = "@duckscript"
+
+
+[tasks.remove_files_with_pattern]
+private = true
 script = [
   """
+  proto_file_paths = glob_array ${rm_proto_path}
+  is_proto_file_paths_empty = array_is_empty ${proto_file_paths}
+  if !is_proto_file_paths_empty
+    echo Remove generated proto files:
+    for path in ${proto_file_paths}
+      echo remove ${path}
+      rm -rf ${path}
+    end
+  end
+
+  protobuf_file_paths = glob_array ${rm_protobuf_path}
+  is_protobuf_file_paths_empty = array_is_empty ${protobuf_file_paths}
+  if !is_protobuf_file_paths_empty
+    echo Remove generated protobuf files:
+    for path in ${protobuf_file_paths}
+      echo remove ${path}
+      rm -rf ${path}
+    end
+  end
 
   """,
 ]