Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ zig-out/
zig-cache/

# JetBrains cache directory
.idea/
.idea/

Jolt~/
.DS_Store
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "Jolt.Native~/lib/jolt"]
path = Jolt.Native~/lib/jolt
url = git@github.com:jrouwe/JoltPhysics.git
3 changes: 3 additions & 0 deletions Jolt.Internal.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Jolt.Internal/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("Jolt")]
3 changes: 3 additions & 0 deletions Jolt.Internal/AssemblyInfo.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions Jolt.Internal/JoltNativeInternalUtility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Runtime.CompilerServices;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;

namespace Jolt.Internal
{
internal static class JoltNativeInternalUtility
{
public static void LeakRecord(IntPtr handle, int callstacksToSkip)
{
UnsafeUtility.LeakRecord(handle, LeakCategory.Persistent, callstacksToSkip);
}

public static void LeakErase(IntPtr handle)
{
UnsafeUtility.LeakErase(handle, LeakCategory.Persistent);
}

unsafe struct UnsafeHeader<TPtr> where TPtr : unmanaged
{
public TPtr** Ptr;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
internal AtomicSafetyHandle m_Safety;
#endif
}

public static unsafe void Initialize<TStruct, TPtr>(ref TStruct t, TPtr* ptr) where TStruct : unmanaged where TPtr : unmanaged
{
ref var header = ref UnsafeUtility.As<TStruct, UnsafeHeader<TPtr>>(ref t);
header.Ptr = (TPtr**)UnsafeUtility.MallocTracked(sizeof(TPtr*), UnsafeUtility.AlignOf<IntPtr>(), Allocator.Persistent, 1);
*header.Ptr = ptr;
}
}
}
3 changes: 3 additions & 0 deletions Jolt.Internal/JoltNativeInternalUtility.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Jolt.Internal/Unity.InternalAPIEngineBridge.013.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Unity.InternalAPIEngineBridge.013",
"rootNamespace": "",
"references": [
"GUID:2665a8d13d1b3f18800f46e256720795"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
3 changes: 3 additions & 0 deletions Jolt.Internal/Unity.InternalAPIEngineBridge.013.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Jolt.Native/Release/macos-arm64/libjoltc.dylib
Binary file not shown.
2 changes: 0 additions & 2 deletions Jolt.Native/Release/macos-arm64/libjoltc.dylib.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Jolt.Native/Release/macos-x64.meta

This file was deleted.

Binary file removed Jolt.Native/Release/macos-x64/libjoltc.dylib
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Jolt.Native/Release/macos/libjoltc.dylib
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Jolt.Native/Release/windows-x64/joltc.dll
Binary file not shown.
1 change: 0 additions & 1 deletion Jolt.Native~/lib/jolt
Submodule jolt deleted from 0373ec
2 changes: 2 additions & 0 deletions Jolt.SourceGenerator~/Folder.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGeneratorContexts_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F96d012ee6a331cddbfb8414694d0205a3887708a5f82fe73c87c1350c31d80_003FGeneratorContexts_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.3.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Jolt.SourceGenerator\Jolt.SourceGenerator.csproj" />
</ItemGroup>

</Project>
33 changes: 33 additions & 0 deletions Jolt.SourceGenerator~/Jolt.SourceGenerator.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.CodeAnalysis;
using Xunit;
using Xunit.Abstractions;

namespace Jolt.SourceGenerator.Tests;

public class Tests(ITestOutputHelper outputHelper)
{
private ITestOutputHelper m_OutputHelper = outputHelper;
[Fact]
public void Test1()
{
(string, IncrementalStepRunReason Unchanged)[] validations =
[
("TypeMeta", IncrementalStepRunReason.Unchanged)
];

var (driver, _) = Utility.CreateDriver<JoltGenerator>(
File.ReadAllText("../../../UnsafeBindings.txt"), "Jolt"/*, validations*/);

// 检查缓存
var ret = driver.GetRunResult();
var generateRet = ret.Results.Single();

Assert.Null(generateRet.Exception);

m_OutputHelper.WriteLine("----------------Source----------------");
foreach (var source in generateRet.GeneratedSources)
{
m_OutputHelper.WriteLine(source.SourceText.ToString());
}
}
}
Loading
Loading