Closed joncham closed 1 year ago
Merging #319 (c2e8ca5) into main (359b753) will decrease coverage by
0.28%
. The diff coverage is81.96%
.
@@ Coverage Diff @@
## main #319 +/- ##
==========================================
- Coverage 96.41% 96.13% -0.29%
==========================================
Files 111 115 +4
Lines 8563 8742 +179
Branches 803 815 +12
==========================================
+ Hits 8256 8404 +148
- Misses 204 230 +26
- Partials 103 108 +5
Impacted Files | Coverage Δ | |
---|---|---|
src/FlatSharp.UnityPolyfills/NativeArray.cs | 69.84% <69.84%> (ø) |
|
...peModel/Vectors/UnityNativeArrayVectorTypeModel.cs | 82.08% <82.08%> (ø) |
|
src/FlatSharp/TypeModel/UnityTypeModelProvider.cs | 83.33% <83.33%> (ø) |
|
src/FlatSharp.Compiler/FlatSharpCompiler.cs | 96.94% <100.00%> (+0.13%) |
:arrow_up: |
...atSharp.Compiler/SchemaModel/PropertyFieldModel.cs | 95.92% <100.00%> (+0.01%) |
:arrow_up: |
src/FlatSharp.Runtime/IO/InputBufferExtensions.cs | 96.29% <100.00%> (+0.55%) |
:arrow_up: |
src/FlatSharp.Runtime/IO/SpanWriterExtensions.cs | 100.00% <100.00%> (ø) |
|
...latSharp/TypeModel/TypeModelContainerExtensions.cs | 100.00% <100.00%> (ø) |
|
src/FlatSharp.Runtime/IO/ArrayInputBuffer.cs | 100.00% <0.00%> (+1.58%) |
:arrow_up: |
src/FlatSharp.Runtime/IO/MemoryInputBuffer.cs | 100.00% <0.00%> (+1.58%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 359b753...c2e8ca5. Read the comment docs.
I pushed some changes that address many of the issues raised and with some other differences. I can add more details later, but quickly:
--unity-assembly-path
which a) enables Unity support b) takes a path to an assembly providing Unity APIsNext, I'll look into proper lazy deserialization/pinned support for NativeArray deserialization (avoiding the copy).
@jamescourtney is it worth splitting this PR up a bit? For example the IsPinned
property on the buffer interface/implementations?
@jamescourtney is it worth splitting this PR up a bit? For example the
IsPinned
property on the buffer interface/implementations?
I'm comfortable with the size of it, but I'll be happy to go whatever way you want. I'm also happy to check in and iterate as long as we have items to track various discussion points.
Okay, with 327fe1feda803e96904f29d5174cb79bb9282e74 I have:
InputBufferExtensions
and SpanWriterExtensions
to read/write from a Spansrc/FlatSharp.UnityPolyfills/UnityExtensions.cs
This means src/FlatSharp.UnityPolyfills
is solely for testing purposes and should only contain stubs for existing Unity public APIs. It should not need included in a new or existing NuGet package. I'll rename it in a subsequent PR. Should it move until the Tests directory?
It also means that no extra source file is needed for "deployment" into Unity anymore implementing the read/write methods.
And thanks for the help and feedback @jamescourtney , I think we are iterating to a good solution.
@joncham -- You may need to merge from main. One thing to keep in mind is that I've upgraded to target .net 7, which may cause Visual Studio to be unhappy. Unless you want to install the preview, just remove net7.0
from the various .csproj elements to unblock yourself.
@joncham -- are you waiting on me to review here? I did take a quick look at your latest changes, but saw that the alignment issue I mentioned before wasn't fixed, so I didn't add any new comments because I assumed you were not done. Let me know if I've missed something or you are waiting on input from me. Thanks!
@joncham -- are you waiting on me to review here? I did take a quick look at your latest changes, but saw that the alignment issue I mentioned before wasn't fixed, so I didn't add any new comments because I assumed you were not done. Let me know if I've missed something or you are waiting on input from me. Thanks!
@jamescourtney no, I am trying out the changes in some Unity scenarios to make sure things are working as I expect. I'll update PR to address your comments in coming days.
Hi @joncham -- I'm going to take your breaking changes for .IsPinned
and the Memory<byte>
constructor and go ahead and commit those on their own. I'm eager to get Flatsharp v7 released and taking just these changes will make the rest of this not a breaking change.
Hi @joncham -- I'm going to take your breaking changes for
.IsPinned
and theMemory<byte>
constructor and go ahead and commit those on their own. I'm eager to get Flatsharp v7 released and taking just these changes will make the rest of this not a breaking change.
Thanks @jamescourtney , I appreciate you grabbing those changes!
Note, I pushed a rebased branch. I still didn't address all issues yet @jamescourtney but wanted to keep branch up to date.
Note, I pushed a rebased branch. I still didn't address all issues yet @jamescourtney but wanted to keep branch up to date.
That sounds good. Sorry for any merge conflicts. I hope that you didn't have too difficult of a time. The branch is going to be mostly quiescent for awhile now. I'm starting to work on moving some test from reflection based execution to precompiled, but I won't be touching the main code for awhile. Thanks for your work here! Looking forward to publishing this when it's done :)
Hey @joncham -- thanks for the latest push. That looks reasonable to me. Do you feel that you are ready to merge?
@jamescourtney I am actively using this branch now in Unity, so I am comfortable enough merging if you are.
Hey @jamescourtney just pinging again to get your thoughts.
Hey @jamescourtney just pinging again to get your thoughts.
Hey! Sorry about this. I intentionally tried to unplug a bit during the holidays, but I'm (reluctantly) back to work now so will take a look at this soon.
Implementation for issue https://github.com/jamescourtney/FlatSharp/issues/303
Initial work to support Unity's NativeArray as a supported vector type.
Highlights:
FlatSharp.Compiler.UnityStub
(naming?) added to provide stub/polyfill APIs needed for schema compilation as well as test compilation.src/FlatSharp.Compiler.UnityStub/UnityExtensions.cs
provides the glue to Unity APIs.FLATSHARP_UNITY_POLYFILLS
define) theNativeArray
type is stubbed and extension methods for reading/writing are empty, allowing the usage of types and API surfaces but no functionality.NativeArray
is provided by Unity assemblies and the reading/writing methods are implemented against further Unity APIs.FlatSharp.Compiler.UnityStub
assembly will be deployed with the compiler, but should never be used at runtime in a Unity contextOpen Questions
NativeArray
is constructed from the buffer/memory passed intoReadNativeArrayBlock
. A copy is not performed. Is it safe to assume this memory is native or pinned managed memory that will not be moved?Thanks!