You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- optional alter of source file build order: towards beginning or end - test build: correctly handle inclusion of special dependencies such as Engine, Editor, CoreUObject and ApplicationCore - existing tests: add setup and teardown tests that initialize test modules. This causes setup and teardown to be local to module instead of global, which was not the correct way to run tests across multiple modules. #preflight 62151e43dc0170cfb3649ee8 #rb Jermoe.Delattre [CL 19076600 by chris constantinescu in ue5-main branch]
94 lines
2.8 KiB
C#
94 lines
2.8 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using EpicGames.Core;
|
|
using System.IO;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
/// <summary>
|
|
/// ModuleRules extension for low level tests.
|
|
/// </summary>
|
|
public class TestModuleRules : ModuleRules
|
|
{
|
|
/// <summary>
|
|
/// Associated tested module of this test module.
|
|
/// </summary>
|
|
public ModuleRules TestedModule { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Constructs a TestModuleRules object with an associated tested module.
|
|
/// </summary>
|
|
public TestModuleRules(ModuleRules TestedModule) : base(new ReadOnlyTargetRules(TestedModule.Target.TestTarget))
|
|
{
|
|
this.TestedModule = TestedModule;
|
|
|
|
Name = TestedModule.Name + "Tests";
|
|
if (!string.IsNullOrEmpty(TestedModule.ShortName))
|
|
{
|
|
ShortName = TestedModule.ShortName + "Tests";
|
|
}
|
|
|
|
File = FileReference.Combine(UnrealBuildTool.EngineSourceDirectory, "UnrealBuildTool", "Configuration", "TestModuleRules.cs");
|
|
Directory = DirectoryReference.Combine(TestedModule.Directory, "Tests");
|
|
|
|
Context = TestedModule.Context;
|
|
|
|
PCHUsage = PCHUsageMode.NoPCHs;
|
|
PrecompileForTargets = PrecompileTargetsType.None;
|
|
|
|
if (Target.Configuration == UnrealTargetConfiguration.Debug && Target.Platform == UnrealTargetPlatform.Linux)
|
|
{
|
|
OptimizeCode = CodeOptimization.Never;
|
|
}
|
|
|
|
bAllowConfidentialPlatformDefines = true;
|
|
bLegalToDistributeObjectCode = true;
|
|
|
|
// Required false for catch.hpp
|
|
bUseUnity = false;
|
|
|
|
// Disable exception handling so that tests can assert for exceptions
|
|
bEnableObjCExceptions = false;
|
|
bEnableExceptions = false;
|
|
|
|
string SetupFile = Path.Combine("Private", "setup.cpp");
|
|
string TeardownFile = Path.Combine("Private", "teardown.cpp");
|
|
if (System.IO.File.Exists(Path.Combine(Directory.ToString(), SetupFile)))
|
|
{
|
|
BuildOrderSettings.AddBuildOrderOverride(SetupFile, SourceFileBuildOrder.First);
|
|
}
|
|
if (System.IO.File.Exists(Path.Combine(Directory.ToString(), TeardownFile)))
|
|
{
|
|
BuildOrderSettings.AddBuildOrderOverride(TeardownFile, SourceFileBuildOrder.Last);
|
|
}
|
|
|
|
PrivateDependencyModuleNames.AddRange(TestedModule.PrivateDependencyModuleNames);
|
|
|
|
if (!PrivateDependencyModuleNames.Contains("LowLevelTestsRunner"))
|
|
{
|
|
PrivateDependencyModuleNames.Add("LowLevelTestsRunner");
|
|
}
|
|
|
|
// Tests can refer to tested module's Public and Private paths
|
|
string ModulePublicDir = Path.Combine(TestedModule.ModuleDirectory, "Public");
|
|
if (System.IO.Directory.Exists(ModulePublicDir))
|
|
{
|
|
PublicIncludePaths.Add(ModulePublicDir);
|
|
}
|
|
|
|
string ModulePrivateDir = Path.Combine(TestedModule.ModuleDirectory, "Private");
|
|
if (System.IO.Directory.Exists(ModulePrivateDir))
|
|
{
|
|
PrivateIncludePaths.Add(ModulePrivateDir);
|
|
}
|
|
|
|
|
|
// Platforms specific setup
|
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
|
{
|
|
PublicDefinitions.Add("CATCH_CONFIG_NOSTDOUT");
|
|
}
|
|
}
|
|
}
|
|
}
|