mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
PS AddType - Add the ability to supply custom compile symbols for C# code (#54582)
This commit is contained in:
parent
bce75824b1
commit
2750f39391
2 changed files with 31 additions and 2 deletions
|
@ -33,6 +33,11 @@ Function Add-CSharpType {
|
|||
[Switch] Whether to include debug information in the compiled
|
||||
assembly. Cannot be used when AnsibleModule is set. This is a no-op
|
||||
when running on PSCore.
|
||||
|
||||
.PARAMETER CompileSymbols
|
||||
[String[]] A list of symbols to be defined during compile time. These are
|
||||
added to the existing symbols, 'CORECLR', 'WINDOWS', 'UNIX' that are set
|
||||
conditionalls in this cmdlet.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][AllowEmptyCollection()][String[]]$References,
|
||||
|
@ -40,7 +45,8 @@ Function Add-CSharpType {
|
|||
[Switch]$PassThru,
|
||||
[Parameter(Mandatory=$true, ParameterSetName="Module")][Object]$AnsibleModule,
|
||||
[Parameter(ParameterSetName="Manual")][String]$TempPath = $env:TMP,
|
||||
[Parameter(ParameterSetName="Manual")][Switch]$IncludeDebugInfo
|
||||
[Parameter(ParameterSetName="Manual")][Switch]$IncludeDebugInfo,
|
||||
[String[]]$CompileSymbols = @()
|
||||
)
|
||||
if ($null -eq $References -or $References.Length -eq 0) {
|
||||
return
|
||||
|
@ -49,7 +55,7 @@ Function Add-CSharpType {
|
|||
# define special symbols CORECLR, WINDOWS, UNIX if required
|
||||
# the Is* variables are defined on PSCore, if absent we assume an
|
||||
# older version of PowerShell under .NET Framework and Windows
|
||||
$defined_symbols = [System.Collections.ArrayList]@()
|
||||
$defined_symbols = [System.Collections.ArrayList]$CompileSymbols
|
||||
$is_coreclr = Get-Variable -Name IsCoreCLR -ErrorAction SilentlyContinue
|
||||
if ($null -ne $is_coreclr) {
|
||||
if ($is_coreclr.Value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue