Merge pull request #567 from AppFlowy-IO/feat/clean_proto_files

Feat/clean proto files
This commit is contained in:
Nathan.fooo 2022-06-19 11:15:56 +08:00 committed by GitHub
commit 759d2ec111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 54 deletions

View File

@ -14,9 +14,9 @@
"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 flowy_clean",
"group": "build",
"options": {
"cwd": "${workspaceFolder}"

View File

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

View File

@ -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

View File

@ -1,29 +1,92 @@
[tasks.rust_clean]
[tasks.flowy_clean]
run_task = { name = ["cargo_clean","rm_macro_build_cache", "rm_rust_generated_files", "rm_dart_generated_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 = [
"""
cd rust-lib
cargo clean
path = canonicalize ../shared-lib/lib-infra/.cache
if is_path_exists ${path}
rm -rf ${path}
end
""",
]
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_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]
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 not array_is_empty ${protobuf_file_paths}
echo Remove generated protobuf files:
for path in ${protobuf_file_paths}
echo remove ${path}
rm -rf ${path}
end
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 not ${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 not ${is_protobuf_file_paths_empty}
echo Remove generated protobuf files:
for path in ${protobuf_file_paths}
echo remove ${path}
rm -rf ${path}
end
end
cd ../../shared-lib
rmdir /s/q "lib-infra/.cache"
""",
]
script_runner = "@duckscript"