<commit_before>﻿#tool "nuget:?package=GitVersion.CommandLine&Version=5.10.1"
#addin "nuget:?package=Cake.Json&version=7.0.1"

var target = Argument("target", "Default");
var outputDir = "./artifacts/";

Task("Clean")
    .Does(() => {
        if (DirectoryExists(outputDir))
        {
            DeleteDirectory(
                outputDir,
                new DeleteDirectorySettings {
                    Recursive = true,
                    Force = true
                }
            );
        }
    });

GitVersion versionInfo = null;
Task("Version")
    .Does(() => {
        GitVersion(new GitVersionSettings{
            UpdateAssemblyInfo = false,
            OutputType = GitVersionOutput.BuildServer
        });
        versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });

        Information(SerializeJsonPretty(versionInfo));
    });

Task("Restore")
    .IsDependentOn("Version")
    .Does(() => {
        DotNetCoreRestore("src", new DotNetCoreRestoreSettings() {
            ArgumentCustomization = args => args.Append("/p:Version=" + versionInfo.SemVer)
        });
    });

Task("Build")
    .IsDependentOn("Clean")
    .IsDependentOn("Version")
    .IsDependentOn("Restore")
    .Does(() => {
        var settings =  new MSBuildSettings()
            .SetConfiguration("Release")
            .WithProperty("Version", versionInfo.SemVer)
            .WithProperty("PackageOutputPath", System.IO.Path.GetFullPath(outputDir))
            .WithTarget("Build")
            .WithTarget("Pack");

        MSBuild("./src/DbUp.sln", settings);
    });

Task("Test")
    .IsDependentOn("Build")
    .Does(() => {
         DotNetCoreTest("./src/dbup-tests/dbup-tests.csproj", new DotNetCoreTestSettings
        {
            Configuration = "Release",
            NoBuild = true,
            Loggers = new[] {"console;verbosity=detailed", "trx" },
            ResultsDirectory = $"{outputDir}/TestResults"
        });
    });

Task("Package")
    .IsDependentOn("Test")
    .Does(() => {

        NuGetPack("./src/dbup/dbup.nuspec", new NuGetPackSettings() {
            OutputDirectory = System.IO.Path.GetFullPath(outputDir),
            Version = versionInfo.SemVer
        });
    });

Task("Default")
    .IsDependentOn("Package");

RunTarget(target);
<commit_msg>Move Away from Deprecated .NET Core Build Tasks<commit_after>﻿#tool "nuget:?package=GitVersion.CommandLine&Version=5.10.1"
#addin "nuget:?package=Cake.Json&version=7.0.1"

var target = Argument("target", "Default");
var outputDir = "./artifacts/";

Task("Clean")
    .Does(() => {
        if (DirectoryExists(outputDir))
        {
            DeleteDirectory(
                outputDir,
                new DeleteDirectorySettings {
                    Recursive = true,
                    Force = true
                }
            );
        }
    });

GitVersion versionInfo = null;
Task("Version")
    .Does(() => {
        GitVersion(new GitVersionSettings{
            UpdateAssemblyInfo = false,
            OutputType = GitVersionOutput.BuildServer
        });
        versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });

        Information(SerializeJsonPretty(versionInfo));
    });

Task("Restore")
    .IsDependentOn("Version")
    .Does(() => {
        DotNetRestore("src", new DotNetRestoreSettings() {
            ArgumentCustomization = args => args.Append("/p:Version=" + versionInfo.SemVer)
        });
    });

Task("Build")
    .IsDependentOn("Clean")
    .IsDependentOn("Version")
    .IsDependentOn("Restore")
    .Does(() => {
        var settings =  new MSBuildSettings()
            .SetConfiguration("Release")
            .WithProperty("Version", versionInfo.SemVer)
            .WithProperty("PackageOutputPath", System.IO.Path.GetFullPath(outputDir))
            .WithTarget("Build")
            .WithTarget("Pack");

        MSBuild("./src/DbUp.sln", settings);
    });

Task("Test")
    .IsDependentOn("Build")
    .Does(() => {
         DotNetTest("./src/dbup-tests/dbup-tests.csproj", new DotNetTestSettings
        {
            Configuration = "Release",
            NoBuild = true,
            Loggers = new[] {"console;verbosity=detailed", "trx" },
            ResultsDirectory = $"{outputDir}/TestResults"
        });
    });

Task("Package")
    .IsDependentOn("Test")
    .Does(() => {

        NuGetPack("./src/dbup/dbup.nuspec", new NuGetPackSettings() {
            OutputDirectory = System.IO.Path.GetFullPath(outputDir),
            Version = versionInfo.SemVer
        });
    });

Task("Default")
    .IsDependentOn("Package");

RunTarget(target);

{'fraction_non_alphanumeric': 0.14786913473956093, 'fraction_numerical': 0.003013344812742144, 'mean_word_length': 2.2840989399293288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7072721', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1324, 'n_words': 201}