Closed vangogih closed 9 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated |
---|---|---|---|---|
vcontainer | ✅ Ready (Inspect) | Visit Preview | 💬 Add your feedback | Mar 28, 2023 at 0:41AM (UTC) |
@hadashiA ping 😀
@vangogih Sorry for the late reply. I've been busy with another OSS work.
Big thanks for your a lot of work. I think a lot of people would find the stripping measure interesting.
However, due to several points, I'm currently considering not including this in the main repo.
@vangogih Sorry for the late reply. I've been busy with another OSS work.
Big thanks for your a lot of work. I think a lot of people would find the stripping measure interesting.
However, due to several points, I'm currently considering not including this in the main repo.
- Currently, I think Roslyn analyzer is the leading tool for static analysis of source code.
- Your algorithm is interesting, but maintaining both SoruceGenerator and this seems a bit much work.
- VContaienr has SoruceGenerator. If we can derive the classes that are being used reliably, it might be possible to mark them [Perserve]. I prefer that approach.
@hadashiA Thank for your review and comment!
I think either the PR is quite outdated now. And we can implement same functionality other ways with SourceGenerator feature.
I'm going to close this PR, thanks again)
Hi @hadashiA,
I have mentioned (#363) that I want to add the auto-addition all registered classes in scopes to link.xml. Here is proof of concept. I have already tested generation for
MonoBehaviours
,ScriptableObject
classes and classes withSerializable
attribute.How does it works: I made the same mechanism to turn on the feature as CodeGen. Via aditional asmdef
VContainer.EnableLinkGenerator
. You need to add that assebmly as dependency to your runtime asmdef to enable that feature. So enabling you can find in classVContainerLinkerProcessor
. That class tries to find the assembly withVContainer
andVContainer.EnableLinkGenerator
dependency. And if they are exist It starts to analyze all types in picked asseblies.The analyzer consists of:
SerializedField
attribute or derived fromComponent
orScriptableObject
.AddComponent
,ScriptableObject.Create
andActivator.CreateInstance
Cofigure
onLifetimeScope
to register all dependencies which defined in lifetime scopeNext, I have wrote a custom link.xml builder class (
VContainerXmlLinkBuilder
) which based om unity'sUnityEditor.Build.Pipeline.Utilities.LinkXmlGenerator
class, but more powerful. It allows to preserve methods, fields and properties without whole class preserving (asLinkXmlGemerator
does). I think that preserving all members by default is so frustrating feature.That feature works with Vcontainer as backbox and doesn't require to change any parts of runtime.
I want to get your comment about that idea before continue. Feel free to give feedback 😄 If you approve that feature I will:
SerializeReference
attribute and recurcive fields initialization forSerializable
classesp.s. feature is draft, but you can test in the editor if you need.