Add tests to CI

This commit is contained in:
Wojciech Figat
2022-01-14 14:20:41 +01:00
parent d032f18b71
commit 992333fd64
17 changed files with 169 additions and 8 deletions

View File

@@ -34,8 +34,8 @@ namespace Flax.Build.Projects.VisualStudio
var projectFileToolVersion = ProjectFileToolVersion;
var projectDirectory = Path.GetDirectoryName(project.Path);
var defaultTarget = project.Targets[0];
var defaultConfiguration = defaultTarget.Configurations.First();
var defaultArchitecture = defaultTarget.Architectures.First();
var defaultConfiguration = TargetConfiguration.Debug;
var defaultArchitecture = TargetArchitecture.AnyCPU;
var projectTypes = ProjectTypeGuids.ToOption(ProjectTypeGuids.WindowsCSharp);
if (vsProject.CSharp.UseFlaxVS && VisualStudioInstance.HasFlaxVS)
projectTypes = ProjectTypeGuids.ToOption(ProjectTypeGuids.FlaxVS) + ';' + projectTypes;
@@ -75,6 +75,45 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" </PropertyGroup>");
// Default configuration
{
var configuration = project.Configurations.First();
foreach (var e in project.Configurations)
{
if (e.Configuration == defaultConfiguration && e.Target == defaultTarget && e.Platform == Platform.BuildTargetPlatform)
{
configuration = e;
break;
}
}
var defines = string.Join(";", project.Defines);
if (configuration.TargetBuildOptions.ScriptingAPI.Defines.Count != 0)
{
if (defines.Length != 0)
defines += ";";
defines += string.Join(";", configuration.TargetBuildOptions.ScriptingAPI.Defines);
}
var outputPath = Utilities.MakePathRelativeTo(project.CSharp.OutputPath ?? configuration.TargetBuildOptions.OutputFolder, projectDirectory);
var intermediateOutputPath = Utilities.MakePathRelativeTo(project.CSharp.IntermediateOutputPath ?? Path.Combine(configuration.TargetBuildOptions.IntermediateFolder, "CSharp"), projectDirectory);
csProjectFileContent.AppendLine(string.Format(" <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", defaultConfiguration, defaultArchitecture));
csProjectFileContent.AppendLine(" <DebugSymbols>true</DebugSymbols>");
csProjectFileContent.AppendLine(" <DebugType>portable</DebugType>");
csProjectFileContent.AppendLine(string.Format(" <Optimize>{0}</Optimize>", defaultConfiguration == TargetConfiguration.Debug ? "false" : "true"));
csProjectFileContent.AppendLine(string.Format(" <OutputPath>{0}\\</OutputPath>", outputPath));
csProjectFileContent.AppendLine(string.Format(" <BaseIntermediateOutputPath>{0}\\</BaseIntermediateOutputPath>", intermediateOutputPath));
csProjectFileContent.AppendLine(string.Format(" <IntermediateOutputPath>{0}\\</IntermediateOutputPath>", intermediateOutputPath));
csProjectFileContent.AppendLine(string.Format(" <DefineConstants>{0}</DefineConstants>", defines));
csProjectFileContent.AppendLine(" <ErrorReport>prompt</ErrorReport>");
csProjectFileContent.AppendLine(" <WarningLevel>4</WarningLevel>");
csProjectFileContent.AppendLine(" <AllowUnsafeBlocks>true</AllowUnsafeBlocks>");
if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings)
csProjectFileContent.AppendLine(" <NoWarn>1591</NoWarn>");
csProjectFileContent.AppendLine(string.Format(" <DocumentationFile>{0}\\{1}.CSharp.xml</DocumentationFile>", outputPath, project.Name));
csProjectFileContent.AppendLine(" <UseVSHostingProcess>true</UseVSHostingProcess>");
csProjectFileContent.AppendLine(" </PropertyGroup>");
}
// Configurations
foreach (var configuration in project.Configurations)
{