refactor(srp): split universal managed pipeline assembly

This commit is contained in:
2026-04-19 05:03:56 +08:00
parent f45b34a03a
commit 5fa209ab5d
15 changed files with 231 additions and 44 deletions

View File

@@ -250,6 +250,8 @@ EditorScriptAssemblyBuildResult EditorScriptAssemblyBuilder::RebuildProjectAssem
const fs::path outputDirectory = projectRoot / "Library" / "ScriptAssemblies";
const fs::path generatedDirectory = outputDirectory / "Generated";
const fs::path scriptCoreOutputPath = outputDirectory / "XCEngine.ScriptCore.dll";
const fs::path renderPipelinesUniversalOutputPath =
outputDirectory / "XCEngine.RenderPipelines.Universal.dll";
const fs::path gameScriptsOutputPath = outputDirectory / "GameScripts.dll";
const fs::path corlibOutputPath = outputDirectory / "mscorlib.dll";
const fs::path monoCorlibSourcePath = monoRoot / "binary" / "mscorlib.dll";
@@ -306,11 +308,33 @@ EditorScriptAssemblyBuildResult EditorScriptAssemblyBuilder::RebuildProjectAssem
return BuildFailure("Mono corlib was not found: " + ScriptBuilderPathToUtf8(monoCorlibSourcePath));
}
std::vector<fs::path> scriptCoreSources = CollectCSharpSourceFiles(scriptCoreSourceRoot);
const std::vector<fs::path> allScriptCoreSources =
CollectCSharpSourceFiles(scriptCoreSourceRoot);
std::vector<fs::path> scriptCoreSources;
std::vector<fs::path> renderPipelinesUniversalSources;
scriptCoreSources.reserve(allScriptCoreSources.size());
renderPipelinesUniversalSources.reserve(allScriptCoreSources.size());
for (const fs::path& sourcePath : allScriptCoreSources) {
const std::string relativePath =
sourcePath.lexically_relative(scriptCoreSourceRoot)
.generic_string();
if (relativePath.rfind("Rendering/Renderer/", 0) == 0 ||
relativePath.rfind("Rendering/FirstParty/", 0) == 0) {
renderPipelinesUniversalSources.push_back(sourcePath);
} else {
scriptCoreSources.push_back(sourcePath);
}
}
if (scriptCoreSources.empty()) {
return BuildFailure("No ScriptCore C# source files were found under: " +
ScriptBuilderPathToUtf8(scriptCoreSourceRoot));
}
if (renderPipelinesUniversalSources.empty()) {
return BuildFailure(
"No RenderPipelines.Universal C# source files were found under: " +
ScriptBuilderPathToUtf8(scriptCoreSourceRoot / "Rendering"));
}
std::vector<fs::path> projectScriptSources = CollectCSharpSourceFiles(projectRoot / "Assets");
std::string placeholderError;
@@ -333,6 +357,22 @@ EditorScriptAssemblyBuildResult EditorScriptAssemblyBuilder::RebuildProjectAssem
return BuildFailure("Failed to build XCEngine.ScriptCore.dll: " + compileError);
}
std::vector<fs::path> renderPipelinesUniversalReferences =
frameworkReferences;
renderPipelinesUniversalReferences.push_back(scriptCoreOutputPath);
if (!RunCSharpCompiler(
dotnetExecutable,
cscDllPath,
projectRoot,
renderPipelinesUniversalOutputPath,
renderPipelinesUniversalReferences,
renderPipelinesUniversalSources,
compileError)) {
return BuildFailure(
"Failed to build XCEngine.RenderPipelines.Universal.dll: " +
compileError);
}
// Mono can keep the project-local corlib mapped for the lifetime of the process.
// Once it exists in the output folder, reuse it across incremental rebuilds.
ec.clear();
@@ -350,6 +390,7 @@ EditorScriptAssemblyBuildResult EditorScriptAssemblyBuilder::RebuildProjectAssem
std::vector<fs::path> gameScriptReferences = frameworkReferences;
gameScriptReferences.push_back(scriptCoreOutputPath);
gameScriptReferences.push_back(renderPipelinesUniversalOutputPath);
if (!RunCSharpCompiler(
dotnetExecutable,
cscDllPath,