11 Commits
Author SHA1 Message Date
crazytuziandkane 0c19c5e97e Support5.8 (#12)
* Change TargetFramework to net8.0 with inheritance

Updated TargetFramework to inherit from UnrealEngine.csproj.props with a fallback for engines that don't define it.

Also removed the explicit Microsoft.CSharp PackageReference: newer frameworks include it by default and the explicit reference triggers NU1510, which TreatWarningsAsErrors turns into an error.

* net10.0

---------

Co-authored-by: kane <202593226@qq.com>
2026-09-07 23:51:36 +08:00
crazytuzi 0f2fd1382f UTF-8 2026-07-07 19:09:50 +08:00
yawn831 e5c27effd7 feat: 头文件注释 (#10)
* feat: 头文件注释

* feat: 头文件注释提交
2026-01-22 10:31:06 +08:00
crazytuzi 7bcb7823a6 Merge pull request #8 from yawn831/Black
feat: 新增blacklist
2025-06-28 20:33:16 +08:00
yawn831831 197fbbe6ce feat: 新增blacklist 2025-06-28 01:12:32 +08:00
crazytuzi bf9949b5cb Merge pull request #7 from yawn831/fixerror
fix: 修复sg报错
2025-06-24 23:03:59 +08:00
yawn831831 fbe837fca9 fix: 修复sg报错 2025-06-24 23:01:35 +08:00
crazytuzi 4aac4cc1fc Merge pull request #5 from crazytuzi/5.3
Ignore props
2024-11-17 19:02:58 +08:00
crazytuzi 4a3273ec31 Ignore props 2024-11-17 19:02:44 +08:00
crazytuzi fa2f24a764 Merge pull request #4 from Srkmn/5.5
Cross Version
2024-11-17 17:16:52 +08:00
Srkmn 90c5058a4c Cross Version 2024-11-17 17:15:24 +08:00
3 changed files with 37 additions and 26 deletions

No files matched your search

+1
View File
@@ -74,3 +74,4 @@ Plugins/**/Intermediate/*
DerivedDataCache/*
obj/*
SourceCodeGenerator.ubtplugin.csproj.props
+34 -21
View File
@@ -62,6 +62,15 @@ namespace SourceCodeGeneratorUbtPlugin
private const string HeaderSuffix = ".header.inl";
private readonly HashSet<string> ClassBlacklist = new();
private const string GeneratedHeaderComment =
"/*===========================================================================\n" +
" Generated code exported from UnrealCSharp SourceCodeGenerator.\n" +
" DO NOT modify this manually!\n" +
"===========================================================================*/\n" +
"\n";
public SourceCodeGenerator(IUhtExportFactory factory)
{
Factory = factory;
@@ -119,26 +128,37 @@ namespace SourceCodeGeneratorUbtPlugin
ExportModule.Add(value);
}
}
if (SettingConfigHierarchySection.TryGetValues("ClassBlacklist", out var BlacklistValues))
{
foreach (var value in BlacklistValues)
{
if (!string.IsNullOrEmpty(value))
{
ClassBlacklist.Add(value);
}
}
}
}
}
List<Task?> tasks = new();
foreach (var package in Session.Packages)
foreach (var module in Session.Modules)
{
if (package.Module.ModuleType != UHTModuleType.EngineRuntime &&
package.Module.ModuleType != UHTModuleType.GameRuntime)
if (module.Module.ModuleType != UHTModuleType.EngineRuntime &&
module.Module.ModuleType != UHTModuleType.GameRuntime)
{
continue;
}
if (ExportModule.All(module =>
string.Compare(module, package.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
if (ExportModule.All(x =>
string.Compare(x, module.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
{
continue;
}
QueueClassExports(package, tasks);
QueueClassExports(module.ScriptPackage, tasks);
}
var waitTasks = tasks.Where(Task => Task != null).Cast<Task>().ToArray();
@@ -179,7 +199,8 @@ namespace SourceCodeGeneratorUbtPlugin
/// <returns>True if the class should be exported, false if not</returns>
protected virtual bool CanExportClass(UhtClass classObj)
{
return !classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
return !ClassBlacklist.Contains(classObj.SourceName) &&
!classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
IsClassTypeSupported(classObj);
}
@@ -275,14 +296,6 @@ namespace SourceCodeGeneratorUbtPlugin
}
}
if (property is UhtObjectPtrProperty objectPtrProperty)
{
if (!IsClassTypeSupported(objectPtrProperty.Class))
{
return false;
}
}
if (property is UhtInterfaceProperty interfaceProperty)
{
if (interfaceProperty.InterfaceClass == interfaceProperty.Session.IInterface)
@@ -360,6 +373,8 @@ namespace SourceCodeGeneratorUbtPlugin
var builder = borrow.StringBuilder;
builder.Append(GeneratedHeaderComment);
builder.Append("#pragma once\r\n\r\n");
foreach (var value in package.Value)
@@ -367,7 +382,7 @@ namespace SourceCodeGeneratorUbtPlugin
builder.Append(GenerateInclude($"{value}{BindingSuffix}"));
}
var fileName = Factory.MakePath(package.Key, HeaderSuffix);
var fileName = Factory.MakePath(package.Key.Module, HeaderSuffix);
SaveIfChanged(fileName, builder);
}
@@ -375,6 +390,8 @@ namespace SourceCodeGeneratorUbtPlugin
private bool ExportClass(StringBuilder builder, UhtClass classObj)
{
builder.Append(GeneratedHeaderComment);
builder.Append("#pragma once\r\n\r\n" +
"PRAGMA_DISABLE_DEPRECATION_WARNINGS\r\n\r\n");
@@ -463,10 +480,6 @@ namespace SourceCodeGeneratorUbtPlugin
DependencyClasses.Add(classProperty.MetaClass);
}
}
else if (property is UhtObjectPtrProperty objectPtrProperty)
{
DependencyClasses.Add(objectPtrProperty.Class);
}
else if (property is UhtObjectProperty objectProperty)
{
DependencyClasses.Add(objectProperty.Class);
@@ -759,7 +772,7 @@ namespace SourceCodeGeneratorUbtPlugin
private string GetHeaderFile(UhtClass classObj)
{
return Path.Combine(HeaderPath[classObj.Package.ShortName], classObj.HeaderFile.FilePath);
return Path.Combine(HeaderPath[classObj.Package.Module.ShortName], classObj.HeaderFile.FilePath);
}
private static string GenerateInclude(string file)
+2 -5
View File
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="SourceCodeGenerator.ubtplugin.csproj.props" Condition="Exists('SourceCodeGenerator.ubtplugin.csproj.props')" />
<Import Project="$(EngineDir)\Source\Programs\Shared\UnrealEngine.csproj.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Configuration Condition=" '$(Configuration)' == '' ">Development</Configuration>
<OutputType>Library</OutputType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
@@ -29,9 +29,6 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="EpicGames.Build">
<HintPath>$(EngineDir)\Binaries\DotNET\UnrealBuildTool\EpicGames.Build.dll</HintPath>