Skip to content

Commit 907f2e6

Browse files
committed
Added FileCopy script and corrected BossRoom branch
1 parent faac42b commit 907f2e6

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

.yamato/project-builders/builder.metafile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
NetcodeProjects:
44
# Note that we are using internal Unity repo. This means that we may test with newest changes that are not yet released to our users (there are also public versions)
5+
# TODO: Why develop and not main?
56
BossRoom:
67
GithubRepo: "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git"
7-
branch: main
8+
branch: develop
89
manifestPath: Packages/manifest.json
910
projectPath: '.'

.yamato/project-builders/project-builders.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ build_{{ netcodeProject[0] }}_project:
5656
# Add BuilderScript.cs to the project so we can modify and build the project using Unity Editor.
5757
# This is a bit tricky step, notice that we also need to include proper assembly definition in order for those scripts to compile properly.
5858
# TODO: the asmdef file can be simplified
59-
- python -c "import os; os.makedirs('C:/ClonedProject/{{ netcodeProject[1].projectPath }}/Assets/Scripts/Editor', exist_ok=True)" # --> Create the directory if it doesn't exist
60-
- python -c "import shutil; shutil.copy('Tools/CI/scripts/BuildAutomation/Unity.ProjectBuild.Editor.asmdef', 'C:/ClonedProject/{{ netcodeProject[1].projectPath }}/Assets/Scripts/Editor/')" # --> Copy the asmdef file to the directory
61-
- python -c "import shutil; shutil.copy('Tools/CI/scripts/BuildAutomation/BuilderScripts.cs', 'C:/ClonedProject/{{ netcodeProject[1].projectPath }}/Assets/Scripts/Editor/')" # --> Copy the BuilderScripts.cs file to the directory (for build configuration setup)
59+
- python Tools/CI/scripts/BuildAutomation/FileCopy.py "C:/ClonedProject/{{ netcodeProject[1].projectPath }}"
6260

6361
# Build the project using Unity Editor. This will call the given static BuilderScripts method.
6462
# Ideally, it would be nice to parametrize the BuilderScripts (for example to pass scripting backend as parameter) but -executeMethod only calls static methods without parameters so for now we will have multiple configurations
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Filename: Tools/CI/scripts/prepare_build_scripts.py
2+
3+
import os
4+
import shutil
5+
import sys
6+
7+
def main():
8+
"""
9+
Cleans and prepares the 'Assets/Scripts/Editor' directory for build automation scripts.
10+
It deletes the directory if it exists, recreates it, and copies in the necessary
11+
assembly definition and C# script files.
12+
"""
13+
# --- 1. Argument Validation ---
14+
if len(sys.argv) < 2:
15+
print("Error: Missing required argument.")
16+
print("Usage: python prepare_build_scripts.py <path_to_project_root>")
17+
sys.exit(1)
18+
19+
project_root = sys.argv[1]
20+
21+
# --- 2. Define File Paths ---
22+
# The target directory inside the Unity project
23+
target_dir = os.path.join(project_root, 'Assets', 'Scripts', 'Editor')
24+
25+
# The source files for build automation
26+
source_asmdef = 'Tools/CI/scripts/BuildAutomation/Unity.ProjectBuild.Editor.asmdef'
27+
source_script = 'Tools/CI/scripts/BuildAutomation/BuilderScripts.cs'
28+
29+
print(f"Preparing build scripts for project at: {project_root}")
30+
print(f"Target editor script directory: {target_dir}")
31+
32+
# --- 3. Clean and Recreate Directory ---
33+
try:
34+
if os.path.exists(target_dir):
35+
print(f"Directory '{target_dir}' exists. Removing it.")
36+
shutil.rmtree(target_dir)
37+
38+
print(f"Creating directory: {target_dir}")
39+
os.makedirs(target_dir)
40+
41+
except OSError as e:
42+
print(f"Error managing directory: {e}")
43+
sys.exit(1)
44+
45+
# --- 4. Copy Build Automation Files ---
46+
try:
47+
print(f"Copying '{source_asmdef}' to '{target_dir}'")
48+
shutil.copy(source_asmdef, target_dir)
49+
50+
print(f"Copying '{source_script}' to '{target_dir}'")
51+
shutil.copy(source_script, target_dir)
52+
53+
except IOError as e:
54+
print(f"Error copying files: {e}")
55+
sys.exit(1)
56+
57+
print("\nSuccessfully prepared build automation scripts.")
58+
59+
if __name__ == "__main__":
60+
main()
61+

0 commit comments

Comments
 (0)