Skip to content

Commit

Permalink
Automatically build the "multiPackageProject" list from PackageVersio…
Browse files Browse the repository at this point in the history
…nsGeneratorDefinitions.json

There's no point building these twice, so previously we had a list of sample projects to not build. This simplifies things somewhat by loading the list dynamically
  • Loading branch information
andrewlock committed Jul 30, 2021
1 parent 1d2d1d1 commit 696301f
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Text.Json;
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
Expand Down Expand Up @@ -887,32 +887,35 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
"NLog10LogsInjection.NullReferenceException",
"Sandbox.ManualTracing",
"StackExchange.Redis.AssemblyConflict.LegacyProject",
"Samples.OracleMDA", // We don't test these yet
"Samples.OracleMDA.Core" // We don't test these yet
};
// These sample projects are built using RestoreAndBuildSamplesForPackageVersions
// so no point building them now
// TODO: Load this list dynamically
var multiApiProjects = new[]
List<string> multiPackageProjects;
var samplesFile = RootDirectory / "build" / "PackageVersionsGeneratorDefinitions.json";
using (var fs = File.OpenRead(samplesFile))
{
"Samples.CosmosDb",
"Samples.MongoDB",
"Samples.Elasticsearch",
"Samples.Elasticsearch.V5",
"Samples.Kafka",
"Samples.Npgsql",
"Samples.RabbitMQ",
"Samples.SqlServer",
"Samples.Microsoft.Data.SqlClient",
"Samples.StackExchange.Redis",
"Samples.ServiceStack.Redis",
// "Samples.MySql", - the "non package version" is _ALSO_ tested separately
"Samples.Microsoft.Data.Sqlite",
"Samples.OracleMDA",
"Samples.OracleMDA.Core",
"Samples.XUnitTests",
"Samples.NUnitTests",
"Samples.MSTestTests",
};
var json = JsonDocument.Parse(fs);
multiPackageProjects = json.RootElement
.EnumerateArray()
.Select(e => e.GetProperty("SampleProjectName").GetString())
.Distinct()
.Where(name => name switch
{
"Samples.MySql" => false, // the "non package version" is _ALSO_ tested separately
_ => true
})
.ToList();
}
foreach (var multiPackageProject in multiPackageProjects)
{
Console.WriteLine(multiPackageProject);
}
return;
var projectsToBuild = sampleProjects
.Concat(regressionProjects)
Expand All @@ -926,7 +929,7 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
"Samples.AspNetCoreMvc30" => Framework == TargetFramework.NETCOREAPP3_0,
"Samples.AspNetCoreMvc31" => Framework == TargetFramework.NETCOREAPP3_1,
var name when projectsToSkip.Contains(name) => false,
var name when multiApiProjects.Contains(name) => false,
var name when multiPackageProjects.Contains(name) => false,
_ => true,
};
});
Expand Down

0 comments on commit 696301f

Please sign in to comment.