Skip to content

Commit db8fa7f

Browse files
committed
File update based on changes in DOTS repo
1 parent 3491f14 commit db8fa7f

File tree

12 files changed

+917
-478
lines changed

12 files changed

+917
-478
lines changed

.yamato/project-builders/builder.metafile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# https://internaldocs.unity.com/yamato_continuous_integration/usage/templating/
2+
# The list below contains an easily extendable list of projects to build and test against our latest package changes
3+
# The parameters specify
4+
# - GithubRepo --> project repo location to clone from.
5+
# - defaultBranch --> default sample branch to use (you can modify it via job variable but that should suggest what's the default repo branch). Remember that package is being used from branch that you trigger the job on.
6+
# - manifestPath --> path to manifest.json file in the sample repo so we can replace package entry.
7+
# - projectPath --> path to the project root folder. Depends on projects sometimes it's the root of the repo, sometimes it's a subfolder.
8+
# - localPackageName --> name of the package we want to replace in the manifest.json (TODO: it should be a list to support multiple packages in future)
9+
# - localPackagePath --> path to the local package inside our repo which we want to use to replace the package entry in manifest.json
10+
# - remove --> (optional) relative folder path to remove from the cloned repo root (e.g., "Packages/"). This prevents Unity from using local packages that should come from registry instead. This is the case only for DOTS related projects
11+
# - minUnityVersion --> minimal Unity version that the samples supports. Used as a suggestion when triggering the build as to which Unity version to use.
212

3-
NetcodeProjects:
13+
# Constants
14+
ClonedProjectRoot: C:/ClonedProject
15+
16+
BuildProjects:
417
# 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)
518
# The parameters specify repo location, default branch to use (since you can modify it via job variable), path to manifest.json file so we can replace package entry and path to the project root folder since it differs between projects
619
# Note that for BossRoom 'main' branch supports NGOv1.X and 'develop' branch supports NGOv2.X
@@ -10,13 +23,22 @@ NetcodeProjects:
1023
defaultBranch: ngo-playtest-update
1124
manifestPath: Packages/manifest.json
1225
projectPath: '.'
26+
localPackageName: com.unity.netcode.gameobjects
27+
localPackagePath: Packages/com.unity.netcode.gameobjects
28+
minUnityVersion: 6000.0.52f1
1329
Asteroids:
1430
GithubRepo: "https://github.cds.internal.unity3d.com/unity/Asteroids-CMB-NGO-Sample.git"
1531
defaultBranch: main
1632
manifestPath: Packages/manifest.json
1733
projectPath: '.'
34+
localPackageName: com.unity.netcode.gameobjects
35+
localPackagePath: Packages/com.unity.netcode.gameobjects
36+
minUnityVersion: 6000.2.9f1
1837
SocialHub:
1938
GithubRepo: "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize.git"
2039
defaultBranch: main
2140
manifestPath: Basic/DistributedAuthoritySocialHub/Packages/manifest.json
2241
projectPath: 'Basic/DistributedAuthoritySocialHub'
42+
localPackageName: com.unity.netcode.gameobjects
43+
localPackagePath: Packages/com.unity.netcode.gameobjects
44+
minUnityVersion: 6000.0.24f1

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

Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,80 +18,68 @@
1818
# Note that for now all of those builds are being made on Windows machine (so for example combination of macOS + il2cpp is expected to fail)
1919
# TODO: for now all builds are being made on Windows machine, but it would be nice to have a Mac build as well.
2020
# TODO: add iOS support
21-
{% for netcodeProject in NetcodeProjects -%}
22-
build_{{ netcodeProject[0] }}_project:
23-
name: {{ netcodeProject[0] }}
21+
{% for buildProject in BuildProjects -%}
22+
build_{{ buildProject[0] }}_project:
23+
name: {{ buildProject[0] }}
2424
agent:
2525
type: Unity::VM
2626
image: package-ci/win10:v4
2727
flavor: b1.xlarge
28-
variables:
29-
UNITY_VERSION: trunk
30-
SCRIPTING_BACKEND_IL2CPP_MONO: il2cpp
31-
BURST_ON_OFF: on
32-
PLATFORM_WIN64_MAC_ANDROID: win64
33-
SAMPLE_BRANCH: {{ netcodeProject[1].defaultBranch }}
34-
commands:
35-
# Validate inputs passed via Yamato variables
36-
- python Tools/scripts/BuildAutomation/validate_params.py
37-
- echo Building {{ netcodeProject[0] }} project from branch %SAMPLE_BRANCH% with Unity version of %UNITY_VERSION%, Scripting backend %SCRIPTING_BACKEND_IL2CPP_MONO%, Burst %BURST_ON_OFF% for platform %PLATFORM_WIN64_MAC_ANDROID%
28+
variables:
29+
UNITY_VERSION: {{ buildProject[1].minUnityVersion }}
30+
SCRIPTING_BACKEND_IL2CPP_MONO: il2cpp
31+
BURST_ON_OFF: on
32+
PLATFORM_WIN64_MAC_ANDROID: win64
33+
SAMPLE_BRANCH: {{ buildProject[1].defaultBranch }}
34+
commands:
35+
- echo Building {{ buildProject[0] }} project from branch %SAMPLE_BRANCH% with Unity version of %UNITY_VERSION%, Scripting backend %SCRIPTING_BACKEND_IL2CPP_MONO%, Burst %BURST_ON_OFF% for platform %PLATFORM_WIN64_MAC_ANDROID%
36+
37+
# Validate inputs passed via Yamato variables
38+
- python Tools/CI/scripts/BuildAutomation/validate_params.py
39+
40+
# Clone the external project repository into a specific directory. Notice that branch is also specified.
41+
- git clone --single-branch --branch %SAMPLE_BRANCH% {{ buildProject[1].GithubRepo }} {{ ClonedProjectRoot }}
42+
43+
# Replace file: references in the manifest with latest released versions from Unity Package Vision API.
44+
# This replaces the need for maintaining separate release-manifest.json files in each project.
45+
- python Tools/CI/scripts/BuildAutomation/resolve_file_references.py --manifest-path C:/ClonedProject/{{ buildProject[1].manifestPath }}
46+
47+
# Modify the external project's manifest to use the local N4E package from current branch on which this Yamato job is running. (requires python that should be preinstalled in the image)
48+
- python Tools/CI/scripts/BuildAutomation/manifest_update.py --manifest-path {{ ClonedProjectRoot }}/{{ buildProject[1].manifestPath }} --package-name {{ buildProject[1].localPackageName }} --local-package-path %YAMATO_SOURCE_DIR%/{{ buildProject[1].localPackagePath }}{% if buildProject[1].remove %} --remove-folder {{ buildProject[1].remove }}{% endif %} --cloned-project-root {{ ClonedProjectRoot }}
49+
50+
# Run python script to update ProjectSettings.asset in order to connect the project to Unity Services/set proper values.
51+
# Notice that if a project has this already set up then in theory we don't need to run this script.
52+
- python Tools/CI/scripts/BuildAutomation/connect_services.py --project-settings-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}/ProjectSettings/ProjectSettings.asset
53+
54+
# Enable or disable Burst compilation. This step is specific to Netcode package (or any package that uses Burst)
55+
- IF "%BURST_ON_OFF%"=="on" (python Tools/CI/scripts/BuildAutomation/disable-enable-burst.py --enable-burst --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }})
56+
ELSE (python Tools/CI/scripts/BuildAutomation/disable-enable-burst.py --disable-burst --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }})
57+
58+
# Download the Unity Editor version specified in the UNITY_VERSION variable. Il2cpp component is downloaded only if the SCRIPTING_BACKEND_IL2CPP_MONO is set to "il2cpp".
59+
# TODO: we could download components only if needed
60+
- unity-downloader-cli --fast --wait -u %UNITY_VERSION% -p C:/TestingEditor -c Editor -c il2cpp -c Android -c macOS
61+
62+
# Add BuilderScript.cs to the project so we can modify and build the project using Unity Editor.
63+
# This requires proper assembly definition in order for those scripts to compile properly.
64+
- python Tools/CI/scripts/BuildAutomation/setup_build_scripts.py --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }} --source-dir %YAMATO_SOURCE_DIR%
65+
66+
# Build the project using Unity Editor. This calls the appropriate static BuilderScripts method.
67+
- python Tools/CI/scripts/BuildAutomation/get_build_method.py --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}
68+
69+
# Print manifest dependencies after Unity Editor has processed the manifest to verify package overrides.
70+
- python Tools/CI/scripts/BuildAutomation/print_manifest_info.py --manifest-path {{ ClonedProjectRoot }}/{{ buildProject[1].manifestPath }}
71+
72+
# Copy build artifacts to source directory for Yamato artifact collection.
73+
# TODO: This can be omitted if building directly in YAMATO_SOURCE_DIR instead of ClonedProjectRoot
74+
- python -c "import os, shutil; os.makedirs('./build', exist_ok=True); shutil.copytree('{{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}/build', './build', dirs_exist_ok=True)"
3875

39-
# Clone the external project repository into a specific directory. Notice that branch is also specified.
40-
- git clone --single-branch --branch %SAMPLE_BRANCH% {{ netcodeProject[1].GithubRepo }} C:/ClonedProject
41-
42-
# Modify the external project's manifest to use the local N4E package from current branch on which this Yamato job is running. (requires python that should be preinstalled in the image)
43-
- python Tools/scripts/BuildAutomation/manifest_update.py --manifest-path C:/ClonedProject/{{ netcodeProject[1].manifestPath }} --local-package-path %YAMATO_SOURCE_DIR%/com.unity.netcode.gameobjects
44-
45-
# Run python script to update ProjectSettings.asset in order to connect the project to Unity Services/set proper values.
46-
# Notice that if a project has this already set up then in theory we don't need to run this script.
47-
- python Tools/scripts/BuildAutomation/connect_services.py --project-settings-path C:/ClonedProject/{{ netcodeProject[1].projectPath }}/ProjectSettings/ProjectSettings.asset
48-
49-
# Enable or disable Burst compilation. This step is specific to Netcode package (or any package that uses Burst)
50-
- IF "%BURST_ON_OFF%"=="on" (python Tools/scripts/BuildAutomation/disable-enable-burst.py --enable-burst --project-path C:/ClonedProject/{{ netcodeProject[1].projectPath }})
51-
ELSE (python Tools/scripts/BuildAutomation/disable-enable-burst.py --disable-burst --project-path C:/ClonedProject/{{ netcodeProject[1].projectPath }})
52-
53-
# Download the Unity Editor version specified in the UNITY_VERSION variable. Il2cpp component is downloaded only if the SCRIPTING_BACKEND_IL2CPP_MONO is set to "il2cpp".
54-
# TODO: we could download components only if needed
55-
- unity-downloader-cli --fast --wait -u %UNITY_VERSION% -p C:/TestingEditor -c Editor -c il2cpp -c Android -c macOS
56-
57-
# Add BuilderScript.cs to the project so we can modify and build the project using Unity Editor.
58-
# This is a bit tricky step, notice that we also need to include proper assembly definition in order for those scripts to compile properly.
59-
# TODO: the asmdef file can be simplified
60-
- python Tools/scripts/BuildAutomation/FileCopy.py "C:/ClonedProject/{{ netcodeProject[1].projectPath }}"
61-
62-
# Build the project using Unity Editor. This will call the given static BuilderScripts method.
63-
# 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
64-
# Notice that for Android platform even if mono is selected, il2cpp will be used since mono is not supported for Android builds.
65-
- IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="win64" (
66-
IF /I "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" (
67-
C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget win64 -executeMethod BuilderScripts.BuildWinIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit
68-
) ELSE (
69-
C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget win64 -executeMethod BuilderScripts.BuildWinMono -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit
70-
)
71-
)
72-
ELSE IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="mac" (
73-
IF /I "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" (
74-
C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget osx -executeMethod BuilderScripts.BuildMacIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit
75-
) ELSE (
76-
C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget osx -executeMethod BuilderScripts.BuildMacMono -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit
77-
)
78-
)
79-
ELSE IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="android" (
80-
C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget android -executeMethod BuilderScripts.BuildAndroidIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit
81-
)
82-
83-
# Because of this we need to ensure that all files are copied to the source directory.
84-
# TODO: this can be omitted if I can somehow build the project in the source directory (YAMATO_SOURCE_DIR) instead of C:/CompetitiveAction
85-
- python -c "import os; os.makedirs('./build', exist_ok=True)" # --> Create the build directory if it doesn't exist
86-
- python -c "import shutil; shutil.copytree('C:/ClonedProject/{{ netcodeProject[1].projectPath }}/build', './build', dirs_exist_ok=True)" # --> Copy the build directory to the source directory (YAMATO_SOURCE_DIR). Remember to copy entire directory and not only exe file
87-
88-
artifacts:
89-
logs:
90-
paths:
91-
- '*.log'
92-
- '*.xml'
93-
- artifacts/**/*
94-
players:
95-
paths:
96-
- build/**/*
97-
{% endfor -%}
76+
artifacts:
77+
logs:
78+
paths:
79+
- '*.log'
80+
- '*.xml'
81+
- artifacts/**/*
82+
players:
83+
paths:
84+
- build/**/*
85+
{% endfor -%}

0 commit comments

Comments
 (0)