diff --git a/.editorconfig b/.editorconfig index e44fedb..eababf5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,6 +21,7 @@ end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 +tab_width = 4 trim_trailing_whitespace = true ############################################################################### @@ -176,6 +177,7 @@ dotnet_sort_system_directives_first = true # require null-coalescing expressions, # require collection-initializers, # require explicit tuple names, +# suggest namespace match folder names, # require null-propogation # require object-initializers, # @@ -210,6 +212,7 @@ dotnet_sort_system_directives_first = true dotnet_style_coalesce_expression = true:error dotnet_style_collection_initializer = true:error dotnet_style_explicit_tuple_names = true:error +dotnet_style_namespace_match_folder = true:suggestion dotnet_style_null_propagation = true:error dotnet_style_object_initializer = true:error @@ -414,16 +417,17 @@ 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 csharp_style_pattern_matching_over_is_with_cast_check = true:error csharp_style_prefer_index_operator = false:error -csharp_style_prefer_range_operator = false:error +csharp_style_prefer_method_group_conversion = true:suggestion csharp_style_prefer_not_pattern = true:error csharp_style_prefer_pattern_matching = true:error +csharp_style_prefer_range_operator = false:error csharp_style_prefer_switch_expression = true:error csharp_style_throw_expression = true:error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fffc69c..c1b3719 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: ci on: push: - branches: [ main ] + branches: [ main, v* ] pull_request: - branches: [ main ] + branches: [ main, v* ] jobs: windows-x64: @@ -15,10 +15,10 @@ jobs: configuration: [ debug, release ] os: [ windows ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} shell: cmd - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -35,10 +35,10 @@ jobs: configuration: [ debug, release ] os: [ windows ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} /p:PlatformTarget=${{ matrix.architecture }} shell: cmd - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_x86 path: | @@ -55,10 +55,10 @@ jobs: configuration: [ debug, release ] os: [ ubuntu ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }} shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -75,10 +75,10 @@ jobs: configuration: [ debug, release ] os: [ macos ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }} shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -90,13 +90,13 @@ jobs: build-nuget-preview: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.cmd -configuration release -architecture x64 shell: cmd env: EXCLUDE_RUN_ID_FROM_PACKAGE: true EXCLUDE_SUFFIX_FROM_VERSION: false - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: nuget_preview path: | @@ -109,13 +109,13 @@ jobs: runs-on: windows-latest if: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./scripts/cibuild.cmd -configuration release -architecture x64 shell: cmd env: EXCLUDE_RUN_ID_FROM_PACKAGE: true EXCLUDE_SUFFIX_FROM_VERSION: true - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: nuget_release path: | @@ -133,7 +133,7 @@ jobs: with: name: windows_release_x64 path: ./artifacts - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v2 with: dotnet-version: '6.0.x' source-url: https://pkgs.terrafx.dev/index.json @@ -149,7 +149,7 @@ jobs: with: name: windows_release_x64 path: ./artifacts - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v2 with: dotnet-version: '6.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 diff --git a/Directory.Build.props b/Directory.Build.props index 746b033..298a5cc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,9 +20,11 @@ true + preview $(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/ embedded false + true enable true true @@ -43,7 +45,6 @@ $(BaseArtifactsPath)pkg/$(Configuration)/ TerraFX.Optimizer 0.1.0.0 - alpha1 alpha pr @@ -66,10 +67,7 @@ true true git - - https://api.nuget.org/v3/index.json; - https://pkgs.terrafx.dev/index.json; - + $(MSBuildThisFileDirectory)NuGet.config true diff --git a/Directory.Build.targets b/Directory.Build.targets index 7c6fae1..d246ce5 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -12,7 +12,7 @@ - $(NoWarn);NU5105 + $(NoWarn) @@ -27,17 +27,8 @@ - false - false + true + true - - - - - - - - - diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..7e66fac --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000..22963a1 --- /dev/null +++ b/NuGet.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/scripts/build.ps1 b/scripts/build.ps1 index af1aa94..ce9bc75 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -19,7 +19,7 @@ $ErrorActionPreference = "Stop" function Build() { $logFile = Join-Path -Path $LogDir -ChildPath "$configuration\build.binlog" - & dotnet build -c "$configuration" --no-restore -v "$verbosity" /bl:"$logFile" /err "$properties" "$solution" + & dotnet build -c "$configuration" --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$properties" "$solution" if ($LastExitCode -ne 0) { throw "'Build' failed for '$solution'" @@ -55,7 +55,7 @@ function Help() { function Pack() { $logFile = Join-Path -Path $LogDir -ChildPath "$configuration\pack.binlog" - & dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "$properties" "$solution" + & dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$properties" "$solution" if ($LastExitCode -ne 0) { throw "'Pack' failed for '$solution'" @@ -64,7 +64,7 @@ function Pack() { function Restore() { $logFile = Join-Path -Path $LogDir -ChildPath "$configuration\restore.binlog" - & dotnet restore -v "$verbosity" /bl:"$logFile" /err "$properties" "$solution" + & dotnet restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$properties" "$solution" if ($LastExitCode -ne 0) { throw "'Restore' failed for '$solution'" @@ -73,7 +73,7 @@ function Restore() { function Test() { $logFile = Join-Path -Path $LogDir -ChildPath "$configuration\test.binlog" - & dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "$properties" "$solution" + & dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$properties" "$solution" if ($LastExitCode -ne 0) { throw "'Test' failed for '$solution'" @@ -121,6 +121,7 @@ try { Create-Directory -Path $DotNetInstallDirectory & $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture + & $DotNetInstallScript -Channel 7.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture $env:PATH="$DotNetInstallDirectory;$env:PATH" } diff --git a/scripts/build.sh b/scripts/build.sh index 9096903..fe67f48 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -74,9 +74,9 @@ function Build { logFile="$LogDir/$configuration/build.binlog" if [[ -z "$properties" ]]; then - dotnet build -c "$configuration" --no-restore -v "$verbosity" /bl:"$logFile" /err "$solution" + dotnet build -c "$configuration" --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$solution" else - dotnet build -c "$configuration" --no-restore -v "$verbosity" /bl:"$logFile" /err "${properties[@]}" "$solution" + dotnet build -c "$configuration" --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "${properties[@]}" "$solution" fi LASTEXITCODE=$? @@ -118,9 +118,9 @@ function Pack { logFile="$LogDir/$configuration/pack.binlog" if [[ -z "$properties" ]]; then - dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "$solution" + dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$solution" else - dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "${properties[@]}" "$solution" + dotnet pack -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "${properties[@]}" "$solution" fi LASTEXITCODE=$? @@ -135,9 +135,9 @@ function Restore { logFile="$LogDir/$configuration/restore.binlog" if [[ -z "$properties" ]]; then - dotnet restore -v "$verbosity" /bl:"$logFile" /err "$solution" + dotnet restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$solution" else - dotnet restore -v "$verbosity" /bl:"$logFile" /err "${properties[@]}" "$solution" + dotnet restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "${properties[@]}" "$solution" fi LASTEXITCODE=$? @@ -152,9 +152,9 @@ function Test { logFile="$LogDir/$configuration/test.binlog" if [[ -z "$properties" ]]; then - dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "$solution" + dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "$solution" else - dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /bl:"$logFile" /err "${properties[@]}" "$solution" + dotnet test -c "$configuration" --no-build --no-restore -v "$verbosity" /p:Platform="Any CPU" /bl:"$logFile" /err "${properties[@]}" "$solution" fi LASTEXITCODE=$? @@ -205,6 +205,7 @@ if [[ ! -z "$architecture" ]]; then CreateDirectory "$DotNetInstallDirectory" . "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" + . "$DotNetInstallScript" --channel 7.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" PATH="$DotNetInstallDirectory:$PATH:" fi diff --git a/sources/Directory.Build.props b/sources/Directory.Build.props index de51bb1..9ff0fdc 100644 --- a/sources/Directory.Build.props +++ b/sources/Directory.Build.props @@ -22,7 +22,7 @@ - + diff --git a/sources/Optimization/TerraFX.Optimization.csproj b/sources/Optimization/TerraFX.Optimization.csproj index bd61b3e..df9b32a 100644 --- a/sources/Optimization/TerraFX.Optimization.csproj +++ b/sources/Optimization/TerraFX.Optimization.csproj @@ -3,8 +3,8 @@ - 1591;$(NoWarn) - net6.0 + $(NoWarn);CS1591 + net6.0;net7.0 diff --git a/sources/Optimizer/TerraFX.Optimizer.csproj b/sources/Optimizer/TerraFX.Optimizer.csproj index f95229e..c21cec2 100644 --- a/sources/Optimizer/TerraFX.Optimizer.csproj +++ b/sources/Optimizer/TerraFX.Optimizer.csproj @@ -3,10 +3,9 @@ - 1591;$(NoWarn) + $(NoWarn);CS1591 Exe - TerraFX.Optimization - net6.0 + net6.0;net7.0 diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 015e663..0252c4a 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -22,9 +22,9 @@ - - - + + + diff --git a/tests/Optimization/TerraFX.Optimization.UnitTests.csproj b/tests/Optimization/TerraFX.Optimization.UnitTests.csproj index cbf9d8a..537b84f 100644 --- a/tests/Optimization/TerraFX.Optimization.UnitTests.csproj +++ b/tests/Optimization/TerraFX.Optimization.UnitTests.csproj @@ -3,7 +3,7 @@ - net6.0 + net6.0;net7.0