-
Notifications
You must be signed in to change notification settings - Fork 671
Add cargo ci dlls command for building C# DLLs and NuGet packages
#4033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…d NuGet packages
tools/ci/src/main.rs
Outdated
|
|
||
| match best.as_ref() { | ||
| None => best = Some((version, entry.path())), | ||
| Some((best_v, _)) if version > *best_v => best = Some((version, entry.path())), |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
bfops
left a comment
There was a problem hiding this 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.
Updated |
| @@ -0,0 +1,8 @@ | |||
| fileFormatVersion: 2 | |||
There was a problem hiding this comment.
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.
Description of Changes
cargo ci dllssubcommand to build/pack the in-repo C# NuGet packages and the C# SDK.cargo ci dllsrestoressdks/csharp/SpacetimeDB.ClientSDK.csprojusing the freshly built local package outputs as to populatesdks/csharp/packages/**..metaskeleton undersdks/csharp/unity-meta-skeleton~/**and overlays those.metafiles onto the latest restored versioned package directory to keep Unity GUIDs stable and import settings consistent.net8.0, and marking analyzer DLLs with theRoslynAnalyzerlabel so Unity can recognize them).How to use (local)
# Build/pack + restore local packages into sdks/csharp/packages/** cargo ci dllsAPI 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 cicargo ci dllsand verified the output undersdks/csharp/packages/**and the various NuGet package locations.