Skip to content

Commit

Permalink
Merge pull request #20 from tannergooding/main
Browse files Browse the repository at this point in the history
Updating the repo to target .NET 8
  • Loading branch information
tannergooding authored Feb 3, 2024
2 parents eba1ede + 8d7d4a4 commit cc7af22
Show file tree
Hide file tree
Showing 78 changed files with 487 additions and 534 deletions.
23 changes: 22 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
spelling_error_severity = information
spelling_exclusion_path = exclusion.dic
spelling_languages = en-us
tab_width = 4
trim_trailing_whitespace = true

Expand All @@ -40,12 +43,30 @@ indent_size = 2
end_of_line = crlf
indent_style = tab

###############################################################################
# Set file behavior to:
# a UTF-16 little-endian encoding
###############################################################################
[*.dic]
charset = utf-16le

###############################################################################
# Set file header template to the specified text
###############################################################################
[*.cs]
file_header_template = Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

###############################################################################
# Set dotnet diagnostic rules to:
# ignore use integral or string argument for indexers
# ignore operator overloads have named alternates
# ignore do not use insecure randomness
###############################################################################
[*.cs]
dotnet_diagnostic.CA1043.severity = none
dotnet_diagnostic.CA2225.severity = none
dotnet_diagnostic.CA5394.severity = none

###############################################################################
# Set dotnet naming rules to:
# require async methods be pascal case suffixed with Async
Expand Down Expand Up @@ -417,7 +438,7 @@ csharp_style_implicit_object_creation_when_type_is_apparent = false:error

csharp_style_inlined_variable_declaration = true:error

csharp_style_namespace_declarations= file_scoped:error
csharp_style_namespace_declarations = file_scoped:error

csharp_style_pattern_local_over_anonymous_function = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
Expand Down
36 changes: 8 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@ jobs:
./artifacts/pkg/**/*
./artifacts/tst/**/*
if-no-files-found: error
windows-x86:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
architecture: [ x86 ]
configuration: [ debug, release ]
os: [ windows ]
steps:
- uses: actions/checkout@v3
- run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} /p:PlatformTarget=${{ matrix.architecture }}
shell: cmd
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
path: |
./artifacts/bin/**/*
./artifacts/log/**/*
./artifacts/pkg/**/*
./artifacts/tst/**/*
if-no-files-found: error
linux-x64:
runs-on: ${{ matrix.os }}-latest
strategy:
Expand Down Expand Up @@ -120,8 +100,8 @@ jobs:
path: ./artifacts
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.0-beta.23063.3
dotnet-version: '8.0.x'
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.1-beta.23530.1
- run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --timestamp-url "http://timestamp.digicert.com" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileList.txt" --publisher-name "TerraFX" --description "TerraFX.Optimizer" --description-url "https://github.com/terrafx/terrafx.optimizer" --azure-key-vault-certificate "${{ secrets.SC_KEY_VAULT_CERTIFICATE_ID }}" --azure-key-vault-client-id "${{ secrets.SC_AZURE_CLIENT_ID }}" --azure-key-vault-client-secret "${{ secrets.SC_AZURE_CLIENT_SECRET }}" --azure-key-vault-tenant-id "${{ secrets.SC_AZURE_TENANT_ID }}" --azure-key-vault-url "${{ secrets.SC_KEY_VAULT_URL }}"
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -162,8 +142,8 @@ jobs:
path: ./artifacts
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.0-beta.23063.3
dotnet-version: '8.0.x'
- run: dotnet tool install --tool-path ./artifacts/tools sign --version 0.9.1-beta.23530.1
- run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --timestamp-url "http://timestamp.digicert.com" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileList.txt" --publisher-name "TerraFX" --description "TerraFX.Optimizer" --description-url "https://github.com/terrafx/terrafx.optimizer" --azure-key-vault-certificate "${{ secrets.SC_KEY_VAULT_CERTIFICATE_ID }}" --azure-key-vault-client-id "${{ secrets.SC_AZURE_CLIENT_ID }}" --azure-key-vault-client-secret "${{ secrets.SC_AZURE_CLIENT_SECRET }}" --azure-key-vault-tenant-id "${{ secrets.SC_AZURE_TENANT_ID }}" --azure-key-vault-url "${{ secrets.SC_KEY_VAULT_URL }}"
- uses: actions/upload-artifact@v3
with:
Expand All @@ -174,29 +154,29 @@ jobs:
publish-nightlies-azure:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs: [ windows-x64, windows-x86, linux-x64, macos-x64, sign-nuget-preview ]
needs: [ windows-x64, linux-x64, macos-x64, sign-nuget-preview ]
steps:
- uses: actions/download-artifact@v3
with:
name: windows_release_x64
path: ./artifacts
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
source-url: https://pkgs.terrafx.dev/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_PAT }}
- run: dotnet nuget push "./artifacts/pkg/Release/*.nupkg" --api-key AzureDevOps --skip-duplicate
publish-nightlies-github:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs: [ windows-x64, windows-x86, linux-x64, macos-x64, sign-nuget-preview ]
needs: [ windows-x64, linux-x64, macos-x64, sign-nuget-preview ]
steps:
- uses: actions/download-artifact@v3
with:
name: windows_release_x64
path: ./artifacts
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- run: dotnet nuget push "./artifacts/pkg/Release/*.nupkg" --source https://nuget.pkg.github.com/terrafx/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
7 changes: 5 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- Default settings that explicitly differ from the Sdk.props defaults -->
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AnalysisLevel>preview</AnalysisLevel>
<AnalysisLevel>preview-all</AnalysisLevel>
<BaseIntermediateOutputPath>$(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/</BaseIntermediateOutputPath>
<DebugType>embedded</DebugType>
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
Expand All @@ -42,8 +42,11 @@
<BaseOutputPath>$(BaseArtifactsPath)bin/$(BaseArtifactsPathSuffix)/</BaseOutputPath>
<Company>TerraFX</Company>
<ContinuousIntegrationBuild Condition="'$(GITHUB_RUN_ID)' != ''">true</ContinuousIntegrationBuild>
<IsAotCompatible>true</IsAotCompatible>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>TerraFX.Optimizer</Product>
<RootNamespace>TerraFX</RootNamespace>
<VersionPrefix>0.1.0.0</VersionPrefix>
<VersionSuffix Condition="'$(EXCLUDE_SUFFIX_FROM_VERSION)' != 'true'">alpha</VersionSuffix>
<VersionSuffix Condition="'$(GITHUB_EVENT_NAME)' == 'pull_request'">pr</VersionSuffix>
Expand All @@ -58,7 +61,7 @@
<Features>strict</Features>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<HighEntropyVA>true</HighEntropyVA>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
<MinClientVersion>4.3</MinClientVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
Expand Down
7 changes: 3 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

Expand Down
11 changes: 8 additions & 3 deletions TerraFX.Optimizer.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28721.148
# Visual Studio Version 17
VisualStudioVersion = 17.9.34414.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{2F337CB6-0B9E-4765-A277-487E429DE9F1}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -11,7 +11,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{2F337CB6
build.sh = build.sh
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
exclusion.dic = exclusion.dic
global.json = global.json
LICENSE.md = LICENSE.md
NuGet.config = NuGet.config
pack.cmd = pack.cmd
pack.sh = pack.sh
restore.cmd = restore.cmd
Expand All @@ -23,8 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{2F337CB6
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{8793898A-6542-4606-AA82-AB14151D2D20}"
ProjectSection(SolutionItems) = preProject
docs\CODE_OF_CONDUCT.md = docs\CODE_OF_CONDUCT.md
docs\CODEOWNERS = docs\CODEOWNERS
docs\CODE_OF_CONDUCT.md = docs\CODE_OF_CONDUCT.md
docs\CONTRIBUTING.md = docs\CONTRIBUTING.md
docs\ISSUE_TEMPLATE.md = docs\ISSUE_TEMPLATE.md
docs\PULL_REQUEST_TEMPLATE.md = docs\PULL_REQUEST_TEMPLATE.md
Expand Down Expand Up @@ -61,6 +65,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{48E1
scripts\build.sh = scripts\build.sh
scripts\cibuild.cmd = scripts\cibuild.cmd
scripts\cibuild.sh = scripts\cibuild.sh
scripts\SignClientFileList.txt = scripts\SignClientFileList.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{BC7BAD90-CD4D-40E6-BC1B-C31599D62F13}"
Expand Down
Binary file added exclusion.dic
Binary file not shown.
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"allowPrerelease": true,
"rollForward": "latestFeature"
}
}
3 changes: 1 addition & 2 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ try {
$DotNetInstallDirectory = Join-Path -Path $ArtifactsDir -ChildPath "dotnet"
Create-Directory -Path $DotNetInstallDirectory

& $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
& $DotNetInstallScript -Channel 7.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
& $DotNetInstallScript -Channel 8.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture

$env:PATH="$DotNetInstallDirectory;$env:PATH"
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ if [[ ! -z "$architecture" ]]; then
DotNetInstallDirectory="$ArtifactsDir/dotnet"
CreateDirectory "$DotNetInstallDirectory"

. "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
. "$DotNetInstallScript" --channel 7.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
. "$DotNetInstallScript" --channel 8.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"

PATH="$DotNetInstallDirectory:$PATH:"
fi
Expand Down
5 changes: 1 addition & 4 deletions sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnablePackageValidation>false</EnablePackageValidation>
<TerraFXProjectCategory>sources</TerraFXProjectCategory>
</PropertyGroup>

Expand All @@ -21,8 +22,4 @@
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" Key="$(AssemblyOriginatorPublicKey)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions sources/Optimization/CodeAnalysis/Basic/BasicBlock.Enumerator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

using System;
using System.Collections;
using System.Collections.Generic;
using static TerraFX.Optimization.Utilities.ExceptionUtilities;

namespace TerraFX.Optimization.CodeAnalysis;

Expand All @@ -17,19 +17,19 @@ public struct Enumerator : IEnumerator<Instruction>, IEnumerator

public Enumerator(Instruction firstInstruction, Instruction? lastInstruction)
{
ThrowIfNull(firstInstruction);
ArgumentNullException.ThrowIfNull(firstInstruction);

_firstInstruction = firstInstruction;
_lastInstruction = lastInstruction;

_currentInstruction = null;
}

public Instruction Current => _currentInstruction!;
public readonly Instruction Current => _currentInstruction!;

object? IEnumerator.Current => Current;
readonly object? IEnumerator.Current => Current;

public void Dispose()
public readonly void Dispose()
{
}

Expand Down
Loading

0 comments on commit cc7af22

Please sign in to comment.