From 0e6fbf858d69fdc9b5036d08e8d8556637fd2312 Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Wed, 18 Sep 2024 20:57:27 +1000 Subject: [PATCH] Package the SG into the runtime package The SG can be disabled by the consumer project by settings the following MSBuild property: true --- .github/workflows/dotnet-publish-ci.yml | 3 -- .github/workflows/dotnet-publish-main.yml | 3 -- .github/workflows/dotnet-publish-release.yml | 3 -- .../ExamplePythonDependency.csproj | 1 - src/CSnakes.Runtime/CSnakes.Runtime.csproj | 11 ++++--- .../net8.0/CSnakes.Runtime.targets | 19 +++++++++++ src/CSnakes.Runtime/Packaging.targets | 33 +++++++++++++++++++ .../CSnakes.SourceGeneration.csproj | 3 -- .../Packaging.targets | 24 -------------- 9 files changed, 58 insertions(+), 42 deletions(-) create mode 100644 src/CSnakes.Runtime/NuGet/buildTransitive/net8.0/CSnakes.Runtime.targets create mode 100644 src/CSnakes.Runtime/Packaging.targets delete mode 100644 src/CSnakes.SourceGeneration/Packaging.targets diff --git a/.github/workflows/dotnet-publish-ci.yml b/.github/workflows/dotnet-publish-ci.yml index 74269169..3210f42e 100644 --- a/.github/workflows/dotnet-publish-ci.yml +++ b/.github/workflows/dotnet-publish-ci.yml @@ -33,9 +33,6 @@ jobs: run: dotnet build --no-restore -c ${{ env.DOTNET_CONFIGURATION }} working-directory: src - - name: Publish NuGet package CSnakes - run: dotnet pack src/CSnakes --no-build -c ${{ env.DOTNET_CONFIGURATION }} -o ./nuget -p:VersionSuffix='alpha.${{ github.run_number }}' - - name: Publish NuGet package CSnakes.Runtime run: dotnet pack src/CSnakes.Runtime --no-build -c ${{ env.DOTNET_CONFIGURATION }} -o ./nuget -p:VersionSuffix='alpha.${{ github.run_number }}' diff --git a/.github/workflows/dotnet-publish-main.yml b/.github/workflows/dotnet-publish-main.yml index 298c8098..99ce6652 100644 --- a/.github/workflows/dotnet-publish-main.yml +++ b/.github/workflows/dotnet-publish-main.yml @@ -38,9 +38,6 @@ jobs: run: dotnet build --no-restore -c ${{ env.DOTNET_CONFIGURATION }} working-directory: src - - name: Publish NuGet package CSnakes - run: dotnet pack src/CSnakes --no-build -c ${{ env.DOTNET_CONFIGURATION }} -o ./nuget -p:VersionSuffix='beta.${{ github.run_number }}' - - name: Publish NuGet package CSnakes.Runtime run: dotnet pack src/CSnakes.Runtime --no-build -c ${{ env.DOTNET_CONFIGURATION }} -o ./nuget -p:VersionSuffix='beta.${{ github.run_number }}' diff --git a/.github/workflows/dotnet-publish-release.yml b/.github/workflows/dotnet-publish-release.yml index 76389b2a..aec8dec7 100644 --- a/.github/workflows/dotnet-publish-release.yml +++ b/.github/workflows/dotnet-publish-release.yml @@ -33,9 +33,6 @@ jobs: run: dotnet build --no-restore -c Release working-directory: src - - name: Publish NuGet package CSnakes - run: dotnet pack src/CSnakes --no-build -c Release -o ./nuget - - name: Publish NuGet package CSnakes.Runtime run: dotnet pack src/CSnakes.Runtime --no-build -c Release -o ./nuget diff --git a/samples/simple/ExamplePythonDependency/ExamplePythonDependency.csproj b/samples/simple/ExamplePythonDependency/ExamplePythonDependency.csproj index eaddc601..f7f5a889 100644 --- a/samples/simple/ExamplePythonDependency/ExamplePythonDependency.csproj +++ b/samples/simple/ExamplePythonDependency/ExamplePythonDependency.csproj @@ -30,7 +30,6 @@ - diff --git a/src/CSnakes.Runtime/CSnakes.Runtime.csproj b/src/CSnakes.Runtime/CSnakes.Runtime.csproj index 9850db1f..6560b2c3 100644 --- a/src/CSnakes.Runtime/CSnakes.Runtime.csproj +++ b/src/CSnakes.Runtime/CSnakes.Runtime.csproj @@ -1,11 +1,6 @@ - CSnakes.Runtime - CSnakes Runtime - true - $(EnableLocalPackaging) - true @@ -23,4 +18,10 @@ + + + + + + diff --git a/src/CSnakes.Runtime/NuGet/buildTransitive/net8.0/CSnakes.Runtime.targets b/src/CSnakes.Runtime/NuGet/buildTransitive/net8.0/CSnakes.Runtime.targets new file mode 100644 index 00000000..ebd0f6f2 --- /dev/null +++ b/src/CSnakes.Runtime/NuGet/buildTransitive/net8.0/CSnakes.Runtime.targets @@ -0,0 +1,19 @@ + + + + + <_CSnakes_Runtime_Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'CSnakes.Runtime'" /> + + + + + + + + + + + diff --git a/src/CSnakes.Runtime/Packaging.targets b/src/CSnakes.Runtime/Packaging.targets new file mode 100644 index 00000000..d831688c --- /dev/null +++ b/src/CSnakes.Runtime/Packaging.targets @@ -0,0 +1,33 @@ + + + CSnakes.Runtime + CSnakes Runtime + true + + + $(NoWarn);NU5128 + + true + $(EnableLocalPackaging) + + + + + + + + + + + + + + + + + + diff --git a/src/CSnakes.SourceGeneration/CSnakes.SourceGeneration.csproj b/src/CSnakes.SourceGeneration/CSnakes.SourceGeneration.csproj index 3a42def7..94180efa 100644 --- a/src/CSnakes.SourceGeneration/CSnakes.SourceGeneration.csproj +++ b/src/CSnakes.SourceGeneration/CSnakes.SourceGeneration.csproj @@ -3,7 +3,6 @@ netstandard2.0 true $(NoWarn);RS1035 - true @@ -28,6 +27,4 @@ - - diff --git a/src/CSnakes.SourceGeneration/Packaging.targets b/src/CSnakes.SourceGeneration/Packaging.targets deleted file mode 100644 index 37ce9ac9..00000000 --- a/src/CSnakes.SourceGeneration/Packaging.targets +++ /dev/null @@ -1,24 +0,0 @@ - - - CSnakes.SourceGeneration - CSnakes.SourceGeneration - - - $(NoWarn);NU5128 - - false - true - $(EnableLocalPackaging) - - - - - - - - - - - - -