Repository: ray-project/ray
Issue category: Bug Report

Issue:
ray/serve/generated file is missing after running setup-dev.py
### What happened + What you expected to happen

When running `python setup-dev.py`, it creates softlink for each python package. However, since the generated folder is not part of the repository, creating the symbolic link for the `serve` package inadvertently overwrites the folder and the generated folder can't be found anymore.

### Versions / Dependencies

Lastest

### Reproduction script

```

pip install -U "ray[serve] @ https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-macosx_11_0_arm64.whl"
python python/ray/setup-dev.py

```

### Issue Severity

Medium: It is a significant difficulty but I can work around it.


Hints:

Patch:
diff --git a/python/ray/setup-dev.py b/python/ray/setup-dev.py
index 31d722b89984..d26d377a65f5 100755
--- a/python/ray/setup-dev.py
+++ b/python/ray/setup-dev.py
@@ -73,9 +73,27 @@ def do_link(package, force=False, skip_list=None, local_path=None):
             print("You don't have write permission " f"to {package_home}, using sudo:")
             sudo = ["sudo"]
         print(f"Creating symbolic link from \n {local_home} to \n {package_home}")
+
+        # Preserve ray/serve/generated
+        if package == "serve":
+            # Copy generated folder to a temp dir
+            generated_folder = os.path.join(package_home, "generated")
+            temp_dir = "/tmp/ray/_serve/"
+            if not os.path.exists(temp_dir):
+                os.makedirs(temp_dir)
+            subprocess.check_call(["cp", "-r", generated_folder, temp_dir])
+
         subprocess.check_call(sudo + ["rm", "-rf", package_home])
         subprocess.check_call(sudo + ["ln", "-s", local_home, package_home])
 
+        # Move generated folder to local_home
+        if package == "serve":
+            tmp_generated_folder = os.path.join(temp_dir, "generated")
+            package_generated_folder = os.path.join(package_home, "generated")
+            subprocess.check_call(
+                ["mv", tmp_generated_folder, package_generated_folder]
+            )
+
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(


Test patch: