Modules/businessdev.ALbuild.Apps/Private/Get-BcCompilerArguments.ps1

function Get-BcCompilerArguments {
    <#
    .SYNOPSIS
        Builds the AL compiler (alc) argument list.
    .DESCRIPTION
        Internal, pure helper (no I/O) so command construction is unit-testable. Produces the
        documented AL compiler switches (/project, /packagecachepath, /out, /analyzer, /ruleset,
        /assemblyprobingpaths, /loglevel).
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '',
        Justification = 'Returns a list of compiler arguments; plural is intentional and the function is private.')]
    [CmdletBinding()]
    [OutputType([string[]])]
    param(
        [Parameter(Mandatory)] [string] $ProjectFolder,
        [Parameter(Mandatory)] [string] $OutputFile,
        [string[]] $PackageCachePath = @(),
        [string[]] $Analyzer = @(),
        [string] $RuleSet,
        [string[]] $AssemblyProbingPath = @(),
        [ValidateSet('', 'Error', 'Warning', 'Verbose', 'Normal')] [string] $LogLevel = ''
    )

    $list = [System.Collections.Generic.List[string]]::new()
    $list.Add("/project:$ProjectFolder")
    $list.Add("/out:$OutputFile")
    foreach ($path in $PackageCachePath) { $list.Add("/packagecachepath:$path") }
    foreach ($analyzer in $Analyzer)      { $list.Add("/analyzer:$analyzer") }
    if ($RuleSet)                          { $list.Add("/ruleset:$RuleSet") }
    foreach ($probe in $AssemblyProbingPath) { $list.Add("/assemblyprobingpaths:$probe") }
    if ($LogLevel)                         { $list.Add("/loglevel:$LogLevel") }

    return $list.ToArray()
}