Files
speckle-sharp-sdk/build/Program.cs
T
Adam Hathcock 77ffcead69 Speckle.Logging with ILRepack (#54)
* Revert SQLite to allow side by side

* Update Serilog to 3.1.1 and remove Sentry

* fmt

* Revert serilog change

* first pass

* downgrade to MELA 2.2 to avoid conflicts

* add otel

* Speckle.Logging proper

* move otel and logging to make core dependant

* readd configuration

* revert namespace and add console tracing

* fmt

* Remove extra usings

* readd serilog

* fix deps

* remove extras for build

* some reversions

* add more context

* Fix conversion

* More explicit

* Revert naming

* back to public loggerfactory

* Remove more obsolete things

* Drop ME.Logging dependency and expose logging interface

* restore integration test compose

* fmt

* remove the ME Logging dependency
2024-07-31 15:37:10 +01:00

110 lines
2.6 KiB
C#

using GlobExpressions;
using static Bullseye.Targets;
using static SimpleExec.Command;
const string CLEAN = "clean";
const string FORMAT = "format";
const string RESTORE_TOOLS = "restore-tools";
const string RESTORE = "restore";
const string BUILD = "build";
const string TEST = "test";
const string INTEGRATION = "integration";
const string PACK = "pack";
const string PACK_LOCAL = "pack-local";
const string CLEAN_LOCKS = "clean-locks";
Target(
CLEAN_LOCKS,
() =>
{
foreach (var f in Glob.Files(".", "**/*.lock.json"))
{
Console.WriteLine("Found and will delete: " + f);
File.Delete(f);
}
Console.WriteLine("Running restore now.");
Run("dotnet", "restore .\\Speckle.Sdk.sln");
}
);
Target(
CLEAN,
ForEach("**/output"),
dir =>
{
IEnumerable<string> GetDirectories(string d)
{
return Glob.Directories(".", d);
}
void RemoveDirectory(string d)
{
if (Directory.Exists(d))
{
Console.WriteLine(d);
Directory.Delete(d, true);
}
}
foreach (var d in GetDirectories(dir))
{
RemoveDirectory(d);
}
}
);
Target(RESTORE_TOOLS, () => RunAsync("dotnet", "tool restore"));
Target(FORMAT, DependsOn(RESTORE_TOOLS), () => RunAsync("dotnet", "csharpier --check ."));
Target(RESTORE, () => RunAsync("dotnet", "restore Speckle.Sdk.sln --locked-mode"));
Target(
BUILD,
DependsOn(RESTORE),
async () =>
{
await RunAsync("dotnet", $"build Speckle.Sdk.sln -c Release --no-restore");
}
);
Target(
TEST,
DependsOn(BUILD),
Glob.Files(".", "**/*.Tests.Unit.csproj").Concat(Glob.Files(".", "**/*.Tests.csproj")),
async file =>
{
await RunAsync(
"dotnet",
$"test {file} -c Release --no-build --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage /p:AltCoverVerbosity=Warning"
);
}
);
Target(
INTEGRATION,
DependsOn(BUILD),
async () =>
{
await RunAsync("docker", "compose -f docker-compose.yml up --wait");
foreach (var test in Glob.Files(".", "**/*.Tests.Integration.csproj"))
{
await RunAsync(
"dotnet",
$"test {test} -c Release --no-build --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage"
);
}
await RunAsync("docker", "compose down");
}
);
static Task RunRestore() => RunAsync("dotnet", "pack Speckle.Sdk.sln -c Release -o output --no-build");
Target(PACK, DependsOn(TEST), RunRestore);
Target(PACK_LOCAL, DependsOn(BUILD), RunRestore);
Target("default", DependsOn(FORMAT, TEST, INTEGRATION), () => Console.WriteLine("Done!"));
await RunTargetsAndExitAsync(args).ConfigureAwait(true);