<commit_before>﻿# Before build
# Use this script after UWPHelper went out of preview
# Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1"
# .\Set-PureBuildVersion.ps1

$buildVersion = $env:APPVEYOR_BUILD_VERSION

# Check whether this is commit in branch 'master' and not just PR to the branch
if (($env:APPVEYOR_REPO_BRANCH -eq "master") -and ($env:APPVEYOR_PULL_REQUEST_TITLE -eq $null) -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null))
{
	$newVersion	= $buildVersion.Split("-") | Select-Object -first 1
	$newVersion = "$newVersion-preview"
	$message    = "Build version changed from '$buildVersion' to '$newVersion'."

	$buildVersion = $newVersion
	Update-AppveyorBuild -Version $buildVersion
	# Set the environment variable explicitly so it will be preserved to deployments (specifically GitHub Releases)
	Set-AppveyorBuildVariable "APPVEYOR_BUILD_VERSION" $buildVersion

	Add-AppveyorMessage $message
	Write-Host $message
}

# Have to use older version because of a bug in 4.0.0
Start-FileDownload "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
.\nuget restore

# Build
$uwpHelperProjectFolder = Get-ChildItem -Directory -Filter "UWPHelper"

if (!(Test-Path $uwpHelperProjectFolder))
{
	throw "Unable to find UWPHelper project folder. `$uwpHelperProjectFolder: '$uwpHelperProjectFolder'"
}

$platforms = "x86", "x64", "ARM"

foreach ($platform in $platforms)
{
	Write-Host "`n`nPlatform $platform"
	Write-Host     "============"

	MSBuild "$uwpHelperProjectFolder\UWPHelper.csproj" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Release /p:Platform=$platform

	$releaseFolder = Join-Path $uwpHelperProjectFolder.FullName "\bin\$platform\Release\"

	if (!(Test-Path $releaseFolder))
	{
		throw "Unable to find $platform release folder. `$releaseFolder: '$releaseFolder'"
	}

	$zipFileName = "UWPHelper_$platform.$env:APPVEYOR_BUILD_VERSION.zip"
	7z a $zipFileName "$releaseFolder\*"
	
	Push-AppveyorArtifact $zipFileName<commit_msg>Testing with NuGet 4.1.0<commit_after>﻿# Before build
# Use this script after UWPHelper went out of preview
# Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1"
# .\Set-PureBuildVersion.ps1

$buildVersion = $env:APPVEYOR_BUILD_VERSION

# Check whether this is commit in branch 'master' and not just PR to the branch
if (($env:APPVEYOR_REPO_BRANCH -eq "master") -and ($env:APPVEYOR_PULL_REQUEST_TITLE -eq $null) -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null))
{
	$newVersion	= $buildVersion.Split("-") | Select-Object -first 1
	$newVersion = "$newVersion-preview"
	$message    = "Build version changed from '$buildVersion' to '$newVersion'."

	$buildVersion = $newVersion
	Update-AppveyorBuild -Version $buildVersion
	# Set the environment variable explicitly so it will be preserved to deployments (specifically GitHub Releases)
	Set-AppveyorBuildVariable "APPVEYOR_BUILD_VERSION" $buildVersion

	Add-AppveyorMessage $message
	Write-Host $message
}

# Have to use older version because of a bug in 4.0.0
Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe"
.\nuget restore

# Build
$uwpHelperProjectFolder = Get-ChildItem -Directory -Filter "UWPHelper"

if (!(Test-Path $uwpHelperProjectFolder))
{
	throw "Unable to find UWPHelper project folder. `$uwpHelperProjectFolder: '$uwpHelperProjectFolder'"
}

$platforms = "x86", "x64", "ARM"

foreach ($platform in $platforms)
{
	Write-Host "`n`nPlatform $platform"
	Write-Host     "============"

	MSBuild "$uwpHelperProjectFolder\UWPHelper.csproj" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Release /p:Platform=$platform

	$releaseFolder = Join-Path $uwpHelperProjectFolder.FullName "\bin\$platform\Release\"

	if (!(Test-Path $releaseFolder))
	{
		throw "Unable to find $platform release folder. `$releaseFolder: '$releaseFolder'"
	}

	$zipFileName = "UWPHelper_$platform.$env:APPVEYOR_BUILD_VERSION.zip"
	7z a $zipFileName "$releaseFolder\*"
	
	Push-AppveyorArtifact $zipFileName
{'fraction_non_alphanumeric': 0.1244932029573098, 'fraction_numerical': 0.0076317672310994514, 'mean_word_length': 5.721153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1704905', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1389, 'n_words': 326}