Skip to content

Conversation

@rekhoff
Copy link
Contributor

@rekhoff rekhoff commented Jan 14, 2026

Description of Changes

  • Added a new cargo ci dlls subcommand to build/pack the in-repo C# NuGet packages and the C# SDK.
  • cargo ci dlls restores sdks/csharp/SpacetimeDB.ClientSDK.csproj using the freshly built local package outputs as to populate sdks/csharp/packages/**.
  • Added a Unity .meta skeleton under sdks/csharp/unity-meta-skeleton~/** and overlays those .meta files onto the latest restored versioned package directory to keep Unity GUIDs stable and import settings consistent.
  • Unity-specific import fixes are captured in the skeleton overlay (notably: preventing Unity from importing incompatible TFMs like net8.0, and marking analyzer DLLs with the RoslynAnalyzer label so Unity can recognize them).

How to use (local)

# Build/pack + restore local packages into sdks/csharp/packages/**
cargo ci dlls

API and ABI breaking changes

N/A

Expected complexity level and risk

2 - Local developer tooling + file overlay into restore output; no runtime/SDK API behavior changes.

Testing

  • cargo check -p ci
  • Ran cargo ci dlls and verified the output under sdks/csharp/packages/** and the various NuGet package locations.
  • Tested a Unity project importing the SpacetimeDB SDK after generating output and confirmed no errors.

@rekhoff rekhoff self-assigned this Jan 14, 2026
@rekhoff rekhoff requested review from bfops and jdetter January 14, 2026 23:29
@rekhoff rekhoff marked this pull request as ready for review January 15, 2026 16:27

match best.as_ref() {
None => best = Some((version, entry.path())),
Some((best_v, _)) if version > *best_v => best = Some((version, entry.path())),
Copy link
Collaborator

@bfops bfops Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it's fine to just pick the first dir (and maybe assert that there is at most 1), especially since we nuke all subdirs of the package's directory beforehand anyway.

(if you make that change, I would add a comment to that effect though)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. Implemented, and added an error message instead of a comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh what I was saying was that I don't think we even need to parse versions, or sort or anything. Like are there going to be other subdirectories hanging around in a package dir?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine the way it is too, just a nit

@@ -0,0 +1,8 @@
fileFormatVersion: 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on my system the netstandard2.1 versions get restored, not the net8.0 versions. Is it maybe platform-dependent? Maybe we should copy the net8.0 meta files into a netstandard2.1structure as well, since the code already skips.meta` files for assets that don't exist at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, SpacetimeDB.ClientSDK.csproj references SpacetimeDB.BSATN.Runtime and that package is multi-targeted (netstandard2.1 and net8.0). I don't recall the specifics on if that was because of platform-dependances, but it's plausible to you have a netstandard2.1 artifacts locally. Luckily the overlay copies .meta only for assets that exist, so we shouldn’t need to duplicate net8.0 metas into a netstandard2.1 structure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah it looks like the net8.0 one gets populated for me during dotnet pack but not dotnet restore 🤔 interesting. What we had tracked in the repo before this PR didn't include net8.0.. I'm not sure what Unity ends up using.. seems fine to include it though.

but what I'm saying is that my netstandard2.1 gets populated with a dll during this process, so I think it also needs a meta file?

git ls-files sdks/csharp/packages/
sdks/csharp/packages/.gitignore
sdks/csharp/packages/spacetimedb.bsatn.runtime.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/analyzers.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/analyzers/dotnet.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/analyzers/dotnet/cs.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/analyzers/dotnet/cs/SpacetimeDB.BSATN.Codegen.dll
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/analyzers/dotnet/cs/SpacetimeDB.BSATN.Codegen.dll.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib/net8.0.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib/net8.0/SpacetimeDB.BSATN.Runtime.dll
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib/net8.0/SpacetimeDB.BSATN.Runtime.dll.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib/netstandard2.1.meta
sdks/csharp/packages/spacetimedb.bsatn.runtime/1.11.2/lib/netstandard2.1/SpacetimeDB.BSATN.Runtime.dll

^ that last file is missing a .meta file.

Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty great to me. I left some nits, and I think there may be some remaining meta dance to do.

also, I see more files getting restored such as LICENSE and logo.png, so I think we should possibly do what #3648 did and add a gitignore for those files as well.

@rekhoff
Copy link
Contributor Author

rekhoff commented Jan 16, 2026

This looks pretty great to me. I left some nits, and I think there may be some remaining meta dance to do.

also, I see more files getting restored such as LICENSE and logo.png, so I think we should possibly do what #3648 did and add a gitignore for those files as well.

Updated .gitignore to ignore those restore artifacts and keep only lib/** + analyzers/**

@@ -0,0 +1,8 @@
fileFormatVersion: 2
Copy link
Collaborator

@bfops bfops Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait is this file needed? I thought unity-meta-skeleton~ would make it ignored by unity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants