<commit_before>Properties {
	$base_dir            = resolve-path .\..\..\
	$packages_dir        = "$base_dir\packages"
	$build_artifacts_dir = "$base_dir\build"
	$solution_name       = "$base_dir\WebApiContrib.Formatting.Xlsx.sln"
	$test_dll            = "$build_artifacts_dir\WebApiContrib.Formatting.Xlsx.Tests.dll"
	$nuget_exe           = "$base_dir\.nuget\Nuget.exe"
	$test_result_path    = "$base_dir\TestResults\"
	$test_result_file    = [System.IO.Path]::Combine($test_result_path, "TestResults.trx")
	$vscomntools_path    = VSCommonToolsPath
	$mstest_path         = (Get-Item $vscomntools_path).Parent.FullName
	$mstest_exe          = [System.IO.Path]::Combine($mstest_path, "IDE\MSTest.exe")
}

Task Default -Depends BuildWebApiContrib, RunUnitTests, NuGetBuild

Task BuildWebApiContrib -Depends Clean, Build

Task Clean {
	Exec { msbuild $solution_name /v:Quiet /t:Clean /p:Configuration=Release }
}

Task Build -depends Clean {
	Exec { msbuild $solution_name /v:Quiet /t:Build /p:Configuration=Release /p:OutDir=$build_artifacts_dir\ } 
}

Task NuGetBuild -depends Clean {
	& $nuget_exe pack "$base_dir/src/WebApiContrib.Formatting.Xlsx/WebApiContrib.Formatting.Xlsx.csproj" -Build -OutputDirectory $build_artifacts_dir -Verbose -Properties Configuration=Release
}

Task RunUnitTests -depends Build {
    $test_arguments = @("/resultsFile:$test_result_file")
    $test_arguments += "/testcontainer:$test_dll"
	
	If (Test-Path $test_result_file) { Remove-Item $test_result_file }
<commit_msg>ensure test results folder is created if missing<commit_after>Properties {
	$base_dir            = resolve-path .\..\..\
	$packages_dir        = "$base_dir\packages"
	$build_artifacts_dir = "$base_dir\build"
	$solution_name       = "$base_dir\WebApiContrib.Formatting.Xlsx.sln"
	$test_dll            = "$build_artifacts_dir\WebApiContrib.Formatting.Xlsx.Tests.dll"
	$nuget_exe           = "$base_dir\.nuget\Nuget.exe"
	$test_result_path    = "$base_dir\TestResults\"
	$test_result_file    = [System.IO.Path]::Combine($test_result_path, "TestResults.trx")
	$vscomntools_path    = VSCommonToolsPath
	$mstest_path         = (Get-Item $vscomntools_path).Parent.FullName
	$mstest_exe          = [System.IO.Path]::Combine($mstest_path, "IDE\MSTest.exe")
}

Task Default -Depends BuildWebApiContrib, RunUnitTests, NuGetBuild

Task BuildWebApiContrib -Depends Clean, Build

Task Clean {
	Exec { msbuild $solution_name /v:Quiet /t:Clean /p:Configuration=Release }
}

Task Build -depends Clean {
	Exec { msbuild $solution_name /v:Quiet /t:Build /p:Configuration=Release /p:OutDir=$build_artifacts_dir\ } 
}

Task NuGetBuild -depends Clean {
	& $nuget_exe pack "$base_dir/src/WebApiContrib.Formatting.Xlsx/WebApiContrib.Formatting.Xlsx.csproj" -Build -OutputDirectory $build_artifacts_dir -Verbose -Properties Configuration=Release
}

Task RunUnitTests -depends Build {
    New-Item -ItemType Directory -Force -Path "$test_result_path"
    $test_arguments = @("/resultsFile:$test_result_file")
    $test_arguments += "/testcontainer:$test_dll"
	
	If (Test-Path $test_result_file) { Remove-Item $test_result_file }

{'fraction_non_alphanumeric': 0.12399355877616747, 'fraction_numerical': 0.0, 'mean_word_length': 4.3367697594501715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6476721', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1093, 'n_words': 177}