Skip to content

Commit

Permalink
Reference analyzers & code generator from all packages (#9294)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenBond authored Jan 23, 2025
1 parent 1bff5fc commit c6e7a4b
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 30 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
8.0.x
- name: Build
run: dotnet build
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: build_output
name: build_log_${{ matrix.os }}
retention-days: 1
path: |
**/*.binlog
Expand Down Expand Up @@ -61,9 +61,9 @@ jobs:
ORLEANSREDISCONNECTIONSTRING: "localhost:6379,ssl=False,abortConnect=False"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand All @@ -88,9 +88,9 @@ jobs:
CASSANDRAVERSION: ${{ matrix.dbversion }}
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}_${{ matrix.dbversion }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -128,9 +128,9 @@ jobs:
ORLEANSPOSTGRESCONNECTIONSTRING: "Server=127.0.0.1;Port=5432;Pooling=false;User Id=postgres;Password=postgres;SSL Mode=Disable"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -163,9 +163,9 @@ jobs:
ORLEANSMYSQLCONNECTIONSTRING: "Server=127.0.0.1;Port=3306;UId=root;Pwd=mariadb;"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -200,9 +200,9 @@ jobs:
ORLEANSMSSQLCONNECTIONSTRING: "Server=127.0.0.1,1433;User Id=SA;Password=yourWeak(!)Password;"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -239,9 +239,9 @@ jobs:
ORLEANSDATACONNECTIONSTRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -285,9 +285,9 @@ jobs:
ORLEANSCOSMOSDBACCOUNTKEY: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -321,9 +321,9 @@ jobs:
ORLEANSCONSULCONNECTIONSTRING: "http://localhost:8500"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -354,9 +354,9 @@ jobs:
ORLEANSZOOKEEPERCONNECTIONSTRING: "localhost:2181"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down Expand Up @@ -395,9 +395,9 @@ jobs:
ORLEANSDYNAMODBSECRETKEY: "pass"
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_output
name: test_output_${{ github.job }}
retention-days: 1
path: |
**/TestResults/*
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
<!-- Enable code generator -->
<ProjectReference
Include="$(SourceRoot)src/Orleans.CodeGenerator/Orleans.CodeGenerator.csproj"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer"
PrivateAssets="None"
Condition=" '$(OrleansBuildTimeCodeGen)' == 'true' "/>
<ProjectReference
Include="$(SourceRoot)src/Orleans.Analyzers/Orleans.Analyzers.csproj"
ReferenceOutputAssembly="false"
AssetTargetFallback="netstandard2.0"
UndefineProperties="TargetFramework"
SkipGetTargetFrameworkProperties="true"
OutputItemType="Analyzer"
PrivateAssets="None"
Condition=" '$(OrleansBuildTimeCodeGen)' == 'true' "/>
</ItemGroup>

Expand Down
2 changes: 2 additions & 0 deletions playground/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
1 change: 1 addition & 0 deletions src/Orleans.CodeGenerator/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Orleans.CodeGenerator.Diagnostics;
using Orleans.CodeGenerator.Hashing;
using Orleans.CodeGenerator.Model;
using Orleans.CodeGenerator.SyntaxGeneration;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Orleans.CodeGenerator.SyntaxGeneration.SymbolExtensions;
Expand Down
1 change: 1 addition & 0 deletions src/Orleans.CodeGenerator/FieldIdAssignmentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using Microsoft.CodeAnalysis;
using Orleans.CodeGenerator.Hashing;
using Orleans.CodeGenerator.Model;
using Orleans.CodeGenerator.SyntaxGeneration;

namespace Orleans.CodeGenerator;
Expand Down
19 changes: 19 additions & 0 deletions src/Orleans.CodeGenerator/Model/GenerateFieldIds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Orleans.CodeGenerator.Model;

/// <summary>
/// This enum provides options for controlling the field id generation logic.
/// </summary>
public enum GenerateFieldIds
{
/// <summary>
/// Only members explicitly annotated with a field id will be serialized. This is the default.
/// </summary>
None,
/// <summary>
/// Field ids will be automatically assigned to eligible public properties. To qualify, a property must have an accessible getter, and either an accessible setter or a corresponding constructor parameter.
/// </summary>
/// <remarks>
/// The presence of an explicit field id annotation on any member of a type will automatically disable automatic field id generation for that type.
/// </remarks>
PublicProperties
}
3 changes: 0 additions & 3 deletions src/Orleans.CodeGenerator/Orleans.CodeGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="..\Orleans.Serialization.Abstractions\GenerateFieldIds.cs">
<Link>Model\GenerateFieldIds.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Orleans.CodeGenerator/OrleansSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using Orleans.CodeGenerator.Diagnostics;
using Orleans.CodeGenerator.Model;

#pragma warning disable RS1035 // Do not use APIs banned for analyzers
namespace Orleans.CodeGenerator
Expand Down
3 changes: 1 addition & 2 deletions src/Orleans.Sdk/Orleans.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<IncludeSource>false</IncludeSource>
<IsOrleansFrameworkPart>false</IsOrleansFrameworkPart>
<NoWarn>MSB3277</NoWarn>
<OrleansBuildTimeCodeGen>true</OrleansBuildTimeCodeGen>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,7 +33,5 @@

<ItemGroup>
<ProjectReference Include="..\Orleans.Core\Orleans.Core.csproj" />
<ProjectReference Include="..\Orleans.Analyzers\Orleans.Analyzers.csproj" PrivateAssets="None" />
<ProjectReference Include="..\Orleans.CodeGenerator\Orleans.CodeGenerator.csproj" PrivateAssets="None" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/Orleans.Serialization/Orleans.Serialization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

<ItemGroup>
<ProjectReference Include="$(SourceRoot)src\Orleans.Serialization.Abstractions\Orleans.Serialization.Abstractions.csproj" />
<ProjectReference Include="$(SourceRoot)src\Orleans.Analyzers\Orleans.Analyzers.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NoWarn>$(NoWarn);FS2003;1591</NoWarn>
<ServerGarbageCollection>true</ServerGarbageCollection>
Expand Down

0 comments on commit c6e7a4b

Please sign in to comment.