Skip to content

Commit 76875d9

Browse files
committed
WIP - Experiment with Source Generator
todo - need to make a testing plan around the generator core
1 parent 485708d commit 76875d9

File tree

13 files changed

+1003
-8
lines changed

13 files changed

+1003
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
<RootNamespace>Amazon.AwsToolkit.Telemetry.Events.SourceGenerator</RootNamespace>
7+
<AssemblyName>Amazon.AwsToolkit.Telemetry.Events.SourceGenerator</AssemblyName>
8+
<!--<Authors>Amazon Web Services</Authors>-->
9+
<!--<Product>AWS Toolkit Telemetry Events Generator</Product>-->
10+
<!--<Description>Code generator that produces Telemetry events for AWS Toolkits</Description>-->
11+
<!--<Copyright>Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.</Copyright>-->
12+
<!--<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>-->
13+
<!--<RepositoryUrl>https://github.com/aws/aws-toolkit-common</RepositoryUrl>-->
14+
<!--<PackageTags>AWS AWSToolkit</PackageTags>-->
15+
<!--<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>-->
16+
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18+
<IncludeBuildOutput>false</IncludeBuildOutput>
19+
20+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<Content Include="..\..\definitions\*.json">
25+
<Link>Definitions\%(Filename)%(Extension)</Link>
26+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
27+
</Content>
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<Content Remove="..\..\definitions\commonDefinitions.json" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<EmbeddedResource Include="..\..\definitions\commonDefinitions.json" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="CommandLineParser" Version="2.9.1" />
40+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
41+
<PrivateAssets>all</PrivateAssets>
42+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
43+
</PackageReference>
44+
45+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" PrivateAssets="all" />
46+
47+
<!-- Take a private dependency on Newtonsoft.Json (PrivateAssets=all) Consumers of this generator will not reference it.
48+
Set GeneratePathProperty=true so we can reference the binaries via the PKGNewtonsoft_Json property -->
49+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" GeneratePathProperty="true" PrivateAssets="all" />
50+
<PackageReference Include="System.CodeDom" Version="8.0.0" GeneratePathProperty="true" PrivateAssets="all" />
51+
</ItemGroup>
52+
53+
<ItemGroup>
54+
<Folder Include="Definitions\" />
55+
</ItemGroup>
56+
57+
58+
<ItemGroup>
59+
60+
<!-- https://github.com/dotnet/roslyn/discussions/47517#discussioncomment-64145 -->
61+
<!-- https://github.com/dotnet/roslyn-sdk/blob/0313c80ed950ac4f4eef11bb2e1c6d1009b328c4/samples/CSharp/SourceGenerators/SourceGeneratorSamples/SourceGeneratorSamples.csproj#L13-L30 -->
62+
<!-- https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md#use-functionality-from-nuget-packages -->
63+
<!-- https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview -->
64+
65+
66+
<!-- Package the generator in the analyzer directory of the nuget package -->
67+
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
68+
69+
<!-- Package the Newtonsoft.Json dependency alongside the generator assembly -->
70+
<!-- Seems like wildcard "*.dll" does not work -->
71+
72+
<TargetPathWithTargetPlatformMoniker Include="$(PKGNewtonsoft_Json)\lib\netstandard2.0\Newtonsoft.Json.dll" IncludeRuntimeDependency="false" />
73+
<TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_CodeDom)\lib\netstandard2.0\System.CodeDom.dll" IncludeRuntimeDependency="false" />
74+
</ItemGroup>
75+
</Project>

0 commit comments

Comments
 (0)