Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ jobs:
steps:
- name: Check Version
run: $PSVersionTable
- uses: actions/checkout@v1
- uses: actions/checkout@v6
- name: Test and Build
run: ./build.ps1 -Force -Configuration Release
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: ClassExplorer
path: ./Release/ClassExplorer
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
if: matrix.os != 'windows-latest'
with:
name: ClassExplorer-${{ matrix.os }}
path: ./Release/ClassExplorer
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (${{ matrix.os }})
path: ./TestResults/Pester.xml
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
name: Publish
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v6
- name: Test and Build
run: ./build.ps1 -Force -Publish -Configuration Release
env:
GALLERY_API_KEY: ${{ secrets.GALLERY_API_KEY }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Unit Test Results
path: ./TestResults/Pester.xml
87 changes: 44 additions & 43 deletions ClassExplorer.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ param(
[switch] $Force
)

$moduleName = 'ClassExplorer'
$testModuleManifestSplat = @{
ErrorAction = 'Ignore'
WarningAction = 'Ignore'
Path = "$PSScriptRoot\module\$moduleName.psd1"
}

$manifest = Test-ModuleManifest @testModuleManifestSplat
$moduleVersion = $manifest.Version

$tools = "$PSScriptRoot\tools"
$script:GetDotNet = Get-Command $tools\GetDotNet.ps1
$script:AssertModule = Get-Command $tools\AssertRequiredModule.ps1
Expand Down Expand Up @@ -61,6 +51,8 @@ function GetArtifactPath {
$target = $legacyTarget
}

# dotnet always uses lower case for the path now for some reason
$config = $config.ToLowerInvariant()
if (-not $FileName) {
return "./artifacts/publish/$moduleName/${config}_${target}"
}
Expand Down Expand Up @@ -93,6 +85,7 @@ task GetProjectInfo {

$manifest = Test-ModuleManifest @testModuleManifestSplat
$script:ModuleVersion = $manifest.Version
$script:ReleasePath = "./Release/$script:ModuleName/$script:ModuleVersion"
$script:_IsWindows = $true
$runtimeInfoType = 'System.Runtime.InteropServices.RuntimeInformation' -as [type]
try {
Expand All @@ -106,7 +99,7 @@ task AssertDotNet {
$script:dotnet = & $GetDotNet -Unix:(-not $script:_IsWindows)
}

task AssertOpenCover -If { $GenerateCodeCoverage.IsPresent } {
task AssertOpenCover -If { $false } {
if (-not $script:_IsWindows) {
Write-Warning 'Generating code coverage from .NET core is currently unsupported, disabling code coverage generation.'
$script:GenerateCodeCoverage = $false
Expand All @@ -132,7 +125,7 @@ task Clean {
}

task BuildDocs -If { Test-Path ./docs/$PSCulture/*.md } {
$releaseDocs = "./Release/ClassExplorer/$moduleVersion"
$releaseDocs = $script:ReleasePath
$null = New-Item $releaseDocs/$PSCulture -ItemType Directory -Force -ErrorAction Ignore
$null = New-ExternalHelp -Path ./docs/$PSCulture -OutputPath $releaseDocs/$PSCulture

Expand All @@ -149,19 +142,15 @@ task BuildDll {
}

task CopyToRelease {
$version = $script:ModuleVersion
$modern = $script:ModernTarget
$legacy = $script:LegacyTarget

$releasePath = "./Release/ClassExplorer/$version"
if (-not (Test-Path -LiteralPath $releasePath)) {
$null = New-Item $releasePath -ItemType Directory
$release = $script:ReleasePath
if (-not (Test-Path -LiteralPath $release)) {
$null = New-Item $release -ItemType Directory
}

Copy-Item -Path ./module/* -Destination $releasePath -Recurse -Force
Copy-Item -Path ./module/* -Destination $release -Recurse -Force

if ($script:_IsWindows) {
$null = New-Item $releasePath/bin/Legacy -Force -ItemType Directory
$null = New-Item $release/bin/Legacy -Force -ItemType Directory
$legacyFiles = (
'ClassExplorer.dll',
'ClassExplorer.pdb',
Expand All @@ -172,33 +161,42 @@ task CopyToRelease {
'System.Runtime.CompilerServices.Unsafe.dll')

foreach ($file in $legacyFiles) {
Copy-Item -Force -LiteralPath ./artifacts/publish/ClassExplorer/${Configuration}_$legacy/$file -Destination $releasePath/bin/Legacy
Copy-Item -Force -LiteralPath (GetArtifactPath -FileName $file -Legacy) -Destination $release/bin/Legacy
}
}

$null = New-Item $releasePath/bin/Modern -Force -ItemType Directory
$null = New-Item $release/bin/Modern -Force -ItemType Directory
$modernFiles = (
'ClassExplorer.dll',
'ClassExplorer.pdb',
'ClassExplorer.deps.json')
foreach ($file in $modernFiles) {
Copy-Item -Force -LiteralPath ./artifacts/publish/ClassExplorer/${Configuration}_$modern/$file -Destination $releasePath/bin/Modern
Copy-Item -Force -LiteralPath (GetArtifactPath -FileName $file) -Destination $release/bin/Modern
}
}

task DoTest -If { Test-Path ./test/*.ps1 } {
if (-not $script:_IsWindows) {
$scriptString = '
$projectPath = "{0}"
Invoke-Pester "$projectPath" -OutputFormat NUnitXml -OutputFile "$projectPath\testresults\pester.xml"
' -f $PSScriptRoot
} else {
$scriptString = '
Set-ExecutionPolicy Bypass -Force -Scope Process
$projectPath = "{0}"
Invoke-Pester "$projectPath" -OutputFormat NUnitXml -OutputFile "$projectPath\testresults\pester.xml"
' -f $PSScriptRoot
}

$scriptString = @(
if (-not $script:_IsWindows) {
'Set-ExecutionPolicy Bypass -Force -Scope Process'
''
}

'$projectPath = ''{0}''' -f $PSScriptRoot
'$config = New-PesterConfiguration @{'
' Run = @{'
' Path = $projectPath'
' }'
' TestResult = @{'
' Enable = $true'
' OutputFormat = ''NUnitXml'''
' OutputPath = "$projectPath\testresults.pester.xml"'
' }'
'}'
''
'Invoke-Pester -Configuration $config'
) -join [Environment]::NewLine

$encodedCommand =
[convert]::ToBase64String(
Expand All @@ -210,19 +208,22 @@ task DoTest -If { Test-Path ./test/*.ps1 } {
$powershellCommand = 'pwsh'
}

$powershell = (Get-Command -CommandType Application $powershellCommand).Source
$powershell = Get-Command -CommandType Application $powershellCommand |
Select-Object -First 1 -ExpandProperty Source

# Can't be bothered atm, gotta modernize this at some point.
$GenerateCodeCoverage = $false
if ($GenerateCodeCoverage.IsPresent) {
# OpenCover needs full pdb's. I'm very open to suggestions for streamlining this...
# & $dotnet clean
& $dotnet publish --configuration $Configuration --framework $script:LegacyTarget --verbosity quiet --nologo /p:DebugType=Full

$moduleName = $Settings.Name
$release = '{0}\bin\Desktop\{1}' -f $Folders.Release, $moduleName
$coverage = '{0}\net471\{1}' -f $Folders.Build, $moduleName
$release = "$script:ReleasePath/bin/Legacy/$script:ModuleName"
$coverage = GetArtifactPath -Legacy $script:ModuleName

Rename-Item "$release.pdb" -NewName "$moduleName.pdb.tmp"
Rename-Item "$release.dll" -NewName "$moduleName.dll.tmp"
Rename-Item "$release.pdb" -NewName "$script:ModuleName.pdb.tmp"
Rename-Item "$release.dll" -NewName "$script:ModuleName.dll.tmp"
Copy-Item "$coverage.pdb" "$release.pdb"
Copy-Item "$coverage.dll" "$release.dll"

Expand All @@ -236,8 +237,8 @@ task DoTest -If { Test-Path ./test/*.ps1 } {

Remove-Item "$release.pdb"
Remove-Item "$release.dll"
Rename-Item "$release.pdb.tmp" -NewName "$moduleName.pdb"
Rename-Item "$release.dll.tmp" -NewName "$moduleName.dll"
Rename-Item "$release.pdb.tmp" -NewName "$script:ModuleName.pdb"
Rename-Item "$release.dll.tmp" -NewName "$script:ModuleName.dll"
} else {
& $powershell -NoProfile -EncodedCommand $encodedCommand
}
Expand Down
23 changes: 18 additions & 5 deletions docs/en-US/ClassExplorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,33 @@ Type signatures are a custom query language built into PowerShell type expressio

### [Find-Member](Find-Member.md)

The Find-Member cmdlet searches the AppDomain for members that fit specified criteria. You can search the entire AppDomain, search in specific types, or filter an existing list of members.
The `Find-Member` cmdlet searches the AppDomain for members that fit specified criteria. You can search the entire AppDomain, search in specific types, or filter an existing list of members.

### [Find-Type](Find-Type.md)

The Find-Type cmdlet searches the AppDomain for .NET classes that match specified criteria.
The `Find-Type` cmdlet searches the AppDomain for .NET classes that match specified criteria.

### [Get-Assembly](Get-Assembly.md)

The Get-Assembly cmdlet gets assemblies loaded in the AppDomain.
The `Get-Assembly` cmdlet gets assemblies loaded in the AppDomain.

### [Get-Parameter](Get-Parameter.md)

The Get-Parameter cmdlet gets parameter info from a member.
The `Get-Parameter` cmdlet gets parameter info from a member.

### [Format-MemberSignature](Format-MemberSignature.md)

The Format-MemberSignature cmdlet uses the input reflection objects to generate reference library style C# pseudo code. Use this cmdlet to get a more in depth look at specific member including attribute decorations, generic type constraints, and more.
The `Format-MemberSignature` cmdlet uses the input reflection objects to generate reference library style C# pseudo code. Use this cmdlet to get a more in depth look at specific member including attribute decorations, generic type constraints, and more.

### [Invoke-Member](Invoke-Member.md)

The `Invoke-Member` cmdlet takes a reflection info (`System.Reflection.MemberInfo`) object and
facilitates seamless invocation in a pipeline. `Invoke-Member` will handle any necessary
conversions, unwrapping of psobjects, and streamlined `ref` handling for interactive use.

### [Get-AssemblyLoadContext](Get-AssemblyLoadContext.md)

The `Get-AssemblyLoadContext` cmdlet gets all currently active assembly load
contexts (ALCs), or the relevant ALCs if any parameters are specified.

This command is only supported in PowerShell 7+
2 changes: 2 additions & 0 deletions docs/en-US/Find-Member.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,3 +677,5 @@ Matched MemberInfo objects will be returned to the pipeline.
[Get-Assembly](Get-Assembly.md)
[Get-Parameter](Get-Parameter.md)
[Format-MemberSignature](Format-MemberSignature.md)
[Invoke-Member](Invoke-Member.md)
[Get-AssemblyLoadContext](Get-AssemblyLoadContext.md)
2 changes: 2 additions & 0 deletions docs/en-US/Find-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,5 @@ Matched Type objected will be returned to the pipeline.
[Get-Assembly](Get-Assembly.md)
[Get-Parameter](Get-Parameter.md)
[Format-MemberSignature](Format-MemberSignature.md)
[Invoke-Member](Invoke-Member.md)
[Get-AssemblyLoadContext](Get-AssemblyLoadContext.md)
2 changes: 2 additions & 0 deletions docs/en-US/Format-MemberSignature.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,5 @@ The formatted display string will be returned to the pipeline.
[Find-Member](Find-Member.md)
[Get-Assembly](Get-Assembly.md)
[Get-Parameter](Get-Parameter.md)
[Invoke-Member](Invoke-Member.md)
[Get-AssemblyLoadContext](Get-AssemblyLoadContext.md)
2 changes: 2 additions & 0 deletions docs/en-US/Get-Assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ Matched Assembly objects will be returned to the pipeline.
[Find-Member](Find-Member.md)
[Get-Parameter](Get-Parameter.md)
[Format-MemberSignature](Format-MemberSignature.md)
[Invoke-Member](Invoke-Member.md)
[Get-AssemblyLoadContext](Get-AssemblyLoadContext.md)
Loading
Loading