refactor: clean script

This commit is contained in:
appflowy 2022-06-19 09:42:25 +08:00
parent 370072dafb
commit 824c7c0e8d
4 changed files with 24 additions and 54 deletions

View File

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

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,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"