Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/dessant/lock-thr…
Browse files Browse the repository at this point in the history
…eads-4.0.0
  • Loading branch information
Charlie Lin committed Jun 27, 2023
2 parents b68b90a + b57902e commit 6aeee57
Show file tree
Hide file tree
Showing 352 changed files with 10,352 additions and 5,272 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-frontends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

Expand Down
58 changes: 45 additions & 13 deletions .github/workflows/build-ilspy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fetch-depth: 0

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
uses: microsoft/setup-msbuild@v1.3

- name: Install dotnet-format
run: dotnet tool install -g dotnet-format --version "6.2.315104" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json
Expand All @@ -37,7 +37,7 @@ jobs:
shell: pwsh
run: |
.\BuildTools\ghactions-install.ps1
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "::set-output name=$($_.Name)::$($_.Value)" }
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "$($_.Name)=$($_.Value)" } | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Restore the application
run: msbuild ILSpy.sln /t:Restore /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform
Expand All @@ -60,7 +60,7 @@ jobs:
path: 'test-results/${{ matrix.configuration }}.xml'

- name: Create Test Report
uses: test-summary/action@v1
uses: test-summary/action@v2
if: always()
with:
paths: "test-results/${{ matrix.configuration }}.xml"
Expand All @@ -78,14 +78,30 @@ jobs:
- name: Zip ILSpy (framework-dependent)
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll

- name: Zip ILSpy Release (self-contained win-x64)
if: matrix.configuration == 'release'
- name: Publish x64/arm64 framework-dependent/self-contained
shell: pwsh
run: .\publish.ps1

- name: Zip ILSpy Release (x64 self-contained)
if: matrix.configuration == 'release'
run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net6.0-windows\win-x64\publish\selfcontained\*

- name: Zip ILSpy Release (arm64 framework-dependent)
if: matrix.configuration == 'release'
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net6.0-windows\win-arm64\publish\fwdependent\*

- name: Build Installer (x64 and arm64, framework-dependent)
if: matrix.configuration == 'release'
run: |
msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU"
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:DefineConstants="ARM64"
- name: Build VS Extensions (for 2017-2019 and 2022)
if: matrix.configuration == 'release'
run: |
dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --self-contained -r win-x64
dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --self-contained -r win-x64
dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --self-contained -r win-x64
7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net6.0-windows\win-x64\publish\*
msbuild ILSpy.VSExtensions.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
msbuild ILSpy.VSExtensions.sln /p:Configuration="Release" /p:Platform="Any CPU"
# https://github.com/actions/upload-artifact
- name: Upload VSIX (VS 2019) release build artifacts
Expand Down Expand Up @@ -137,20 +153,36 @@ jobs:
path: ${{ env.StagingDirectory }}\ILSpy_binaries.zip
if-no-files-found: error

- name: Upload self-contained zip build artifacts (Release-only)
- name: Upload x64 self-contained zip (Release-only)
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v3
with:
name: ILSpy self-contained x64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
path: ${{ env.StagingDirectory }}\ILSpy_selfcontained_x64.zip
if-no-files-found: error

- name: Upload installer artifact
- name: Upload arm64 framework-dependent zip (Release-only)
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v3
with:
name: ILSpy arm64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
path: ${{ env.StagingDirectory }}\ILSpy_binaries_arm64.zip
if-no-files-found: error

- name: Upload x64 installer artifact
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v3
with:
name: ILSpy Installer x64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
path: ILSpy.Installer\wix\*-x64.msi
if-no-files-found: error

- name: Upload arm64 installer artifact
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v3
with:
name: ILSpy Installer ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
path: ILSpy.Installer\wix\*.msi
name: ILSpy Installer arm64 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
path: ILSpy.Installer\wix\*-arm64.msi
if-no-files-found: error

- name: Upload ilspycmd release build artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
languages: ${{ matrix.language }}

- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/[email protected]

- uses: dessant/[email protected]
with:
github-token: ${{ github.token }}
issue-inactive-days: '90'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ _ReSharper*/
*.ReSharper
*.patch
.vs/
.idea/
/ILSpy.AddIn*/Packages/*
/ILSpy.AddIn*/source.extension.vsixmanifest
/ICSharpCode.Decompiler.Tests/TestCases/Disassembler/Pretty/*.dll
Expand All @@ -18,3 +19,4 @@ multitargeting.props
ILSpy.Installer/wix/
/VERSION
/ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.cs
*/.vscode/
10 changes: 5 additions & 5 deletions BuildTools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ if [ ! -d "$DOTNET_PATH" ]; then
fi

"$DOTNET_PATH/dotnet-format.exe" --version
#if git diff --quiet --ignore-submodules; then
# "$DOTNET_PATH/dotnet-format.exe" whitespace --no-restore --verbosity detailed ILSpy.sln
# git add -u -- \*\*.cs
#else
if git diff --quiet --ignore-submodules; then
"$DOTNET_PATH/dotnet-format.exe" whitespace --no-restore --verbosity detailed ILSpy.sln
git add -u -- \*\*.cs
else
exec "$DOTNET_PATH/dotnet-format.exe" whitespace --verify-no-changes --no-restore --verbosity detailed ILSpy.sln
#fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void Report(DecompilationProgress value)
lock (syncObject)
{
completed++;
progress = new ProgressRecord(1, "Decompiling " + fileName, $"Completed {completed} of {value.TotalNumberOfFiles}: {value.Status}") {
PercentComplete = (int)(completed * 100.0 / value.TotalNumberOfFiles)
progress = new ProgressRecord(1, "Decompiling " + fileName, $"Completed {completed} of {value.TotalUnits}: {value.Status}") {
PercentComplete = (int)(completed * 100.0 / value.TotalUnits)
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
<Compile Include="..\ICSharpCode.ILSpyX\PdbProvider\DebugInfoUtils.cs" Link="DebugInfoUtils.cs" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command="powershell -Command &quot;Copy-Item $(ProjectDir)manifest.psd1 $(TargetDir)$(TargetName).psd1&quot;" />
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command="pwsh -Command &quot;Copy-Item $(ProjectDir)manifest.psd1 $(TargetDir)$(TargetName).psd1&quot;" />
</Target>
</Project>
11 changes: 6 additions & 5 deletions ICSharpCode.Decompiler.PowerShell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ Built using https://github.com/PowerShell/PowerShell/blob/master/docs/cmdlet-exa

Sample usage: Demo.ps1

Tested with: PowerShell 5.1 on Windows, PowerShell Core on Windows and Mac (Beta9)
Tested with: PowerShell 5.1 on Windows, PowerShell 7+ on Windows and Mac



## Missing

.psd1 for deploying to https://www.powershellgallery.com/
Publishing to https://www.powershellgallery.com/

* https://learn.microsoft.com/en-us/powershell/gallery/how-to/publishing-packages/publishing-a-package
* https://learn.microsoft.com/en-us/powershell/gallery/concepts/publishing-guidelines

## Links for developing PS cmdlets

* https://docs.microsoft.com/en-us/powershell/gallery/psgallery/creating-and-publishing-an-item
* https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/how-to-write-a-simple-cmdlet
* https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands
* https://github.com/mmaitre314/PowerShellGet-Test-Binary-Module
* https://www.red-gate.com/simple-talk/dotnet/net-development/using-c-to-create-powershell-cmdlets-beyond-the-basics/
* https://msdn.microsoft.com/en-us/library/dd878294(v=VS.85).aspx Writing a Windows PowerShell Cmdlet
* https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx Approved verbs
* https://www.google.com/search?q=write+a+module+for+powershell+core
129 changes: 129 additions & 0 deletions ICSharpCode.Decompiler.PowerShell/manifest.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
@{
# Script module or binary module file associated with this manifest.
RootModule = 'ICSharpCode.Decompiler.PowerShell.dll'

# Version number of this module.
ModuleVersion = '8.0.0.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '198b4312-cbe7-417e-81a7-1aaff467ef06'

# Author of this module
Author = 'ILSpy Contributors'

# Company or vendor of this module
CompanyName = 'ic#code'

# Copyright statement for this module
Copyright = 'Copyright 2011-2023 AlphaSierraPapa'

# Description of the functionality provided by this module
Description = 'PowerShell front-end for ILSpy'

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @(
'Get-DecompiledProject',
'Get-DecompiledSource',
'Get-DecompiledTypes',
'Get-Decompiler',
'Get-DecompilerVersion'
)

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()

# A URL to the license for this module.
# LicenseUri = ''

# A URL to the main website for this project.
ProjectUri = 'https://github.com/icsharpcode/ILSpy'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
13 changes: 7 additions & 6 deletions ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
Expand Down Expand Up @@ -317,7 +317,7 @@ public async Task Jmp()
public async Task StackTests()
{
// IL contains .corflags = 32BITREQUIRED
await RunIL("StackTests.il", asmOptions: AssemblerOptions.Force32Bit);
await RunIL("StackTests.il", CompilerOptions.Force32Bit, AssemblerOptions.Force32Bit);
}

[Test]
Expand Down Expand Up @@ -398,10 +398,6 @@ public async Task DynamicTests([ValueSource(nameof(noMonoOptions))] CompilerOpti
[Test]
public async Task MiniJSON([ValueSource(nameof(defaultOptions))] CompilerOptions options)
{
if (options.HasFlag(CompilerOptions.UseMcs2_6_4))
{
Assert.Ignore("Decompiler bug with mono!");
}
await RunCS(options: options);
}

Expand Down Expand Up @@ -487,6 +483,11 @@ async Task RunIL(string testFileName, CompilerOptions options = CompilerOptions.
string outputFile = null;
CompilerResults decompiledOutputFile = null;

bool optionsForce32Bit = options.HasFlag(CompilerOptions.Force32Bit);
bool asmOptionsForce32Bit = asmOptions.HasFlag(AssemblerOptions.Force32Bit);

Assert.AreEqual(optionsForce32Bit, asmOptionsForce32Bit, "Inconsistent architecture.");

try
{
options |= CompilerOptions.UseTestRunner;
Expand Down
Loading

0 comments on commit 6aeee57

Please sign in to comment.