Refactoring script: Copy common/cros_async to cros_async
The copy is going to be used by crosvm going forward, while the
old version will eventually be moved to ChromeOS.
See go/future-of-sys-util for details
BUG=b:22320646
TEST=presubmit
Change-Id: Ic3216855fc244e366423160464dc722a04dfc56d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3533607
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/common/cros_async/DEPRECATED.md b/common/cros_async/DEPRECATED.md
new file mode 100644
index 0000000..77e1864
--- /dev/null
+++ b/common/cros_async/DEPRECATED.md
@@ -0,0 +1,4 @@
+Use crosvm/cros_async instead.
+
+Code in this directory is not used by crosvm, it is only used in ChromeOS and will move to a
+separate ChromeOS repository soon.
diff --git a/tools/contrib/cargo_refactor.py b/tools/contrib/cargo_refactor.py
index 80e656f..265a91d 100644
--- a/tools/contrib/cargo_refactor.py
+++ b/tools/contrib/cargo_refactor.py
@@ -64,7 +64,7 @@
print(f"{from_path} -> {to_path}")
if to_path.exists():
shutil.rmtree(to_path)
- subprocess.check_call(["git", "mv", str(from_path), str(to_path)])
+ shutil.copytree(str(from_path), str(to_path))
update_path_deps(to_path / "Cargo.toml", from_path, to_path)
replace_in_files("**/*/Cargo.toml", [(str(from_path), str(to_path))])
replace_in_file(Path("Cargo.toml"), str(from_path), str(to_path))
@@ -91,7 +91,8 @@
def main():
os.chdir(Path(__file__).parent.parent.parent)
- move_crate(Path("common/base"), Path("base"))
+ move_crate(Path("common/cros_async"), Path("cros_async"))
+ replace_in_file(Path("cros_async/Cargo.toml"), "[workspace]", "")
update_workspace_members()