nerm/Build.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

function Get-FunctionsToExport {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
        [ValidateNotNullOrEmpty()]
        [Alias('FullName')]
        $Path
    )

    Process {
        $Token = $null
        $ParserErr = $null

        $Ast = [System.Management.Automation.Language.Parser]::ParseFile(
            $Path,
            [ref]$Token,
            [ref]$ParserErr
        )

        if ($ParserErr) {
            throw $ParserErr
        } else {
            foreach ($name in 'Begin', 'Process', 'End') {
                foreach ($Statement in $Ast."${name}Block".Statements) {
                    if (
                        [String]::IsNullOrWhiteSpace($Statement.Name) -or
                        $Statement.Extent.ToString() -notmatch
                        ('function\W+{0}' -f $Statement.Name)
                    ) {
                        continue
                    }

                    $Statement.Name
                }
            }
        }
    }
}

$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$FunctionPath = "$PSScriptRoot/src/PSSailpoint.NERM/Api", "$PSScriptRoot/src/PSSailpoint.NERM/Client","$PSScriptRoot/src/PSSailpoint.NERM/Model" | ForEach-Object { $_ }


$Manifest = @{
    Path = "$ScriptDir\src\PSSailpoint.NERM\PSSailpoint.NERM.psd1"

    Author = 'OpenAPI Generator Team'
    CompanyName = 'SailPoint Technologies'
    Description = 'PSSailpoint.NERM - the PowerShell module for NERM API'

    ModuleVersion = '2.0.7'

    RootModule = 'PSSailpoint.NERM.psm1'
    Guid = 'DA15D2A5-9C05-455C-94AC-43A7B29472FF' # Has to be static, otherwise each new build will be considered different module

    PowerShellVersion = '6.2'

    FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport

    VariablesToExport = @()
    AliasesToExport = @()
    CmdletsToExport = @()

}

New-ModuleManifest @Manifest