<commit_before>param(
    [string] $CMakeBin = "cmake",
    [string] $BuildDir = "build_Windows-unknown"
    )

$NativeLibDir = "$Pwd\NativeLibs"

function DownloadANGLE {
    $VAR = (nuget install ANGLE.WindowsStore)
    ls $Pwd/ANGLE.* | % FullName
}

function DownloadNativeLibs {
    if ( Test-Path $NativeLibDir) {
        try {
            git -C $NativeLibDir pull
        }
        catch {
        }
    }else{
        mkdir -Force $NativeLibDir
        try {
            git clone "https://github.com/hbirchtree/native-library-bundle.git" $NativeLibDir
        }
        catch {
        }
    }
}

function CheckArch($arch) {
    if ($arch.Length -lt 1) {
        echo "x86"
    }else{
        echo $arch
    }
}

function ConfigProject([String] $SrcDir,[String] $arch,[String] $toolchain, `
					[String] $preload,[String] $LibVariant,[String] $ANGLEDir, `
					[String[]] $ExtraArgs, [String] $BuildDir) {

    $archfix = (CheckArch $arch)

    mkdir -Force $BuildDir
    cd $BuildDir
    
    DownloadNativeLibs

    if($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017")
    {
        $Generator = "Visual Studio 15 2017 $arch".Trim()
    }else{
        $Generator = "Visual Studio 15 2017 $arch".Trim()
    }

    & $CMakeBin $SrcDir `
        -G"$Generator" `
        -DCMAKE_TOOLCHAIN_FILE="$SrcDir/toolchain/cmake/Toolchains/$toolchain.toolchain.cmake" `
        -DANGLE_ROOT_DIR="$ANGLEDir" `
        -DNATIVE_LIBRARY_DIR="$NativeLibDir/$LibVariant" `
        -C"$SrcDir/toolchain/cmake/Preload/$preload.cmake" `
        -DCMAKE_INSTALL_PREFIX="$Pwd/Out" `
        $ExtraArgs
}

function CompileProject($preload, $arch, $config, $BuildDir) {<commit_msg> - Fix Windows build<commit_after>param(
    [string] $CMakeBin = "cmake",
    [string] $BuildDir = "build_Windows-unknown"
    )

$NativeLibDir = "$Pwd\NativeLibs"

function DownloadANGLE {
    $VAR = (nuget install ANGLE.WindowsStore)
    ls $Pwd/ANGLE.* | % FullName
}

function DownloadNativeLibs {
    if ( Test-Path $NativeLibDir) {
        try {
            git -C $NativeLibDir pull
        }
        catch {
        }
    }else{
        mkdir -Force $NativeLibDir
        try {
            git clone "https://github.com/hbirchtree/native-library-bundle.git" $NativeLibDir
        }
        catch {
        }
    }
}

function CheckArch($arch) {
    if ($arch.Length -lt 1) {
        echo "x86"
    }else{
        echo $arch
    }
}

function ConfigProject([String] $SrcDir,[String] $arch,[String] $toolchain, `
					[String] $preload,[String] $LibVariant,[String] $ANGLEDir, `
					[String[]] $ExtraArgs, [String] $BuildDir) {

    $archfix = (CheckArch $arch)

    mkdir -Force $BuildDir
    cd $BuildDir
    
    DownloadNativeLibs

    if($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017")
    {
        $Generator = "Visual Studio 15 2017 $arch".Trim()
    }else{
        $Generator = "Visual Studio 14 2015 $arch".Trim()
    }

    & $CMakeBin $SrcDir `
        -G"$Generator" `
        -DCMAKE_TOOLCHAIN_FILE="$SrcDir/toolchain/cmake/Toolchains/$toolchain.toolchain.cmake" `
        -DANGLE_ROOT_DIR="$ANGLEDir" `
        -DNATIVE_LIBRARY_DIR="$NativeLibDir/$LibVariant" `
        -C"$SrcDir/toolchain/cmake/Preload/$preload.cmake" `
        -DCMAKE_INSTALL_PREFIX="$Pwd/Out" `
        $ExtraArgs
}

function CompileProject($preload, $arch, $config, $BuildDir) {
{'fraction_non_alphanumeric': 0.135890573892358, 'fraction_numerical': 0.011299435028248588, 'mean_word_length': 2.504166666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4881194', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1145, 'n_words': 211}