Modules/businessdev.ALbuild.Apps/Private/Test-BcSymbolOnlyApp.ps1
|
function Test-BcSymbolOnlyApp { <# .SYNOPSIS Returns $true when a .app package is symbol-only (compile-time symbols, not a runtime app). .DESCRIPTION Internal helper. Symbol-only packages (e.g. from a NuGet symbols feed) can be compiled against but must not be published/installed into a container. Detection uses the AL Tool's 'al IsSymbolOnly <path>' command. When the AL Tool is not available the package is treated as installable ($false) so behaviour degrades gracefully rather than skipping real apps. .PARAMETER Path Path to the .app package. .OUTPUTS System.Boolean #> [CmdletBinding()] [OutputType([bool])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Path ) $altool = @('al', 'altool') | ForEach-Object { Get-Command -Name $_ -ErrorAction SilentlyContinue } | Select-Object -First 1 if (-not $altool) { return $false } $result = Invoke-ALbuildProcess -FilePath $altool.Source -Arguments @('IsSymbolOnly', $Path) -PassThru -SuccessExitCodes @(0, 1) # The command reports the answer on stdout (and/or via exit code). Treat an explicit 'true' as # symbol-only; anything else (including failures) as installable. return ("$($result.StdOut)" -match '(?im)^\s*true\s*$') -or ("$($result.StdOut)".Trim() -ieq 'true') } |