diff --git a/AppHandling/Compile-AppInNavContainer.ps1 b/AppHandling/Compile-AppInNavContainer.ps1 index 32fbbea2e..8570f97db 100644 --- a/AppHandling/Compile-AppInNavContainer.ps1 +++ b/AppHandling/Compile-AppInNavContainer.ps1 @@ -1,4 +1,4 @@ -<# +<# .Synopsis Use NAV/BC Container to Compile App .Description @@ -50,6 +50,9 @@ Specify if you want Compilation to fail on Error or Warning .Parameter nowarn Specify a nowarn parameter for the compiler + .Parameter generateErrorLog + Switch parameter on whether to generate an alerts log file. Default is false. + The file will be placed in the same folder as the app file, and will have the same name as the app file, but with the extension .errorLog.json. .Parameter preProcessorSymbols PreProcessorSymbols to set when compiling the app. .Parameter generatecrossreferences @@ -115,6 +118,7 @@ function Compile-AppInBcContainer { [string[]] $CustomCodeCops = @(), [Parameter(Mandatory=$false)] [string] $nowarn, + [switch] $generateErrorLog, [string[]] $preProcessorSymbols = @(), [switch] $GenerateCrossReferences, [switch] $ReportSuppressedDiagnostics, @@ -143,7 +147,7 @@ try { $platform = (Get-BcContainerNavVersion -containerOrImageName $containerName).Split('-')[0] } [System.Version]$platformversion = $platform - + $containerProjectFolder = Get-BcContainerPath -containerName $containerName -path $appProjectFolder if ("$containerProjectFolder" -eq "") { throw "The appProjectFolder ($appProjectFolder) is not shared with the container." @@ -216,7 +220,7 @@ try { throw "The rulesetFile ($rulesetFile) is not shared with the container." } } - + $CustomCodeCopFiles = @() if ($CustomCodeCops.Count -gt 0) { $CustomCodeCops | ForEach-Object { @@ -248,14 +252,14 @@ try { AddTelemetryProperty -telemetryScope $telemetryScope -key "name" -value $appJsonObject.Name AddTelemetryProperty -telemetryScope $telemetryScope -key "version" -value $appJsonObject.Version AddTelemetryProperty -telemetryScope $telemetryScope -key "appname" -value $appName - + Write-Host "Using Symbols Folder: $appSymbolsFolder" if (!(Test-Path -Path $appSymbolsFolder -PathType Container)) { New-Item -Path $appSymbolsFolder -ItemType Directory | Out-Null } if ($CopySymbolsFromContainer) { - Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($appSymbolsFolder) + Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($appSymbolsFolder) if (Test-Path "C:\Extensions\*.app") { $paths = @( "C:\Program Files\Microsoft Dynamics NAV\*\AL Development Environment\System.app" @@ -397,7 +401,7 @@ try { else { $protocol = "http://" } - + $ip = Get-BcContainerIpAddress -containerName $containerName if ($ip) { $devServerUrl = "$($protocol)$($ip):$($customConfig.DeveloperServicesPort)/$ServerInstance" @@ -405,9 +409,9 @@ try { else { $devServerUrl = "$($protocol)$($containerName):$($customConfig.DeveloperServicesPort)/$ServerInstance" } - + $timeout = 300000 - $sslVerificationDisabled = ($protocol -eq "https://") + $sslVerificationDisabled = ($protocol -eq "https://") if ($customConfig.ClientServicesCredentialType -eq "Windows") { $useDefaultCredentials = $true } @@ -415,7 +419,7 @@ try { if (!($credential)) { throw "You need to specify credentials when you are not using Windows Authentication" } - + $pair = ("$($Credential.UserName):"+[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($credential.Password))) $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) $base64 = [System.Convert]::ToBase64String($bytes) @@ -454,7 +458,7 @@ try { else { $symbolsFile = Join-Path $appSymbolsFolder $symbolsName Write-Host "Downloading symbols: $symbolsName" - + $publisher = [uri]::EscapeDataString($publisher) $name = [uri]::EscapeDataString($name) if ($appId -and $platformversion -ge [System.Version]"20.0.0.0") { @@ -490,11 +494,11 @@ try { $addDependencies = Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($symbolsFile, $platformversion) # Wait for file to be accessible in container While (-not (Test-Path $symbolsFile)) { Start-Sleep -Seconds 1 } - + if ($platformversion.Major -ge 15) { Add-Type -AssemblyName System.IO.Compression.FileSystem Add-Type -AssemblyName System.Text.Encoding - + try { # Import types needed to invoke the compiler $alcPath = 'C:\build\vsix\extension\bin' @@ -506,11 +510,11 @@ try { $packageStream = [System.IO.File]::OpenRead($symbolsFile) $package = [Microsoft.Dynamics.Nav.CodeAnalysis.Packaging.NavAppPackageReader]::Create($PackageStream, $true) $manifest = $package.ReadNavAppManifest() - + if ($manifest.application) { @{ "publisher" = "Microsoft"; "name" = "Application"; "appId" = ''; "version" = $manifest.Application } } - + foreach ($dependency in $manifest.dependencies) { $appId = '' if ($dependency.psobject.Properties.name -eq 'appid') { @@ -560,7 +564,12 @@ try { $depidx++ } - $result = Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($appProjectFolder, $appSymbolsFolder, $appOutputFile, $EnableCodeCop, $EnableAppSourceCop, $EnablePerTenantExtensionCop, $EnableUICop, $CustomCodeCops, $rulesetFile, $enableExternalRulesets, $assemblyProbingPaths, $nowarn, $GenerateCrossReferences, $ReportSuppressedDiagnostics, $generateReportLayoutParam, $features, $preProcessorSymbols, $platformversion, $updateDependencies, $sourceRepositoryUrl, $sourceCommit, $buildBy, $buildUrl ) + $errorLogFilePath = "" + if($generateErrorLog) { + $errorLogFilePath = (Join-Path $containerOutputFolder $($appName -replace '.app$','.errorLog.json')) + } + + $result = Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($appProjectFolder, $appSymbolsFolder, $appOutputFile, $EnableCodeCop, $EnableAppSourceCop, $EnablePerTenantExtensionCop, $EnableUICop, $CustomCodeCops, $rulesetFile, $enableExternalRulesets, $assemblyProbingPaths, $nowarn, $errorLogFilePath, $GenerateCrossReferences, $ReportSuppressedDiagnostics, $generateReportLayoutParam, $features, $preProcessorSymbols, $platformversion, $updateDependencies, $sourceRepositoryUrl, $sourceCommit, $buildBy, $buildUrl ) if ($updateDependencies) { $appJsonFile = Join-Path $appProjectFolder 'app.json' @@ -657,6 +666,10 @@ try { $alcParameters += @("/nowarn:$nowarn") } + if ($errorLogFilePath) { + $alcParameters += @("/errorLog:""$errorLogFilePath""") + } + if ($GenerateCrossReferences -and $platformversion.Major -ge 18) { $alcParameters += @("/generatecrossreferences") } @@ -698,12 +711,12 @@ try { Write-Host ".\alc.exe $([string]::Join(' ', $alcParameters))" & .\alc.exe $alcParameters - + if ($lastexitcode -ne 0 -and $lastexitcode -ne -1073740791) { "App generation failed with exit code $lastexitcode" } - } -ArgumentList $containerProjectFolder, $containerSymbolsFolder, (Join-Path $containerOutputFolder $appName), $EnableCodeCop, $EnableAppSourceCop, $EnablePerTenantExtensionCop, $EnableUICop, $CustomCodeCopFiles, $containerRulesetFile, $enableExternalRulesets, $assemblyProbingPaths, $nowarn, $GenerateCrossReferences, $ReportSuppressedDiagnostics, $GenerateReportLayoutParam, $features, $preProcessorSymbols, $platformversion, $updateDependencies, $sourceRepositoryUrl, $sourceCommit, $buildBy, $buildUrl - + } -ArgumentList $containerProjectFolder, $containerSymbolsFolder, (Join-Path $containerOutputFolder $appName), $EnableCodeCop, $EnableAppSourceCop, $EnablePerTenantExtensionCop, $EnableUICop, $CustomCodeCopFiles, $containerRulesetFile, $enableExternalRulesets, $assemblyProbingPaths, $nowarn, $errorLogFilePath, $GenerateCrossReferences, $ReportSuppressedDiagnostics, $GenerateReportLayoutParam, $features, $preProcessorSymbols, $platformversion, $updateDependencies, $sourceRepositoryUrl, $sourceCommit, $buildBy, $buildUrl + if ($treatWarningsAsErrors) { $regexp = ($treatWarningsAsErrors | ForEach-Object { if ($_ -eq '*') { ".*" } else { $_ } }) -join '|' $result = $result | ForEach-Object { $_ -replace "^(.*)warning ($regexp):(.*)`$", '$1error $2:$3' } @@ -755,7 +768,7 @@ try { Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($appSymbolsFolder, $appName) $appFile = Join-Path -Path $appSymbolsFolder -ChildPath $appName while (-not (Test-Path -Path $appFile)) { Start-Sleep -Seconds 1 } - } -ArgumentList $containerSymbolsFolder,"$($appName)" + } -ArgumentList $containerSymbolsFolder,"$($appName)" } } } diff --git a/AppHandling/Run-AlPipeline.ps1 b/AppHandling/Run-AlPipeline.ps1 index 2f3093ba8..a526ec02d 100644 --- a/AppHandling/Run-AlPipeline.ps1 +++ b/AppHandling/Run-AlPipeline.ps1 @@ -1,4 +1,4 @@ -<# +<# .Synopsis Run AL Pipeline .Description @@ -15,6 +15,9 @@ Switch, which you need to specify if you are going to create a container with an insider build of Business Central on Docker containers (See https://go.microsoft.com/fwlink/?linkid=2245051) .Parameter containerName This is the containerName going to be used for the build/test container. If not specified, the container name will be the pipeline name followed by -bld. + .Parameter generateErrorLog + Switch parameter on whether to generate an alerts log file. Default is false. + If set to true, the `errorLog` argument is used when compiling the apps. The generated file will be named .errorLog.json and is placed in the same folder as the app file. .Parameter imageName If imageName is specified it will be used to build an image, which serves as a cache for faster container generation. Only speficy imagename if you are going to create multiple containers from the same artifacts. @@ -164,7 +167,7 @@ .Parameter escapeFromCops If One of the cops causes an error in an app, then show the error, recompile the app without cops and continue .Parameter AppSourceCopMandatoryAffixes - Only relevant for AppSource Apps when AppSourceCop is enabled. This needs to be an array (or a string with comma separated list) of affixes used in the app. + Only relevant for AppSource Apps when AppSourceCop is enabled. This needs to be an array (or a string with comma separated list) of affixes used in the app. .Parameter AppSourceCopSupportedCountries Only relevant for AppSource Apps when AppSourceCop is enabled. This needs to be an array (or a string with a comma seperated list) of supported countries for this app. .Parameter obsoleteTagMinAllowedMajorMinor @@ -341,6 +344,7 @@ Param( $customCodeCops = @(), [switch] $useDefaultAppSourceRuleSet, [string] $rulesetFile = "", + [switch] $generateErrorLog, [switch] $enableExternalRulesets, [string[]] $preProcessorSymbols = @(), [switch] $generatecrossreferences, @@ -485,7 +489,7 @@ if ($bcptTestSuites) { if ($bcptTestFolders) { $bcptTestFolders | ForEach-Object { if (-not (Test-Path (Join-Path $_ "bcptSuite.json"))) { - throw "no bcptsuite.json found in bcpt test folder $_" + throw "no bcptsuite.json found in bcpt test folder $_" } if ($addBcptTestSuites) { $bcptTestSuites += @((Join-Path $_ "bcptSuite.json")) @@ -603,9 +607,9 @@ $escapeFromCops = $escapeFromCops -and ($enableCodeCop -or $enableAppSourceCop - if ($gitHubActions) { Write-Host "::group::Parameters" } Write-Host -ForegroundColor Yellow @' - _____ _ - | __ \ | | - | |__) |_ _ _ __ __ _ _ __ ___ ___| |_ ___ _ __ ___ + _____ _ + | __ \ | | + | |__) |_ _ _ __ __ _ _ __ ___ ___| |_ ___ _ __ ___ | ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __| | | | (_| | | | (_| | | | | | | __/ |_ __/ | \__ \ |_| \__,_|_| \__,_|_| |_| |_|\___|\__\___|_| |___/ @@ -659,6 +663,7 @@ Write-Host -NoNewLine -ForegroundColor Yellow "doNotRunTests " Write-Host -NoNewLine -ForegroundColor Yellow "doNotRunBcptTests "; Write-Host $doNotRunBcptTests Write-Host -NoNewLine -ForegroundColor Yellow "useDefaultAppSourceRuleSet "; Write-Host $useDefaultAppSourceRuleSet Write-Host -NoNewLine -ForegroundColor Yellow "rulesetFile "; Write-Host $rulesetFile +Write-Host -NoNewLine -ForegroundColor Yellow "generateErrorLog "; Write-Host $generateErrorLog Write-Host -NoNewLine -ForegroundColor Yellow "enableExternalRulesets "; Write-Host $enableExternalRulesets Write-Host -NoNewLine -ForegroundColor Yellow "azureDevOps "; Write-Host $azureDevOps Write-Host -NoNewLine -ForegroundColor Yellow "gitLab "; Write-Host $gitLab @@ -870,14 +875,14 @@ if ($gitHubActions) { Write-Host "::group::Pulling generic image" } Measure-Command { Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ - | __ \ | | (_) (_) (_) - | |__) | _| | |_ _ __ __ _ __ _ ___ _ __ ___ _ __ _ ___ _ _ __ ___ __ _ __ _ ___ + _____ _ _ _ _ _ + | __ \ | | (_) (_) (_) + | |__) | _| | |_ _ __ __ _ __ _ ___ _ __ ___ _ __ _ ___ _ _ __ ___ __ _ __ _ ___ | ___/ | | | | | | '_ \ / _` | / _` |/ _ \ '_ \ / _ \ '__| |/ __| | | '_ ` _ \ / _` |/ _` |/ _ \ | | | |_| | | | | | | | (_| | | (_| | __/ | | | __/ | | | (__ | | | | | | | (_| | (_| | __/ |_| \__,_|_|_|_|_| |_|\__, | \__, |\___|_| |_|\___|_| |_|\___| |_|_| |_| |_|\__,_|\__, |\___| - __/ | __/ | __/ | - |___/ |___/ |___/ + __/ | __/ | __/ | + |___/ |___/ |___/ '@ @@ -908,14 +913,14 @@ $testToolkitInstalled = $false if ($gitHubActions) { Write-Host "::group::Creating container" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ - / ____| | | (_) | | (_) - | | _ __ ___ __ _| |_ _ _ __ __ _ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ + _____ _ _ _ _ + / ____| | | (_) | | (_) + | | _ __ ___ __ _| |_ _ _ __ __ _ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ | | | '__/ _ \/ _` | __| | '_ \ / _` | / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__| - | |____| | | __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | | __/ | - \_____|_| \___|\__,_|\__|_|_| |_|\__, | \___\___/|_| |_|\__\__,_|_|_| |_|\___|_| - __/ | - |___/ + | |____| | | __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | | __/ | + \_____|_| \___|\__,_|\__|_|_| |_|\__, | \___\___/|_| |_|\__\__,_|_|_| |_|\___|_| + __/ | + |___/ '@ @@ -1019,7 +1024,7 @@ Measure-Command { "credential" = $credential "permissionsetId" = "SUPER" "ChangePasswordAtNextLogOn" = $false - "assignPremiumPlan" = $assignPremiumPlan + "assignPremiumPlan" = $assignPremiumPlan } New-BcContainerBcUser @Parameters @@ -1044,14 +1049,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ($gitHubActions) { Write-Host "::group::Resolving dependencies" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ -| __ \ | | (_) | | | | (_) -| |__) |___ ___ ___ | |_ ___ _ __ __ _ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ + _____ _ _ _ _ _ +| __ \ | | (_) | | | | (_) +| |__) |___ ___ ___ | |_ ___ _ __ __ _ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ | _ // _ \ __|/ _ \| \ \ / / | '_ \ / _` | / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \ __| | | \ \ __\__ \ (_) | |\ V /| | | | | (_| | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __\__ \ |_| \_\___|___/\___/|_| \_/ |_|_| |_|\__, | \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___|___/ - __/ | | | - |___/ |_| + __/ | | | + |___/ |_| '@ $unknownAppDependencies = @() @@ -1124,14 +1129,14 @@ if ($installApps) { if ($gitHubActions) { Write-Host "::group::Installing apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ - |_ _| | | | | (_) - | | _ __ ___| |_ __ _| | |_ _ __ __ _ __ _ _ __ _ __ ___ + _____ _ _ _ _ + |_ _| | | | | (_) + | | _ __ ___| |_ __ _| | |_ _ __ __ _ __ _ _ __ _ __ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | / _` | '_ \| '_ \/ __| _| |_| | | \__ \ |_ (_| | | | | | | | (_| | | (_| | |_) | |_) \__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__,_| .__/| .__/|___/ - __/ | | | | | - |___/ |_| |_| + __/ | | | | | + |___/ |_| |_| '@ Measure-Command { @@ -1231,14 +1236,14 @@ $missingAppDependencies = @($missingAppDependencies | Where-Object { $installedA if ($missingAppDependencies) { if ($gitHubActions) { Write-Host "::group::Installing app dependencies" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ - |_ _| | | | | (_) | | | | (_) - | | _ __ ___| |_ __ _| | |_ _ __ __ _ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ + _____ _ _ _ _ _ _ _ + |_ _| | | | | (_) | | | | (_) + | | _ __ ___| |_ __ _| | |_ _ __ __ _ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | / _` | '_ \| '_ \ / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | (_| | |_) | |_) | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__,_| .__/| .__/ \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ - __/ | | | | | | | - |___/ |_| |_| |_| + __/ | | | | | | | + |___/ |_| |_| |_| '@ Measure-Command { Write-Host "Missing App dependencies" @@ -1271,14 +1276,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ((($testCountry) -or !($appFolders -or $testFolders -or $bcptTestFolders)) -and !$doNotPublishApps -and ($installTestRunner -or $installTestFramework -or $installTestLibraries -or $installPerformanceToolkit)) { if ($gitHubActions) { Write-Host "::group::Importing test toolkit" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ _ _ - |_ _| | | (_) | | | | | | | | | (_) | - | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ | |_ ___ ___ | | | ___| |_ + _____ _ _ _ _ _ _ _ _ _ + |_ _| | | (_) | | | | | | | | | (_) | + | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ | |_ ___ ___ | | | ___| |_ | | | '_ ` _ \| '_ \ / _ \| '__| __| | '_ \ / _` | | __/ _ \/ __| __| | __/ _ \ / _ \| | |/ / | __| - _| |_| | | | | | |_) | (_) | | | |_| | | | | (_| | | || __/\__ \ |_ | || (_) | (_) | | <| | |_ + _| |_| | | | | | |_) | (_) | | | |_| | | | | (_| | | || __/\__ \ |_ | || (_) | (_) | | <| | |_ |_____|_| |_| |_| .__/ \___/|_| \__|_|_| |_|\__, | \__\___||___/\__| \__\___/ \___/|_|_|\_\_|\__| - | | __/ | - |_| |___/ + | | __/ | + |_| |___/ '@ Measure-Command { Write-Host -ForegroundColor Yellow "Importing Test Toolkit for additional country $testCountry" @@ -1303,14 +1308,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ($installTestApps) { if ($gitHubActions) { Write-Host "::group::Installing test apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ - |_ _| | | | | (_) | | | | - | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ + _____ _ _ _ _ _ _ + |_ _| | | | | (_) | | | | + | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | | __/ _ \/ __| __| / _` | '_ \| '_ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | || __/\__ \ |_ | (_| | |_) | |_) \__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__\___||___/\__| \__,_| .__/| .__/|___/ - __/ | | | | | - |___/ |_| |_| + __/ | | | | | + |___/ |_| |_| '@ Measure-Command { @@ -1388,14 +1393,14 @@ $missingTestAppDependencies = @($missingTestAppDependencies | Where-Object { $in if ($missingTestAppDependencies) { if ($gitHubActions) { Write-Host "::group::Installing test app dependencies" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ _ _ - |_ _| | | | | (_) | | | | | | | | (_) - | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ + _____ _ _ _ _ _ _ _ _ _ + |_ _| | | | | (_) | | | | | | | | (_) + | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | | __/ _ \/ __| __| / _` | '_ \| '_ \ / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | || __/\__ \ |_ | (_| | |_) | |_) | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__\___||___/\__| \__,_| .__/| .__/ \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ - __/ | | | | | | | - |___/ |_| |_| |_| + __/ | | | | | | | + |___/ |_| |_| |_| '@ Measure-Command { Write-Host "Missing TestApp dependencies" @@ -1425,14 +1430,14 @@ if ($appFolders -or $testFolders -or $bcptTestFolders) { if ($gitHubActions) { Write-Host "::group::Compiling apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ - / ____| (_) (_) - | | ___ _ __ ___ _ __ _| |_ _ __ __ _ __ _ _ __ _ __ ___ + _____ _ _ _ + / ____| (_) (_) + | | ___ _ __ ___ _ __ _| |_ _ __ __ _ __ _ _ __ _ __ ___ | | / _ \| '_ ` _ \| '_ \| | | | '_ \ / _` | / _` | '_ \| '_ \/ __| | |____ (_) | | | | | | |_) | | | | | | | (_| | | (_| | |_) | |_) \__ \ \_____\___/|_| |_| |_| .__/|_|_|_|_| |_|\__, | \__,_| .__/| .__/|___/ - | | __/ | | | | | - |_| |___/ |_| |_| + | | __/ | | | | | + |_| |___/ |_| |_| '@ } @@ -1455,14 +1460,14 @@ $sortedAppFolders+$sortedTestAppFolders | Select-Object -Unique | ForEach-Object if ($gitHubActions) { Write-Host "::endgroup::" } if ($gitHubActions) { Write-Host "::group::Importing test toolkit" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ _ _ - |_ _| | | (_) | | | | | | | | | (_) | - | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ | |_ ___ ___ | | | ___| |_ + _____ _ _ _ _ _ _ _ _ _ + |_ _| | | (_) | | | | | | | | | (_) | + | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ | |_ ___ ___ | | | ___| |_ | | | '_ ` _ \| '_ \ / _ \| '__| __| | '_ \ / _` | | __/ _ \/ __| __| | __/ _ \ / _ \| | |/ / | __| - _| |_| | | | | | |_) | (_) | | | |_| | | | | (_| | | || __/\__ \ |_ | || (_) | (_) | | <| | |_ + _| |_| | | | | | |_) | (_) | | | |_| | | | | (_| | | || __/\__ \ |_ | || (_) | (_) | | <| | |_ |_____|_| |_| |_| .__/ \___/|_| \__|_|_| |_|\__, | \__\___||___/\__| \__\___/ \___/|_|_|\_\_|\__| - | | __/ | - |_| |___/ + | | __/ | + |_| |___/ '@ Measure-Command { $measureText = ", test apps and importing test toolkit" @@ -1488,14 +1493,14 @@ if ($installTestApps) { if ($gitHubActions) { Write-Host "::endgroup::" } if ($gitHubActions) { Write-Host "::group::Installing test apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ - |_ _| | | | | (_) | | | | - | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ + _____ _ _ _ _ _ _ + |_ _| | | | | (_) | | | | + | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | | __/ _ \/ __| __| / _` | '_ \| '_ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | || __/\__ \ |_ | (_| | |_) | |_) \__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__\___||___/\__| \__,_| .__/| .__/|___/ - __/ | | | | | - |___/ |_| |_| + __/ | | | | | + |___/ |_| |_| '@ Measure-Command { @@ -1561,14 +1566,14 @@ $missingTestAppDependencies = @($missingTestAppDependencies | Where-Object { $in if ($missingTestAppDependencies) { if ($gitHubActions) { Write-Host "::group::Installing test app dependencies" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ _ _ - |_ _| | | | | (_) | | | | | | | | (_) - | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ + _____ _ _ _ _ _ _ _ _ _ + |_ _| | | | | (_) | | | | | | | | (_) + | | _ __ ___| |_ __ _| | |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ __| | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | | __/ _ \/ __| __| / _` | '_ \| '_ \ / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | || __/\__ \ |_ | (_| | |_) | |_) | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | \__\___||___/\__| \__,_| .__/| .__/ \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ - __/ | | | | | | | - |___/ |_| |_| |_| + __/ | | | | | | | + |___/ |_| |_| |_| '@ Measure-Command { Write-Host "Missing TestApp dependencies" @@ -1595,14 +1600,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ($gitHubActions) { Write-Host "::group::Compiling test apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ - / ____| (_) (_) | | | | - | | ___ _ __ ___ _ __ _| |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ + _____ _ _ _ _ _ + / ____| (_) (_) | | | | + | | ___ _ __ ___ _ __ _| |_ _ __ __ _ | |_ ___ ___| |_ __ _ _ __ _ __ ___ | | / _ \| '_ ` _ \| '_ \| | | | '_ \ / _` | | __/ _ \ __| __| / _` | '_ \| '_ \/ __| | |____ (_) | | | | | | |_) | | | | | | | (_| | | |_ __\__ \ |_ | (_| | |_) | |_) \__ \ \_____\___/|_| |_| |_| .__/|_|_|_|_| |_|\__, | \__\___|___/\__| \__,_| .__/| .__/|___/ - | | __/ | | | | | - |_| |___/ |_| |_| + | | __/ | | | | | + |_| |___/ |_| |_| '@ } @@ -1617,7 +1622,7 @@ Write-Host -ForegroundColor Yellow @' } if ($app) { - $CopParameters += @{ + $CopParameters += @{ "EnableCodeCop" = $enableCodeCop "EnableAppSourceCop" = $enableAppSourceCop "EnableUICop" = $enableUICop @@ -1646,14 +1651,14 @@ Write-Host -ForegroundColor Yellow @' } if ($rulesetFile) { Write-Host "Including custom ruleset" - $ruleset.includedRuleSets += @(@{ + $ruleset.includedRuleSets += @(@{ "action" = "Default" "path" = Get-BcContainerPath -containerName $containerName -path $ruleSetFile }) } $appSourceRulesetFile = Join-Path $folder "appsource.default.ruleset.json" Download-File -sourceUrl "https://bcartifacts.azureedge.net/rulesets/appsource.default.ruleset.json" -destinationFile $appSourceRulesetFile - $ruleset.includedRuleSets += @(@{ + $ruleset.includedRuleSets += @(@{ "action" = "Default" "path" = Get-BcContainerPath -containerName $containerName -path $appSourceRulesetFile }) @@ -1725,7 +1730,7 @@ Write-Host -ForegroundColor Yellow @' } if ($appJsonChanges) { - $appJsonContent = $appJson | ConvertTo-Json -Depth 99 + $appJsonContent = $appJson | ConvertTo-Json -Depth 99 [System.IO.File]::WriteAllLines($appJsonFile, $appJsonContent) } @@ -1763,10 +1768,11 @@ Write-Host -ForegroundColor Yellow @' "generatecrossreferences" = $generatecrossreferences "updateDependencies" = $UpdateDependencies "features" = $features + "generateErrorLog" = $generateErrorLog } if ($buildOutputFile) { - $parameters.OutputTo = { Param($line) + $parameters.OutputTo = { Param($line) Write-Host $line if ($line -like "$($folder)*") { Add-Content -Path $buildOutputFile -Value $line.SubString($folder.Length+1) -Encoding UTF8 @@ -1828,7 +1834,7 @@ Write-Host -ForegroundColor Yellow @' } } } - + if ($enableAppSourceCop -and $app) { $appSourceCopJson = @{} $saveit = $false @@ -1919,6 +1925,22 @@ Write-Host -ForegroundColor Yellow @' throw $_ } } + finally { + # Copy error logs to build artifact folder + if($generateErrorLog -and $buildArtifactFolder) { + # Define destination folder for error logs + $destFolder = Join-Path $buildArtifactFolder "ErrorLogs" + if (!(Test-Path $destFolder -PathType Container)) { + New-Item $destFolder -ItemType Directory | Out-Null + } + + $errorLogFile = Join-Path $appOutputFolder '*.errorLog.json' -Resolve -ErrorAction Ignore + if($errorLogFile) { + Write-Host "Copying error logs to $destFolder" + Copy-Item $errorLogFiles $destFolder -Force + } + } + } # Run post-compile script if specified if($PostCompileApp) { @@ -1990,7 +2012,7 @@ Write-Host -ForegroundColor Yellow @' $port = $config.DeveloperServicesPort $serverInstance = $webUri.AbsolutePath.Trim('/') } - + $launchSettings = [ordered]@{ "type" = 'al' "request" = 'launch' @@ -2023,14 +2045,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ($signApps -and !$useDevEndpoint -and !$useCompilerFolder) { if ($gitHubActions) { Write-Host "::group::Signing apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ - / ____(_) (_) - | (__ _ __ _ _ __ _ _ __ __ _ __ _ _ __ _ __ ___ + _____ _ _ + / ____(_) (_) + | (__ _ __ _ _ __ _ _ __ __ _ __ _ _ __ _ __ ___ \___ \| |/ _` | '_ \| | '_ \ / _` | / _` | '_ \| '_ \/ __| ____) | | (_| | | | | | | | | (_| | | (_| | |_) | |_) \__ \ |_____/|_|\__, |_| |_|_|_| |_|\__, | \__,_| .__/| .__/|___/ - __/ | __/ | | | | | - |___/ |___/ |_| |_| + __/ | __/ | | | | | + |___/ |___/ |_| |_| '@ Measure-Command { $apps | ForEach-Object { @@ -2057,14 +2079,14 @@ if (!$useDevEndpoint) { if ((!$doNotPerformUpgrade) -and ($previousApps)) { if ($gitHubActions) { Write-Host "::group::Installing previous apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ - |_ _| | | | | (_) (_) - | | _ __ ___| |_ __ _| | |_ _ __ __ _ _ __ _ __ _____ ___ ___ _ _ ___ __ _ _ __ _ __ ___ + _____ _ _ _ _ _ + |_ _| | | | | (_) (_) + | | _ __ ___| |_ __ _| | |_ _ __ __ _ _ __ _ __ _____ ___ ___ _ _ ___ __ _ _ __ _ __ ___ | | | '_ \/ __| __/ _` | | | | '_ \ / _` | | '_ \| '__/ _ \ \ / / |/ _ \| | | / __| / _` | '_ \| '_ \/ __| _| |_| | | \__ \ || (_| | | | | | | | (_| | | |_) | | | __/\ V /| | (_) | |_| \__ \ | (_| | |_) | |_) \__ \ |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, | | .__/|_| \___| \_/ |_|\___/ \__,_|___/ \__,_| .__/| .__/|___/ - __/ | | | | | | | - |___/ |_| |_| |_| + __/ | | | | | | | + |___/ |_| |_| |_| '@ Measure-Command { if ($testCountry) { @@ -2106,14 +2128,14 @@ if ($gitHubActions) { Write-Host "::endgroup::" } if ((!$doNotPublishApps) -and ($apps+$testApps+$bcptTestApps)) { if ($gitHubActions) { Write-Host "::group::Publishing apps" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ - | __ \ | | | (_) | | (_) - | |__) | _| |__ | |_ ___| |__ _ _ __ __ _ __ _ _ __ _ __ ___ + _____ _ _ _ _ _ + | __ \ | | | (_) | | (_) + | |__) | _| |__ | |_ ___| |__ _ _ __ __ _ __ _ _ __ _ __ ___ | ___/ | | | '_ \| | / __| '_ \| | '_ \ / _` | / _` | '_ \| '_ \/ __| | | | |_| | |_) | | \__ \ | | | | | | | (_| | | (_| | |_) | |_) \__ \ |_| \__,_|_.__/|_|_|___/_| |_|_|_| |_|\__, | \__,_| .__/| .__/|___/ - __/ | | | | | - |___/ |_| |_| + __/ | | | | | + |___/ |_| |_| '@ Measure-Command { if ($testCountry) { @@ -2131,7 +2153,7 @@ if (!($bcAuthContext)) { $upgradedApps = @() $apps | ForEach-Object { - + $folder = $appsFolder[$_] $appJsonFile = Join-Path $folder "app.json" $appJson = [System.IO.File]::ReadAllLines($appJsonFile) | ConvertFrom-Json @@ -2178,7 +2200,7 @@ if ($uninstallRemovedApps -and !$doNotPerformUpgrade) { "version" = $_.Version "uninstall" = $true } - + if (!$doNotPublishApps) { Invoke-Command -ScriptBlock $UnPublishBcContainerApp -ArgumentList $Parameters } @@ -2187,7 +2209,7 @@ if ($uninstallRemovedApps -and !$doNotPerformUpgrade) { } $testApps+$bcptTestApps | ForEach-Object { - + $Parameters = @{ "containerName" = $containerName "tenant" = $tenant @@ -2219,14 +2241,14 @@ if (!($doNotRunTests -and $doNotRunBcptTests)) { if ($ImportTestDataInBcContainer) { if ($gitHubActions) { Write-Host "::group::Importing test data" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ - |_ _| | | (_) | | | | | | | | - | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ __| | __ _| |_ __ _ + _____ _ _ _ _ _ _ + |_ _| | | (_) | | | | | | | | + | | _ __ ___ _ __ ___ _ __| |_ _ _ __ __ _ | |_ ___ ___| |_ __| | __ _| |_ __ _ | | | '_ ` _ \| '_ \ / _ \| '__| __| | '_ \ / _` | | __/ _ \/ __| __| / _` |/ _` | __/ _` | _| |_| | | | | | |_) | (_) | | | |_| | | | | (_| | | || __/\__ \ |_ | (_| | (_| | || (_| | |_____|_| |_| |_| .__/ \___/|_| \__|_|_| |_|\__, | \__\___||___/\__| \__,_|\__,_|\__\__,_| - | | __/ | - |_| |___/ + | | __/ | + |_| |___/ '@ if (!$enableTaskScheduler) { Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { @@ -2264,14 +2286,14 @@ $bcptResultsFile = Join-Path ([System.IO.Path]::GetDirectoryName($bcptTestResult if (!$doNotRunTests -and (($testFolders) -or ($installTestApps))) { if ($gitHubActions) { Write-Host "::group::Running tests" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ - | __ \ (_) | | | | - | |__) | _ _ __ _ __ _ _ __ __ _ | |_ ___ ___| |_ ___ + _____ _ _ _ + | __ \ (_) | | | | + | |__) | _ _ __ _ __ _ _ __ __ _ | |_ ___ ___| |_ ___ | _ / | | | '_ \| '_ \| | '_ \ / _` | | __/ _ \/ __| __/ __| | | \ \ |_| | | | | | | | | | | | (_| | | || __/\__ \ |_\__ \ |_| \_\__,_|_| |_|_| |_|_|_| |_|\__, | \__\___||___/\__|___/ - __/ | - |___/ + __/ | + |___/ '@ Measure-Command { if ($testCountry) { @@ -2394,21 +2416,21 @@ $testAppIds.Keys | ForEach-Object { if ($buildArtifactFolder -and (Test-Path $resultsFile)) { Write-Host "Copying test results to output" Copy-Item -Path $resultsFile -Destination $buildArtifactFolder -Force -} +} if ($gitHubActions) { Write-Host "::endgroup::" } } if (!$doNotRunBcptTests -and $bcptTestSuites) { if ($gitHubActions) { Write-Host "::group::Running BCPT tests" } Write-Host -ForegroundColor Yellow @' - _____ _ ____ _____ _____ _______ _ _ - | __ \ (_) | _ \ / ____| __ \__ __| | | | | - | |__) | _ _ __ _ __ _ _ __ __ _ | |_) | | | |__) | | | | |_ ___ ___| |_ ___ + _____ _ ____ _____ _____ _______ _ _ + | __ \ (_) | _ \ / ____| __ \__ __| | | | | + | |__) | _ _ __ _ __ _ _ __ __ _ | |_) | | | |__) | | | | |_ ___ ___| |_ ___ | _ / | | | '_ \| '_ \| | '_ \ / _` | | _ <| | | ___/ | | | __/ _ \/ __| __/ __| | | \ \ |_| | | | | | | | | | | | (_| | | |_) | |____| | | | | || __/\__ \ |_\__ \ |_| \_\__,_|_| |_|_| |_|_|_| |_|\__, | |____/ \_____|_| |_| \__\___||___/\__|___/ - __/ | - |___/ + __/ | + |___/ '@ Measure-Command { if ($testCountry) { @@ -2438,7 +2460,7 @@ $bcptTestSuites | ForEach-Object { if ($buildArtifactFolder -and (Test-Path $bcptResultsFile)) { Write-Host "Copying bcpt test results to output" Copy-Item -Path $bcptResultsFile -Destination $buildArtifactFolder -Force -} +} if ($gitHubActions) { Write-Host "::endgroup::" } } @@ -2453,14 +2475,14 @@ if (($gitLab -or $gitHubActions) -and !$allPassed) { if ($buildArtifactFolder) { if ($gitHubActions) { Write-Host "::group::Copy to build artifacts" } Write-Host -ForegroundColor Yellow @' - _____ _ _ _ _ _ _ _ __ _ - / ____| | | | | (_) | | | | | (_)/ _| | | - | | ___ _ __ _ _ | |_ ___ | |__ _ _ _| | __| | __ _ _ __| |_ _| |_ __ _ ___| |_ ___ + _____ _ _ _ _ _ _ _ __ _ + / ____| | | | | (_) | | | | | (_)/ _| | | + | | ___ _ __ _ _ | |_ ___ | |__ _ _ _| | __| | __ _ _ __| |_ _| |_ __ _ ___| |_ ___ | | / _ \| '_ \| | | | | __/ _ \ | '_ \| | | | | |/ _` | / _` | '__| __| | _/ _` |/ __| __/ __| | |___| (_) | |_) | |_| | | || (_) | | |_) | |_| | | | (_| | | (_| | | | |_| | || (_| | (__| |_\__ \ \______\___/| .__/ \__, | \__\___/ |_.__/ \__,_|_|_|\__,_| \__,_|_| \__|_|_| \__,_|\___|\__|___/ - | | __/ | - |_| |___/ + | | __/ | + |_| |___/ '@ Measure-Command { @@ -2479,6 +2501,7 @@ if (!(Test-Path $destFolder -PathType Container)) { $testApps | ForEach-Object { Copy-Item -Path $_ -Destination $destFolder -Force } + if ($createRuntimePackages) { $destFolder = Join-Path $buildArtifactFolder "RuntimePackages" if (!(Test-Path $destFolder -PathType Container)) { @@ -2511,7 +2534,7 @@ if ($createRuntimePackages) { "pfxFile" = $codeSignCertPfxFile "pfxPassword" = $codeSignCertPfxPassword } - + Invoke-Command -ScriptBlock $SignBcContainerApp -ArgumentList $Parameters } @@ -2539,14 +2562,14 @@ if (!$keepContainer) { if ($gitHubActions) { Write-Host "::group::Removing container" } if (!($err)) { Write-Host -ForegroundColor Yellow @' - _____ _ _ _ - | __ \ (_) | | (_) - | |__) |___ _ __ ___ _____ ___ _ __ __ _ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ + _____ _ _ _ + | __ \ (_) | | (_) + | |__) |___ _ __ ___ _____ ___ _ __ __ _ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ | _ // _ \ '_ ` _ \ / _ \ \ / / | '_ \ / _` | / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__| - | | \ \ __/ | | | | | (_) \ V /| | | | | (_| | | (_| (_) | | | | || (_| | | | | | __/ | - |_| \_\___|_| |_| |_|\___/ \_/ |_|_| |_|\__, | \___\___/|_| |_|\__\__,_|_|_| |_|\___|_| - __/ | - |___/ + | | \ \ __/ | | | | | (_) \ V /| | | | | (_| | | (_| (_) | | | | || (_| | | | | | __/ | + |_| \_\___|_| |_| |_|\___/ \_/ |_|_| |_|\__, | \___\___/|_| |_|\__\__,_|_|_| |_|\___|_| + __/ | + |___/ '@ } Measure-Command { diff --git a/CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1 b/CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1 index f49933c4e..7e321dab5 100644 --- a/CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1 +++ b/CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1 @@ -1,4 +1,4 @@ -<# +<# .Synopsis Compile app without docker (used by Run-AlPipeline to compile apps without docker) .Description @@ -94,6 +94,7 @@ function Compile-AppWithBcCompilerFolder { [string] $FailOn = 'none', [Parameter(Mandatory=$false)] [string] $rulesetFile, + [switch] $generateErrorLog, [switch] $enableExternalRulesets, [string[]] $CustomCodeCops = @(), [Parameter(Mandatory=$false)] @@ -143,7 +144,7 @@ try { AddTelemetryProperty -telemetryScope $telemetryScope -key "name" -value $appJsonObject.Name AddTelemetryProperty -telemetryScope $telemetryScope -key "version" -value $appJsonObject.Version AddTelemetryProperty -telemetryScope $telemetryScope -key "appname" -value $appName - + if (!(Test-Path $appOutputFolder -PathType Container)) { New-Item $appOutputFolder -ItemType Directory | Out-Null } @@ -382,6 +383,11 @@ try { $alcParameters += @("/nowarn:$nowarn") } + if ($generateErrorLog) { + $errorLogFilePath = $appOutputFile -replace '.app$', '.errorLog.json' + $alcParameters += @("/errorLog:""$errorLogFilePath""") + } + if ($GenerateCrossReferences -and $platformversion.Major -ge 18) { $alcParameters += @("/generatecrossreferences") } @@ -428,11 +434,11 @@ try { finally { Pop-Location } - + if ($lastexitcode -ne 0 -and $lastexitcode -ne -1073740791) { "App generation failed with exit code $lastexitcode" } - + if ($treatWarningsAsErrors) { $regexp = ($treatWarningsAsErrors | ForEach-Object { if ($_ -eq '*') { ".*" } else { $_ } }) -join '|' $result = $result | ForEach-Object { $_ -replace "^(.*)warning ($regexp):(.*)`$", '$1error $2:$3' } diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 1be601398..e9ed73d50 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -5,15 +5,14 @@ New-AppSourceSubmission obsoleted parameter -doNotCheckVersionNumber that was pr Issue 3219 Run-AlValidation cannot validate against Next Major without an insider Sas token Do not attempt to call Get-BcContainerAppInfo if we are using filesonly containers in Run-AlPipeline Do not attempt to download unknown symbols from filesonly containers +Add paramater generateErrorLog to Compile-AppInNavContainer 6.0.0 Add parameter -accept_insiderEULA on New-BcContainer, Get-BcArtifactUrl and Run-AlPipeline to accept the insider EULA (https://go.microsoft.com/fwlink/?linkid=2245051) instead of using the insider SAS token. The insider SAS token is still supported until April 2024 where the last insider SAS token will expire... Remove the need for Insider SAS token in Create Container wizard and Create AL-Go repo wizard Add parameter EnableExternalRulesets to Run-AlPipeline (which will be added to the compiler when compiling) -Issue https://github.com/microsoft/AL-Go/issues/709 Include unknown app dependencies from previous apps (which doesn't already exist in unknown app dependencies) -Do not hide real exception in invoke-git and invoke-gh -Truncate body part to 15000 characters in invoke-gh +Add paramater generateErrorLog to Compile-AppInNavContainer 5.0.7 Run-AlValidation also needs to install NAVSIP dependencies (issue #3190) @@ -45,7 +44,7 @@ Issue #3089 Regression: Cannot find path 'C:\Windows\SysWow64\NavSip.dll' becaus Issue #3087 Enter-BCContainer on PowerShell 7 doesn't seem to work Add parameters `PreCompileApp` and `PostCompileApp` to `Run-AlPipeline` to allow running custom scripts before and after compiling an app. Add parameter `EnableExternalRulesets` to compile functions to support new alc feature. -Issue #3099 Compile-AppWithBcCompilerFolder: The variable '$platformversion' cannot be retrieved because it has not been set. +Issue #3099 Compile-AppWithBcCompilerFolder: The variable '$platformversion' cannot be retrieved because it has not been set. Flush-ContainerHelperCache will now also run docker image prune with a filter until=xxh (based on keepdays) Add 4 new parameters to Compile-AppInBcContainer and Compile-AppWithBcCompilerFolder: SourceRepositoryUrl, SourceCommit, BuildBy and BuildUrl. The value of these parameters will be stamped into the app manifest. Performance Tests doesn't run due to wrong version of Microsoft.IdentityModel.Clients.ActiveDirectory.dll in the Applications\testframework\TestRunner\Internal folder @@ -172,7 +171,7 @@ Experimantal support for running BcContainerHelper on Linux (only non-container Adding additional properties to telemetry. Set MicrosoftTelemetryConnectionString to an empty string in settings to opt-out. 4.0.8 -Add parameter 'features' to Run-AlPipeline which allows for setting the compiler features +Add parameter 'features' to Run-AlPipeline which allows for setting the compiler features Add SchemaSyncMode to Publish-PerTenantExtensionApps Use submodules inside BcContainerHelper New PROOF OF CONCEPT PREVIEW function New-ALGoRepo to create a new AL-Go repository based on PTE or AppSource App templates @@ -245,7 +244,7 @@ Issue #2650 issue warning if TaskScheduler is not running when using UploadImpor 3.0.12 Error in retry method in Get-BcArtifactUrl (3.0.11) Fixed array parsing in Get-BcContainerAppInfo (only if -useNewFormat switch is included) -Added ContainerHelper config UseNewFormatForGetBcContainerAppInfo with which you can force Get-BcContainerAppInfo to return values in new format +Added ContainerHelper config UseNewFormatForGetBcContainerAppInfo with which you can force Get-BcContainerAppInfo to return values in new format Issue #2573 improve error message when restoring database on host Issue #2575 Backup-BcContainerDatabases doesn't work with external SQL Server (if hosthelperfolder is different from containerhelperfolder) Issue #2598 NavSip.dll missing in SysWOW64 on business central 21.0 artifact @@ -256,7 +255,7 @@ Issue #2587 Run-ALPipeline with App Name Change Partial fix for Issue #2595 (Issues with "Edit in Excel" for container behind traefik) Issue #2523 New-BcContainerBcUser returns 'The Aggregate Permission Set does not exist.' on BC20 (this bug also requires a BC fix - available in 20.4) New Function Get-BcScheduledUpgrade which calls the admin center api to check for BC SaaS CU updates -New Function Reschedule-BcUpgrade which calls the admin center api to reschedule an BC SaaS environment upgrade to a given datetime +New Function Reschedule-BcUpgrade which calls the admin center api to reschedule an BC SaaS environment upgrade to a given datetime Workaround for issue #2607 BcContainerHelper Networking and static IP Added parameter -macAddress to New-BcContainer to enable setting the container Mac Address Added parameter -IP to New-BcContainer to enable setting the container IP Address @@ -389,7 +388,7 @@ Better AAD support for containers Add AadTenant, AadAppIdUri and AadAppId to New-BcContainer for enhanced AAD support Issue #2267 Publish-BcContainerApp as Delegated Admin doesn't work Add standard audience as valid to support the current implementation in the AL extension when calling the dev endpoint with AAD auth -Issue #2274 Unable to download symbols for 1st party apps in localized containers with Run-ALValidation +Issue #2274 Unable to download symbols for 1st party apps in localized containers with Run-ALValidation 3.0.0 Enable Telemetry. BcContainerHelper will emit usage statistics telemetry to Microsoft for all commands used. diff --git a/Tests/AppHandling (NAV).Tests.ps1 b/Tests/AppHandling (NAV).Tests.ps1 index 45448889f..9008a38f0 100644 --- a/Tests/AppHandling (NAV).Tests.ps1 +++ b/Tests/AppHandling (NAV).Tests.ps1 @@ -31,6 +31,18 @@ Describe 'AppHandling' { $navAppFile = Compile-AppInNavContainer -containerName $navContainerName -appProjectFolder $appProjectFolder -appOutputFolder $appOutputFolder -appSymbolsFolder $appSymbolsFolder -UpdateSymbols -credential $credential $navAppFile | Should -Exist } + It 'Compile-AppInNavContainer generates error log file' { + Copy-Item -Path (Join-Path $PSScriptRoot "nav-app") -Destination $navContainerPath -Recurse -Force + $appProjectFolder = Join-Path $navContainerPath "nav-app" + $appOutputFolder = Join-Path $appProjectFolder "output" + $appSymbolsFolder = Join-Path $appProjectFolder "symbols" + + $navAppFile = Compile-AppInNavContainer -containerName $navContainerName -appProjectFolder $appProjectFolder -appOutputFolder $appOutputFolder -appSymbolsFolder $appSymbolsFolder -generateErrorLog -UpdateSymbols -credential $credential + $navAppFile | Should -Exist + + $errorLogFile = $navAppFile -replace '.app$', '.errorLog.json' + $errorLogFile | Should -Exist + } It 'Extract-AppFileToFolder (nav app)' { $navAppFileName = "$($appPublisher)_$($appName)_$($appVersion).app".Split([System.IO.Path]::GetInvalidFileNameChars()) -join '' $navAppFile = Join-Path $navContainerPath "nav-app\output\$navAppFileName"