Make Unity publishing easier #143
reeseschultz
started this conversation in
Ideas
Replies: 1 comment 16 replies
-
First of all, thank you for your interest in Arch, your kind words and this post here! :) The only question I have is, would removing PrivateAssets="all" have any disadvantage? Should it be removed completely or set to another value instead? And could it lead to potential problems? |
Beta Was this translation helpful? Give feedback.
16 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@genaray I've been integrating Arch into Unity (for reasons), and noticed something peculiar.
Long-winded exposition
For Arch itself (edit: and non-codegen extensions), I only needed to pull these nuggets/transitive nuggets (2.7MB):
And then Arch works beautifully. Note the absence of Roslyn (Microsoft.CodeAnalysis), despite the fact that
IIncrementalGenerator
is used in base Arch. So... how is codegen happening at all? Refer to sschmid/Entitas#1005 (comment). I'm assuming you must be intentionally using4.1.0
for the same reason as the creator of Entitas (even though Unity's documentation is clearly wrong)? Or is this just a coincidence?I figure the native Roslyn support was instigated by the extensive codegen in the Entities package for DOTS, which I might be familiar with. The project I'm testing Arch in is not directly using DOTS (yet), but Roslyn is still generally accessible. We know that DOTS is invisibly subsuming old editor/runtime features to fend off tech debt, so this makes sense.
The problem
All of that brings me to Arch.Extended. The codegen extensions are all doing this in their respective
csproj
:Pay attention to
PrivateAssets="all"
. Base Arch codegen does not include that key-value pair. Keeping it in the extensions, or at all, is a problem for Unity users, assuming you want to support them (I think you should, because Arch can actually help them transition away from being directly dependent on its capabilities). And remember that Unity has never properly addressed dependency management, so that leaves three options for pulling Roslyn and its transitive dependencies:SQLitePCLRaw.batteries_v2
not being where no human nor machine would intuit)So what has to be pulled down when
PrivateAssets="all"
? About 31MB of:Not only does this make direct Arch-Unity integration a massive pain, but also: what if I want to supply a UPM package that uses Arch.Extended as a dependency? (Which maybe I do.) Packing 2.7MB of DLLs into a package, with correct author/license attribution, is not awesome, but not horrible. The additional 31MB is pretty bad, though, especially when NuGet itself can't determine where one dependency is supposed to come from. Fortunately all of the nuggets are Apache 2.0 or MIT-licensed (mostly MIT), so redistribution is perfectly fine from a legal perspective either way.
Concluding thoughts
Please consider my proposal to remove all instances of
PrivateAssets="all"
from yourcsproj
files in the context of Roslyn. That's all I'm asking. Your users may end up using codegen anyway. Is it technically the right thing to expose your dependencies to them? Well, generally no, but this is a case where an exception should be made. It would seem I too am headed down codegen alley, despite regarding it as an anti-pattern in my past life as an enterprise dev. Seems like Rust is the only popular language properly geared for ECS due its trait system.Obligatory regards: Arch is awesome. You're a veritable ECS prodigy. What you're doing is fantastic for Mono, Unity, Godot and other C# game devs, and you should be proud of yourself.
Beta Was this translation helpful? Give feedback.
All reactions