diff --git a/.editorconfig b/.editorconfig index dc1837f..b7b25f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -54,7 +54,7 @@ dotnet_style_predefined_type_for_member_access = true:suggestion # name all constant fields using PascalCase dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style dotnet_naming_symbols.constant_fields.applicable_kinds = field dotnet_naming_symbols.constant_fields.required_modifiers = const dotnet_naming_style.pascal_case_style.capitalization = pascal_case @@ -62,7 +62,7 @@ dotnet_naming_style.pascal_case_style.capitalization = pascal_case # static fields should have s_ prefix dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields -dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style dotnet_naming_symbols.static_fields.applicable_kinds = field dotnet_naming_symbols.static_fields.required_modifiers = static dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected @@ -72,7 +72,7 @@ dotnet_naming_style.static_prefix_style.capitalization = camel_case # internal and private fields should be _camelCase dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style dotnet_naming_symbols.private_internal_fields.applicable_kinds = field dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal dotnet_naming_style.camel_case_underscore_style.required_prefix = _ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-obfuscator-cli.yml similarity index 50% rename from .github/workflows/ci.yml rename to .github/workflows/ci-obfuscator-cli.yml index 4c3484d..b295a3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-obfuscator-cli.yml @@ -1,7 +1,11 @@ -name: ci +name: ci-obfuscator-cli on: pull_request: - types: [opened, synchronize, reopened, ready_for_review] + types: [ opened, synchronize, reopened, ready_for_review ] + branches: [ main ] + paths: [ 'src/Dax.Vpax.Obfuscator.CLI/**' ] +env: + SOLUTION: Dax.Vpax.Obfuscator.CLI.slnf jobs: build-and-test: runs-on: windows-latest @@ -17,8 +21,8 @@ jobs: 6.0.x global-json-file: global.json - name: restore - run: dotnet restore Dax.Vpax.Obfuscator.CI.slnf + run: dotnet restore ${{ env.SOLUTION }} - name: dotnet build - run: dotnet build Dax.Vpax.Obfuscator.CI.slnf --configuration Release --no-restore + run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore - name: dotnet test - run: dotnet test Dax.Vpax.Obfuscator.CI.slnf --configuration Release --no-build + run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build diff --git a/.github/workflows/ci-obfuscator-common.yml b/.github/workflows/ci-obfuscator-common.yml new file mode 100644 index 0000000..ec336a0 --- /dev/null +++ b/.github/workflows/ci-obfuscator-common.yml @@ -0,0 +1,26 @@ +name: ci-obfuscator-common +on: + pull_request: + types: [ opened, synchronize, reopened, ready_for_review ] + branches: [ main ] + paths: [ 'src/Dax.Vpax.Obfuscator.Common/**' ] +env: + SOLUTION: Dax.Vpax.Obfuscator.Common.slnf +jobs: + build-and-test: + runs-on: windows-latest + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: setup dotnet + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + - name: restore + run: dotnet restore ${{ env.SOLUTION }} + - name: dotnet build + run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore + - name: dotnet test + run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build diff --git a/.github/workflows/ci-obfuscator.yml b/.github/workflows/ci-obfuscator.yml new file mode 100644 index 0000000..1d8cbea --- /dev/null +++ b/.github/workflows/ci-obfuscator.yml @@ -0,0 +1,28 @@ +name: ci-obfuscator +on: + pull_request: + types: [ opened, synchronize, reopened, ready_for_review ] + branches: [ main ] + paths: [ 'src/Dax.Vpax.Obfuscator/**', 'src/Dax.Tokenizer/**' ] +env: + SOLUTION: Dax.Vpax.Obfuscator.slnf +jobs: + build-and-test: + runs-on: windows-latest + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + global-json-file: global.json + - name: restore + run: dotnet restore ${{ env.SOLUTION }} + - name: dotnet build + run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore + - name: dotnet test + run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build diff --git a/.github/workflows/release-obfuscator-cli.yml b/.github/workflows/release-obfuscator-cli.yml index 4669ed7..7a2989c 100644 --- a/.github/workflows/release-obfuscator-cli.yml +++ b/.github/workflows/release-obfuscator-cli.yml @@ -2,9 +2,12 @@ name: release-obfuscator-cli on: workflow_dispatch: env: - PROJECT: Dax.Vpax.Obfuscator.CLI + PROJECT_NAME: Dax.Vpax.Obfuscator.CLI + PROJECT_PATH: src/Dax.Vpax.Obfuscator.CLI + PROJECT_FILE: Dax.Vpax.Obfuscator.CLI.csproj jobs: - publish-release: + publish: + #if: github.ref == 'refs/heads/main' runs-on: windows-latest # windows is required for code signing (AzureSignTool) permissions: contents: write @@ -21,9 +24,9 @@ jobs: uses: dotnet/nbgv@v0.4 id: nbgv with: - path: src/${{ env.PROJECT }} + path: ${{ env.PROJECT_PATH }} - name: dotnet publish - run: dotnet publish 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj' -o . -c Release -r win-x86 --sc -p:PublishSingleFile=true + run: dotnet publish -c Release -o . -r win-x86 --sc -p:PublishSingleFile=true '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}' - name: dotnet tool install AzureSignTool run: dotnet tool install --no-cache --global AzureSignTool - name: code signing @@ -32,8 +35,8 @@ jobs: - name: gh release create shell: bash run: | + RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.SemVer2 }} PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "") - gh release create ${{ env.RELEASE_TAG }} 'vpax-obfuscator.exe#Obfuscator CLI x86 net6.0' --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG + gh release create $RELEASE_TAG 'vpax-obfuscator.exe#Obfuscator CLI x86 net6.0' --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG env: - RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.SemVer2 }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-obfuscator-common.yml b/.github/workflows/release-obfuscator-common.yml index 9567293..697ad83 100644 --- a/.github/workflows/release-obfuscator-common.yml +++ b/.github/workflows/release-obfuscator-common.yml @@ -2,9 +2,12 @@ name: release-obfuscator-common on: workflow_dispatch: env: - PROJECT: Dax.Vpax.Obfuscator.Common + PROJECT_NAME: Dax.Vpax.Obfuscator.Common + PROJECT_PATH: src/Dax.Vpax.Obfuscator.Common + PROJECT_FILE: Dax.Vpax.Obfuscator.Common.csproj jobs: - publish-release: + publish: + #if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: write @@ -21,17 +24,15 @@ jobs: uses: dotnet/nbgv@v0.4 id: nbgv with: - path: src/${{ env.PROJECT }} + path: ${{ env.PROJECT_PATH }} - name: dotnet pack - run: dotnet pack -c Release 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj' + run: dotnet pack -c Release -o . '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}' - name: nuget push - run: dotnet nuget push '${{ env.NUPKG_PATH }}' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json - env: - NUPKG_PATH: 'src/artifacts/package/release/${{ env.PROJECT }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' + run: dotnet nuget push '${{ env.PROJECT_NAME }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json - name: create release run: | + RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.NuGetPackageVersion }} PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "") - gh release create ${{ env.RELEASE_TAG }} --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG + gh release create $RELEASE_TAG --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG env: - RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.NuGetPackageVersion }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-obfuscator.yml b/.github/workflows/release-obfuscator.yml index d943252..6ab725d 100644 --- a/.github/workflows/release-obfuscator.yml +++ b/.github/workflows/release-obfuscator.yml @@ -2,9 +2,12 @@ name: release-obfuscator on: workflow_dispatch: env: - PROJECT: Dax.Vpax.Obfuscator + PROJECT_NAME: Dax.Vpax.Obfuscator + PROJECT_PATH: src/Dax.Vpax.Obfuscator + PROJECT_FILE: Dax.Vpax.Obfuscator.csproj jobs: - publish-release: + publish: + #if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: write @@ -21,17 +24,15 @@ jobs: uses: dotnet/nbgv@v0.4 id: nbgv with: - path: src/${{ env.PROJECT }} + path: ${{ env.PROJECT_PATH }} - name: dotnet pack - run: dotnet pack -c Release 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj' + run: dotnet pack -c Release -o . '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}' - name: nuget push - run: dotnet nuget push '${{ env.NUPKG_PATH }}' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json - env: - NUPKG_PATH: 'src/artifacts/package/release/${{ env.PROJECT }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' + run: dotnet nuget push '${{ env.PROJECT_NAME }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json - name: create release run: | + RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.NuGetPackageVersion }} PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "") - gh release create ${{ env.RELEASE_TAG }} --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG + gh release create $RELEASE_TAG --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG env: - RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.NuGetPackageVersion }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dax.Vpax.Obfuscator.CI.slnf b/Dax.Vpax.Obfuscator.CI.slnf deleted file mode 100644 index 2b722b6..0000000 --- a/Dax.Vpax.Obfuscator.CI.slnf +++ /dev/null @@ -1,13 +0,0 @@ -{ - "solution": { - "path": "Dax.Vpax.Obfuscator.sln", - "projects": [ - "src\\Dax.Vpax.Obfuscator.CLI\\Dax.Vpax.Obfuscator.CLI.csproj", - "src\\Dax.Vpax.Obfuscator.Common\\Dax.Vpax.Obfuscator.Common.csproj", - "src\\Dax.Vpax.Obfuscator\\Dax.Vpax.Obfuscator.csproj", - "src\\Dax.Tokenizer\\Dax.Tokenizer.csproj", - "tests\\Dax.Vpax.Obfuscator.Common.Tests\\Dax.Vpax.Obfuscator.Common.Tests.csproj", - "tests\\Dax.Vpax.Obfuscator.Tests\\Dax.Vpax.Obfuscator.Tests.csproj" - ] - } -} \ No newline at end of file diff --git a/Dax.Vpax.Obfuscator.CLI.slnf b/Dax.Vpax.Obfuscator.CLI.slnf new file mode 100644 index 0000000..b9c6de6 --- /dev/null +++ b/Dax.Vpax.Obfuscator.CLI.slnf @@ -0,0 +1,8 @@ +{ + "solution": { + "path": "Vpax-Obfuscator.sln", + "projects": [ + "src\\Dax.Vpax.Obfuscator.CLI\\Dax.Vpax.Obfuscator.CLI.csproj" + ] + } +} \ No newline at end of file diff --git a/Dax.Vpax.Obfuscator.Common.slnf b/Dax.Vpax.Obfuscator.Common.slnf new file mode 100644 index 0000000..8d687d2 --- /dev/null +++ b/Dax.Vpax.Obfuscator.Common.slnf @@ -0,0 +1,9 @@ +{ + "solution": { + "path": "Vpax-Obfuscator.sln", + "projects": [ + "src\\Dax.Vpax.Obfuscator.Common\\Dax.Vpax.Obfuscator.Common.csproj", + "tests\\Dax.Vpax.Obfuscator.Common.Tests\\Dax.Vpax.Obfuscator.Common.Tests.csproj" + ] + } +} \ No newline at end of file diff --git a/Dax.Vpax.Obfuscator.slnf b/Dax.Vpax.Obfuscator.slnf new file mode 100644 index 0000000..4ef853a --- /dev/null +++ b/Dax.Vpax.Obfuscator.slnf @@ -0,0 +1,10 @@ +{ + "solution": { + "path": "Vpax-Obfuscator.sln", + "projects": [ + "src\\Dax.Tokenizer\\Dax.Tokenizer.csproj", + "src\\Dax.Vpax.Obfuscator\\Dax.Vpax.Obfuscator.csproj", + "tests\\Dax.Vpax.Obfuscator.Tests\\Dax.Vpax.Obfuscator.Tests.csproj" + ] + } +} \ No newline at end of file diff --git a/Dax.Vpax.Obfuscator.sln b/Vpax-Obfuscator.sln similarity index 86% rename from Dax.Vpax.Obfuscator.sln rename to Vpax-Obfuscator.sln index 9fe69b8..2c093bb 100644 --- a/Dax.Vpax.Obfuscator.sln +++ b/Vpax-Obfuscator.sln @@ -15,9 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator", "src\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator.Tests", "tests\Dax.Vpax.Obfuscator.Tests\Dax.Vpax.Obfuscator.Tests.csproj", "{4D99AE7D-8A59-41A2-A8C3-8054E57C1182}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator.TestApp", "src\Dax.Vpax.Obfuscator.TestApp\Dax.Vpax.Obfuscator.TestApp.csproj", "{F20265D8-1301-4698-9D3A-A371F75CF87D}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{3302F148-E215-4823-8929-45C8A12C7E7E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{3302F148-E215-4823-8929-45C8A12C7E7E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "tools\TestApp\TestApp.csproj", "{D1B5488A-B89A-41D5-964F-D2F38B00376A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -49,16 +49,16 @@ Global {4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Debug|Any CPU.Build.0 = Debug|Any CPU {4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Release|Any CPU.Build.0 = Release|Any CPU - {F20265D8-1301-4698-9D3A-A371F75CF87D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F20265D8-1301-4698-9D3A-A371F75CF87D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F20265D8-1301-4698-9D3A-A371F75CF87D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F20265D8-1301-4698-9D3A-A371F75CF87D}.Release|Any CPU.Build.0 = Release|Any CPU + {D1B5488A-B89A-41D5-964F-D2F38B00376A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1B5488A-B89A-41D5-964F-D2F38B00376A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1B5488A-B89A-41D5-964F-D2F38B00376A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1B5488A-B89A-41D5-964F-D2F38B00376A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {F20265D8-1301-4698-9D3A-A371F75CF87D} = {3302F148-E215-4823-8929-45C8A12C7E7E} + {D1B5488A-B89A-41D5-964F-D2F38B00376A} = {3302F148-E215-4823-8929-45C8A12C7E7E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BF417AA2-7521-408B-A3F5-A20CC760AE6E} diff --git a/nuget.config b/nuget.config index d8f90e2..6fe0770 100644 --- a/nuget.config +++ b/nuget.config @@ -4,4 +4,9 @@ - \ No newline at end of file + + + + + + diff --git a/scripts/prepare-release.cmd b/scripts/prepare-release.cmd new file mode 100644 index 0000000..8d89ffe --- /dev/null +++ b/scripts/prepare-release.cmd @@ -0,0 +1,9 @@ +@echo off + +rem Script to prepare a new release using the dotnet tool nbgv. +rem Ensure nbgv is installed before running this script. Install it using `dotnet tool install -g nbgv` + +echo Running nbgv prepare-release... +nbgv prepare-release --format json --commit-message-pattern "chore(release): bump version to {0}" || exit /b 1 + +echo Release preparation is complete. IMPORTANT: Don't forget to push the newly created release branch. diff --git a/src/Dax.Tokenizer/Dax.Tokenizer.csproj b/src/Dax.Tokenizer/Dax.Tokenizer.csproj index c8cc6f2..4ae85c7 100644 --- a/src/Dax.Tokenizer/Dax.Tokenizer.csproj +++ b/src/Dax.Tokenizer/Dax.Tokenizer.csproj @@ -3,6 +3,7 @@ netstandard2.0 false + $(NoWarn);CA1852 @@ -10,7 +11,7 @@ - + diff --git a/src/Dax.Tokenizer/GlobalSuppressions.cs b/src/Dax.Tokenizer/GlobalSuppressions.cs new file mode 100644 index 0000000..c9c8cb1 --- /dev/null +++ b/src/Dax.Tokenizer/GlobalSuppressions.cs @@ -0,0 +1,9 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "", Scope = "type", Target = "~T:Dax.Tokenizer.DaxCharStream")] +[assembly: SuppressMessage("Naming", "CA1708:Identifiers should differ by more than case", Justification = "", Scope = "type", Target = "~T:Dax.Tokenizer.DaxToken")] diff --git a/src/Dax.Tokenizer/version.json b/src/Dax.Tokenizer/version.json index 93ab8e9..1d83ad0 100644 --- a/src/Dax.Tokenizer/version.json +++ b/src/Dax.Tokenizer/version.json @@ -1,11 +1,11 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", "version": "1.0", "nugetPackageVersion": { - "semVer": 2.0 + "semVer": 2 }, "publicReleaseRefSpec": [ - "^refs/heads/main" + "^refs/heads/main$" ], "pathFilters": [ "./" diff --git a/src/Dax.Vpax.Obfuscator.CLI/Dax.Vpax.Obfuscator.CLI.csproj b/src/Dax.Vpax.Obfuscator.CLI/Dax.Vpax.Obfuscator.CLI.csproj index 7638f86..b3d76ab 100644 --- a/src/Dax.Vpax.Obfuscator.CLI/Dax.Vpax.Obfuscator.CLI.csproj +++ b/src/Dax.Vpax.Obfuscator.CLI/Dax.Vpax.Obfuscator.CLI.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/src/Dax.Vpax.Obfuscator.CLI/Program.cs b/src/Dax.Vpax.Obfuscator.CLI/Program.cs index 90b56b5..23294ef 100644 --- a/src/Dax.Vpax.Obfuscator.CLI/Program.cs +++ b/src/Dax.Vpax.Obfuscator.CLI/Program.cs @@ -3,7 +3,7 @@ namespace Dax.Vpax.Obfuscator.CLI; -internal class Program +internal sealed class Program { public static int Main(string[] args) => BuildCommand().Invoke(args); diff --git a/src/Dax.Vpax.Obfuscator.CLI/version.json b/src/Dax.Vpax.Obfuscator.CLI/version.json index 93ab8e9..6eda29b 100644 --- a/src/Dax.Vpax.Obfuscator.CLI/version.json +++ b/src/Dax.Vpax.Obfuscator.CLI/version.json @@ -1,12 +1,17 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", "version": "1.0", "nugetPackageVersion": { - "semVer": 2.0 + "semVer": 2 }, "publicReleaseRefSpec": [ - "^refs/heads/main" + "^refs/heads/main$", + "^refs/heads/release/Dax.Vpax.Obfuscator.CLI_\\d+\\.\\d+$" ], + "release": { + "branchName": "release/Dax.Vpax.Obfuscator.CLI_{version}", + "firstUnstableTag": "" + }, "pathFilters": [ "./" ] diff --git a/src/Dax.Vpax.Obfuscator.Common/Dax.Vpax.Obfuscator.Common.csproj b/src/Dax.Vpax.Obfuscator.Common/Dax.Vpax.Obfuscator.Common.csproj index 24a67d0..908998c 100644 --- a/src/Dax.Vpax.Obfuscator.Common/Dax.Vpax.Obfuscator.Common.csproj +++ b/src/Dax.Vpax.Obfuscator.Common/Dax.Vpax.Obfuscator.Common.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Dax.Vpax.Obfuscator.Common/GlobalSuppressions.cs b/src/Dax.Vpax.Obfuscator.Common/GlobalSuppressions.cs index c0371e2..71d4a5b 100644 --- a/src/Dax.Vpax.Obfuscator.Common/GlobalSuppressions.cs +++ b/src/Dax.Vpax.Obfuscator.Common/GlobalSuppressions.cs @@ -7,5 +7,8 @@ [assembly: SuppressMessage("Style", "IDE0300:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.#ctor(System.Boolean,System.String)")] [assembly: SuppressMessage("Style", "IDE0300:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.#ctor(System.String)")] -[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.Common.ObfuscationDictionary.#ctor(System.String,System.String,System.Collections.Generic.IEnumerable{Dax.Vpax.Obfuscator.Common.ObfuscationText})")] -[assembly: SuppressMessage("Style", "IDE0305:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.Common.ObfuscationDictionary.#ctor(System.String,System.String,System.Collections.Generic.IEnumerable{Dax.Vpax.Obfuscator.Common.ObfuscationText})")] +[assembly: SuppressMessage("Design", "CA1019:Define accessors for attribute arguments", Justification = "", Scope = "member", Target = "~M:System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.#ctor(System.Boolean,System.String)")] +[assembly: SuppressMessage("Design", "CA1019:Define accessors for attribute arguments", Justification = "", Scope = "member", Target = "~M:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.#ctor(System.String)")] +[assembly: SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "", Scope = "type", Target = "~T:Dax.Vpax.Obfuscator.Common.ObfuscationDictionary")] +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", Justification = "", Scope = "namespace", Target = "~N:System.Diagnostics.CodeAnalysis")] +[assembly: SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.Common.ObfuscationDictionary.WriteTo(System.IO.Stream,System.Boolean,System.Boolean)")] diff --git a/src/Dax.Vpax.Obfuscator.Common/version.json b/src/Dax.Vpax.Obfuscator.Common/version.json index 93ab8e9..7879c05 100644 --- a/src/Dax.Vpax.Obfuscator.Common/version.json +++ b/src/Dax.Vpax.Obfuscator.Common/version.json @@ -1,12 +1,17 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", "version": "1.0", "nugetPackageVersion": { - "semVer": 2.0 + "semVer": 2 }, "publicReleaseRefSpec": [ - "^refs/heads/main" + "^refs/heads/main$", + "^refs/heads/release/Dax.Vpax.Obfuscator.Common_\\d+\\.\\d+$" ], + "release": { + "branchName": "release/Dax.Vpax.Obfuscator.Common_{version}", + "firstUnstableTag": "" + }, "pathFilters": [ "./" ] diff --git a/src/Dax.Vpax.Obfuscator/Dax.Vpax.Obfuscator.csproj b/src/Dax.Vpax.Obfuscator/Dax.Vpax.Obfuscator.csproj index d3328e1..b420d5c 100644 --- a/src/Dax.Vpax.Obfuscator/Dax.Vpax.Obfuscator.csproj +++ b/src/Dax.Vpax.Obfuscator/Dax.Vpax.Obfuscator.csproj @@ -3,6 +3,7 @@ net472;net6.0;net8.0 true + $(NoWarn);CA1510;CA1865;CA1866;CA1867 @@ -18,11 +19,11 @@ vpax dax vertipaq analyzer git https://github.com/sql-bi/Vpax-Obfuscator.git - main README.md embedded true true + $(TargetsForTfmSpecificBuildOutput);IncludeProjectReferenceDlls @@ -30,32 +31,23 @@ - - - + + + - - - <_PackageFiles Include="$(OutputPath.TrimEnd('\').TrimEnd('/'))_net472\Dax.Tokenizer.dll"> - None - lib\net472\ - - - <_PackageFiles Include="$(OutputPath.TrimEnd('\').TrimEnd('/'))_net6.0\Dax.Tokenizer.dll"> - None - lib\net6.0\ - - - <_PackageFiles Include="$(OutputPath.TrimEnd('\').TrimEnd('/'))_net8.0\Dax.Tokenizer.dll"> - None - lib\net8.0\ - + + + + + + + diff --git a/src/Dax.Vpax.Obfuscator/DaxText.cs b/src/Dax.Vpax.Obfuscator/DaxText.cs index ff7a737..2890430 100644 --- a/src/Dax.Vpax.Obfuscator/DaxText.cs +++ b/src/Dax.Vpax.Obfuscator/DaxText.cs @@ -21,7 +21,7 @@ public DaxText(string value, string obfuscatedValue) public DaxText(string value) { if (value == null) throw new ArgumentNullException(nameof(value)); - if (value == string.Empty) throw new ArgumentException("Value cannot be empty.", nameof(value)); + if (value.Length == 0) throw new ArgumentException("Value cannot be empty.", nameof(value)); Value = value; } @@ -37,7 +37,7 @@ public string ObfuscatedValue set { if (value == null) throw new ArgumentNullException(nameof(value)); - if (value == string.Empty) throw new ArgumentException("Value cannot be empty.", nameof(value)); + if (value.Length == 0) throw new ArgumentException("Value cannot be empty.", nameof(value)); if (value.Length < Value.Length) throw new InvalidOperationException($"{nameof(ObfuscatedValue)} cannot be shorter than the {nameof(Value)}."); _obfuscatedValue = value; diff --git a/src/Dax.Vpax.Obfuscator/GlobalSuppressions.cs b/src/Dax.Vpax.Obfuscator/GlobalSuppressions.cs index 8b2dee9..660530c 100644 --- a/src/Dax.Vpax.Obfuscator/GlobalSuppressions.cs +++ b/src/Dax.Vpax.Obfuscator/GlobalSuppressions.cs @@ -10,7 +10,7 @@ [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.Extensions.StringExtensions.EscapeDax(System.String,System.Int32)~System.String")] [assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "", Scope = "member", Target = "~F:Dax.Vpax.Obfuscator.Constants.ReservedChars")] [assembly: SuppressMessage("Performance", "CA1846:Prefer 'AsSpan' over 'Substring'", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.Extensions.StringExtensions.IsDaxReservedName(System.String)~System.Boolean")] -[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.ObfuscationRuleExtensions.ShouldPreserve(Dax.Vpax.Obfuscator.ObfuscatorRule,System.String)~System.Boolean")] -[assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.DaxModelObfuscator.#ctor(Dax.Metadata.Model,Dax.Vpax.Obfuscator.Common.ObfuscationDictionary)")] [assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "", Scope = "member", Target = "~P:Dax.Vpax.Obfuscator.DaxModelObfuscator.UnobfuscatedValues")] [assembly: SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "", Scope = "member", Target = "~P:Dax.Vpax.Obfuscator.DaxModelObfuscator.Texts")] +[assembly: SuppressMessage("Security", "CA5394:Do not use insecure randomness", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.DaxTextObfuscator.Obfuscate(Dax.Vpax.Obfuscator.DaxText,System.Int32)~Dax.Vpax.Obfuscator.DaxText")] +[assembly: SuppressMessage("Security", "CA5394:Do not use insecure randomness", Justification = "", Scope = "member", Target = "~M:Dax.Vpax.Obfuscator.DaxTextObfuscator.#ctor")] diff --git a/src/Dax.Vpax.Obfuscator/version.json b/src/Dax.Vpax.Obfuscator/version.json index ea20df7..fecf17a 100644 --- a/src/Dax.Vpax.Obfuscator/version.json +++ b/src/Dax.Vpax.Obfuscator/version.json @@ -1,15 +1,19 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", "version": "1.1", "nugetPackageVersion": { - "semVer": 2.0 + "semVer": 2 }, "publicReleaseRefSpec": [ - "^refs/heads/main" + "^refs/heads/main$", + "^refs/heads/release/Dax.Vpax.Obfuscator_\\d+\\.\\d+$" ], + "release": { + "branchName": "release/Dax.Vpax.Obfuscator_{version}", + "firstUnstableTag": "" + }, "pathFilters": [ - "./", - ":/src/Dax.Tokenizer", - ":/src/Dax.Vpax.Obfuscator.Common" + "./", + "/src/Dax.Tokenizer" ] } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 78003ec..ec9db28 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,6 +3,8 @@ enable 12.0 + all + latest enable $(MSBuildThisFileDirectory)artifacts true @@ -13,9 +15,5 @@ - - - - diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props new file mode 100644 index 0000000..0b750d2 --- /dev/null +++ b/src/Directory.Packages.props @@ -0,0 +1,16 @@ + + + true + + + + + + + + + + + + + diff --git a/src/Dax.Vpax.Obfuscator.TestApp/Form1.Designer.cs b/tools/TestApp/Form1.Designer.cs similarity index 99% rename from src/Dax.Vpax.Obfuscator.TestApp/Form1.Designer.cs rename to tools/TestApp/Form1.Designer.cs index 8845a10..f8ca2f0 100644 --- a/src/Dax.Vpax.Obfuscator.TestApp/Form1.Designer.cs +++ b/tools/TestApp/Form1.Designer.cs @@ -1,4 +1,4 @@ -namespace Dax.Vpax.Obfuscator.TestApp +namespace TestApp { partial class Form1 { diff --git a/src/Dax.Vpax.Obfuscator.TestApp/Form1.cs b/tools/TestApp/Form1.cs similarity index 99% rename from src/Dax.Vpax.Obfuscator.TestApp/Form1.cs rename to tools/TestApp/Form1.cs index 5f200f4..5f695ac 100644 --- a/src/Dax.Vpax.Obfuscator.TestApp/Form1.cs +++ b/tools/TestApp/Form1.cs @@ -1,7 +1,8 @@ using System.Reflection; +using Dax.Vpax.Obfuscator; using Dax.Vpax.Obfuscator.Common; -namespace Dax.Vpax.Obfuscator.TestApp +namespace TestApp { public partial class Form1 : Form { diff --git a/src/Dax.Vpax.Obfuscator.TestApp/Form1.resx b/tools/TestApp/Form1.resx similarity index 100% rename from src/Dax.Vpax.Obfuscator.TestApp/Form1.resx rename to tools/TestApp/Form1.resx diff --git a/src/Dax.Vpax.Obfuscator.TestApp/Program.cs b/tools/TestApp/Program.cs similarity index 92% rename from src/Dax.Vpax.Obfuscator.TestApp/Program.cs rename to tools/TestApp/Program.cs index d32c2ac..745dfe4 100644 --- a/src/Dax.Vpax.Obfuscator.TestApp/Program.cs +++ b/tools/TestApp/Program.cs @@ -1,4 +1,4 @@ -namespace Dax.Vpax.Obfuscator.TestApp +namespace TestApp { internal static class Program { diff --git a/src/Dax.Vpax.Obfuscator.TestApp/Dax.Vpax.Obfuscator.TestApp.csproj b/tools/TestApp/TestApp.csproj similarity index 59% rename from src/Dax.Vpax.Obfuscator.TestApp/Dax.Vpax.Obfuscator.TestApp.csproj rename to tools/TestApp/TestApp.csproj index 54bfb7e..407c53b 100644 --- a/src/Dax.Vpax.Obfuscator.TestApp/Dax.Vpax.Obfuscator.TestApp.csproj +++ b/tools/TestApp/TestApp.csproj @@ -4,10 +4,12 @@ WinExe net8.0-windows true + enable + enable - +