<commit_before>﻿$base_dir = Resolve-Path ".\"
$artifactsDir = "$base_dir\artifacts"
$sourceDir = "$base_dir\src"

If ($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {
    Write-Host "Artifacts will not be created for pull requests."
    Return
}

Write-Host "Cloning repository into $($artifactsDir)..."
git clone "$env:BUILD_REPO_URL" "$artifactsDir" -q 2>&1 | %{ "$_" }

If ($LastExitCode -ne 0) {
    Write-Error "An error occurred while cloning the repository."
    Return $LastExitCode
}

Push-Location $artifactsDir

git fetch --all -f -q 2>&1 | %{ "$_" }
$branches = (git branch -r) 2> $null
If (($branches.Replace(" ", "").Split([environment]::NewLine) -contains "origin/$($env:APPVEYOR_REPO_BRANCH)") -eq $True) {
    Write-Host "Checking out branch: $env:APPVEYOR_REPO_BRANCH"
    git checkout "$env:APPVEYOR_REPO_BRANCH" -f -q 2>&1 | %{ "$_" }
} else {
    Write-Host "Checking out new branch: $env:APPVEYOR_REPO_BRANCH"
    git checkout -b "$env:APPVEYOR_REPO_BRANCH" -q 2>&1 | %{ "$_" }
}

If ($LastExitCode -ne 0) {
    Write-Error "An error occurred while changing to branch: $env:APPVEYOR_REPO_BRANCH"
    Return $LastExitCode
}

Write-Host "Removing existing files..."
git rm -r * -q 2>&1 | %{ "$_" }

Write-Host "Copying build artifacts..."
ROBOCOPY "$sourceDir\Exceptionless.Web" "$artifactsDir" /XD "$sourceDir\Exceptionless.Web\bin" "$sourceDir\Exceptionless.Web\obj" "$sourceDir\Exceptionless.Web\Properties" /S /XF "*.nuspec" "*.settings" "*.cs" "*.Development.yml" "*.csproj" "*.user" "*.suo" "*.xsd" "*.ide" /NFL /NDL /NJH /NJS /nc /ns /np
ROBOCOPY "$sourceDir\Exceptionless.Web\bin\Release\netcoreapp2.0\publish" "$artifactsDir\bin" /XD "$sourceDir\Exceptionless.Web\bin\Release\netcoreapp2.0\publish\wwwroot" /S /XF "*.yml" "Web.config" /NFL /NDL /NJH /NJS /nc /ns /np
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" "$artifactsDir\bin" /XD /XF "EventPostJob.*" /NFL /NDL /NJH /NJS /nc /ns /np

Write-Host "Copying CleanupSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\CleanupSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\CleanupSnapshot" /XD "$sourceDir\Jobs\CleanupSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying CloseInactiveSession job..."
ROBOCOPY "$sourceDir\Jobs\CloseInactiveSession\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\CloseInactiveSession" /XD "$sourceDir\Jobs\CloseInactiveSession\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying DailySummary job..."
ROBOCOPY "$sourceDir\Jobs\DailySummary\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\DailySummary" /XD "$sourceDir\Jobs\DailySummary\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying DownloadGeoIPDatabase job..."
ROBOCOPY "$sourceDir\Jobs\DownloadGeoIPDatabase\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\DownloadGeoIPDatabase" /XD "$sourceDir\Jobs\DownloadGeoIPDatabase\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventNotification job..."
ROBOCOPY "$sourceDir\Jobs\EventNotification\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventNotification" /XD "$sourceDir\Jobs\EventNotification\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventPost job..."
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish"  /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost2" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost3" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost4" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\EventSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\EventSnapshot" /XD "$sourceDir\Jobs\EventSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventUserDescription job..."
ROBOCOPY "$sourceDir\Jobs\EventUserDescription\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventUserDescription" /XD "$sourceDir\Jobs\EventUserDescription\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying MailMessage job..."
ROBOCOPY "$sourceDir\Jobs\MailMessage\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\MailMessage" /XD "$sourceDir\Jobs\MailMessage\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying MaintainIndexes job..."
ROBOCOPY "$sourceDir\Jobs\MaintainIndexes\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\MaintainIndexes" /XD "$sourceDir\Jobs\MaintainIndexes\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying OrganizationSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\OrganizationSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\OrganizationSnapshot" /XD "$sourceDir\Jobs\OrganizationSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying RetentionLimit job..."
ROBOCOPY "$sourceDir\Jobs\RetentionLimit\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\RetentionLimit" /XD "$sourceDir\Jobs\RetentionLimit\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"<commit_msg>Try and fix artifacts<commit_after>﻿$base_dir = Resolve-Path ".\"
$artifactsDir = "$base_dir\artifacts"
$sourceDir = "$base_dir\src"

If ($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {
    Write-Host "Artifacts will not be created for pull requests."
    Return
}

Write-Host "Cloning repository into $($artifactsDir)..."
git clone "$env:BUILD_REPO_URL" "$artifactsDir" --depth 1 -q 2>&1 | % { "$_" }

If ($LastExitCode -ne 0) {
    Write-Error "An error occurred while cloning the repository."
    Return $LastExitCode
}

Push-Location $artifactsDir

git fetch --all -f -q 2>&1 | %{ "$_" }
$branches = (git branch -r) 2> $null
If (($branches.Replace(" ", "").Split([environment]::NewLine) -contains "origin/$($env:APPVEYOR_REPO_BRANCH)") -eq $True) {
    Write-Host "Checking out branch: $env:APPVEYOR_REPO_BRANCH"
    git checkout "$env:APPVEYOR_REPO_BRANCH" -f -q 2>&1 | %{ "$_" }
} else {
    Write-Host "Checking out new branch: $env:APPVEYOR_REPO_BRANCH"
    git checkout -b "$env:APPVEYOR_REPO_BRANCH" -q 2>&1 | %{ "$_" }
}

If ($LastExitCode -ne 0) {
    Write-Error "An error occurred while changing to branch: $env:APPVEYOR_REPO_BRANCH"
    Return $LastExitCode
}

Write-Host "Removing existing files..."
git rm -r * -q 2>&1 | %{ "$_" }

Write-Host "Copying build artifacts..."
ROBOCOPY "$sourceDir\Exceptionless.Web" "$artifactsDir" /XD "$sourceDir\Exceptionless.Web\bin" "$sourceDir\Exceptionless.Web\obj" "$sourceDir\Exceptionless.Web\Properties" /S /XF "*.nuspec" "*.settings" "*.cs" "*.Development.yml" "*.csproj" "*.user" "*.suo" "*.xsd" "*.ide" /NFL /NDL /NJH /NJS /nc /ns /np
ROBOCOPY "$sourceDir\Exceptionless.Web\bin\Release\netcoreapp2.0\publish" "$artifactsDir\bin" /XD "$sourceDir\Exceptionless.Web\bin\Release\netcoreapp2.0\publish\wwwroot" /S /XF "*.yml" "Web.config" /NFL /NDL /NJH /NJS /nc /ns /np
ROBOCOPY "$sourceDir\Exceptionless.Insulation\bin\Release\netcoreapp2.0\publish" "$artifactsDir\bin" /XD /XF "Exceptionless.Insulation.*" /NFL /NDL /NJH /NJS /nc /ns /np

Write-Host "Copying CleanupSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\CleanupSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\CleanupSnapshot" /XD "$sourceDir\Jobs\CleanupSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying CloseInactiveSession job..."
ROBOCOPY "$sourceDir\Jobs\CloseInactiveSession\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\CloseInactiveSession" /XD "$sourceDir\Jobs\CloseInactiveSession\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying DailySummary job..."
ROBOCOPY "$sourceDir\Jobs\DailySummary\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\DailySummary" /XD "$sourceDir\Jobs\DailySummary\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying DownloadGeoIPDatabase job..."
ROBOCOPY "$sourceDir\Jobs\DownloadGeoIPDatabase\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\DownloadGeoIPDatabase" /XD "$sourceDir\Jobs\DownloadGeoIPDatabase\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventNotification job..."
ROBOCOPY "$sourceDir\Jobs\EventNotification\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventNotification" /XD "$sourceDir\Jobs\EventNotification\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventPost job..."
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish"  /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost2" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost3" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
ROBOCOPY "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventPost4" /XD "$sourceDir\Jobs\EventPost\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\EventSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\EventSnapshot" /XD "$sourceDir\Jobs\EventSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying EventUserDescription job..."
ROBOCOPY "$sourceDir\Jobs\EventUserDescription\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\EventUserDescription" /XD "$sourceDir\Jobs\EventUserDescription\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying MailMessage job..."
ROBOCOPY "$sourceDir\Jobs\MailMessage\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\MailMessage" /XD "$sourceDir\Jobs\MailMessage\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying MaintainIndexes job..."
ROBOCOPY "$sourceDir\Jobs\MaintainIndexes\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\MaintainIndexes" /XD "$sourceDir\Jobs\MaintainIndexes\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying OrganizationSnapshot job..."
ROBOCOPY "$sourceDir\Jobs\OrganizationSnapshot\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\triggered\OrganizationSnapshot" /XD "$sourceDir\Jobs\OrganizationSnapshot\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
Write-Host "Copying RetentionLimit job..."
ROBOCOPY "$sourceDir\Jobs\RetentionLimit\bin\Release\netcoreapp2.0" "$artifactsDir\App_Data\jobs\continuous\RetentionLimit" /XD "$sourceDir\Jobs\RetentionLimit\bin\Release\netcoreapp2.0\publish" /S /NFL /NDL /NJH /NJS /nc /ns /np /XF "Exceptionless.*" "System.*"
{'fraction_non_alphanumeric': 0.16773644729719278, 'fraction_numerical': 0.012760034026757405, 'mean_word_length': 4.593425605536332, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '481031', 'n_tokens_mistral': 5033, 'n_tokens_neox': 4977, 'n_words': 924}