<commit_before>Param([string] $rootPath)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path

Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow

if ([string]::IsNullOrEmpty($rootPath)) {
    $rootPath = "$scriptPath\.."
}
Write-Host "Root path used is $rootPath" -ForegroundColor Yellow

workflow BuildAndPublish {
    param ([string] $rootPath
    )
$projectPaths = 
    @{Path="$rootPath\src\Web\WebMVC";Prj="WebMVC.csproj"},
    @{Path="$rootPath\src\Web\WebSPA";Prj="WebSPA.csproj"},
    @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"},
    @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"},
    @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"},
    @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"},
    @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"},
    @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"},
    @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"},
    @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"},
    @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"}

    foreach -parallel ($item in $projectPaths) {
        $projectPath = $item.Path
        $projectFile = $item.Prj
        $outPath = $item.Path + "\obj\Docker\publish"
        $projectPathAndFile = "$projectPath\$projectFile"
        #Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow
        remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue
        #Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow
        dotnet build $projectPathAndFile
        dotnet publish $projectPathAndFile -o $outPath 
    }
}

BuildAndPublish $rootPath

########################################################################################
# Delete old eShop Docker images
########################################################################################
<commit_msg>Removed GracePeriodManager project as it is no longer used in netcore2<commit_after>Param([string] $rootPath)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path

Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow

if ([string]::IsNullOrEmpty($rootPath)) {
    $rootPath = "$scriptPath\.."
}
Write-Host "Root path used is $rootPath" -ForegroundColor Yellow

workflow BuildAndPublish {
    param ([string] $rootPath
    )
$projectPaths = 
    @{Path="$rootPath\src\Web\WebMVC";Prj="WebMVC.csproj"},
    @{Path="$rootPath\src\Web\WebSPA";Prj="WebSPA.csproj"},
    @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"},
    @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"},
    @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"},
    @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"},
    @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"},
    @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"},
    @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"},
    @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"}

    foreach -parallel ($item in $projectPaths) {
        $projectPath = $item.Path
        $projectFile = $item.Prj
        $outPath = $item.Path + "\obj\Docker\publish"
        $projectPathAndFile = "$projectPath\$projectFile"
        #Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow
        remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue
        #Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow
        dotnet build $projectPathAndFile
        dotnet publish $projectPathAndFile -o $outPath 
    }
}

BuildAndPublish $rootPath

########################################################################################
# Delete old eShop Docker images
########################################################################################

{'fraction_non_alphanumeric': 0.2256300523062292, 'fraction_numerical': 0.00023775558725630053, 'mean_word_length': 5.001426533523538, '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': '6783866', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1263, 'n_words': 197}