Skip to content

Commit c0a91c0

Browse files
rekhoffjdetter
authored andcommitted
Fix for cargo ci dlls missing some .meta files (#4178)
# Description of Changes This patches a regression introduced in [#4033](#4033) where cargo ci dlls stopped copying the Unity .meta files that live outside the package skeleton tree: 1. `overlay_unity_meta_skeleton` now copies any `sdks/csharp/unity-meta-skeleton~/spacetimedb.<pkg>.meta` file into `sdks/csharp/packages/` before overlaying nested content. 2. Added support for a `version.meta` template inside each skeleton package; it’s renamed to match the single restored version directory (e.g. `1.11.2.meta`). 3. Added the missing `version.meta` templates for both `spacetimedb.bsatn.runtime` and `spacetimedb.runtime`, based on the historical GUIDs Unity already knows about. Together this restores the `spacetimedb.bsatn.runtime.meta` and `<version>.meta` files that Unity requires to keep those folders visible when developers run `cargo ci dlls` on a clean checkout. # API and ABI breaking changes None. This only affects the CI helper responsible for syncing Unity metadata. # Expected complexity level and risk 2 — localized changes to the CI helper and skeleton assets. Primary risk is forgetting a template or mis-copying a GUID; the code paths themselves are straightforward. # Testing - [X] Ran `cargo check -p ci` - [X] Ran `cargo ci dlls` on a clean tree, verifying that: * `sdks/csharp/packages/spacetimedb.bsatn.runtime.meta` exists * The restored version directory (e.g. `sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2.meta`) exists - [X] Locally launched Unity with a SpacetimeDB project and had no errors/issues.
1 parent 56d7cc8 commit c0a91c0

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

sdks/csharp/unity-meta-skeleton~/spacetimedb.bsatn.runtime/version.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/csharp/unity-meta-skeleton~/spacetimedb.runtime/version.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/ci/src/main.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ fn check_global_json_policy() -> Result<()> {
9595
}
9696

9797
fn overlay_unity_meta_skeleton(pkg_id: &str) -> Result<()> {
98-
let skeleton_root = Path::new("sdks/csharp/unity-meta-skeleton~").join(pkg_id);
98+
let skeleton_base = Path::new("sdks/csharp/unity-meta-skeleton~");
99+
let skeleton_root = skeleton_base.join(pkg_id);
99100
if !skeleton_root.exists() {
100101
return Ok(());
101102
}
@@ -105,6 +106,15 @@ fn overlay_unity_meta_skeleton(pkg_id: &str) -> Result<()> {
105106
return Ok(());
106107
}
107108

109+
// Copy spacetimedb.<pkg>.meta
110+
let pkg_root_meta = skeleton_base.join(format!("{pkg_id}.meta"));
111+
if pkg_root_meta.exists() {
112+
if let Some(parent) = pkg_root.parent() {
113+
let pkg_meta_dst = parent.join(format!("{pkg_id}.meta"));
114+
fs::copy(&pkg_root_meta, &pkg_meta_dst)?;
115+
}
116+
}
117+
108118
let versioned_dir = match find_only_subdir(&pkg_root) {
109119
Ok(dir) => dir,
110120
Err(err) => {
@@ -113,6 +123,18 @@ fn overlay_unity_meta_skeleton(pkg_id: &str) -> Result<()> {
113123
}
114124
};
115125

126+
// If version.meta exists under the skeleton package, rename it to match the restored version dir.
127+
let version_meta_template = skeleton_root.join("version.meta");
128+
if version_meta_template.exists() {
129+
if let Some(parent) = versioned_dir.parent() {
130+
let version_name = versioned_dir
131+
.file_name()
132+
.expect("versioned directory should have a file name");
133+
let version_meta_dst = parent.join(format!("{}.meta", version_name.to_string_lossy()));
134+
fs::copy(&version_meta_template, &version_meta_dst)?;
135+
}
136+
}
137+
116138
copy_overlay_dir(&skeleton_root, &versioned_dir)
117139
}
118140

0 commit comments

Comments
 (0)