From e981bea8ca2bc5585ca2c578e291779dd471c53b Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Thu, 30 Dec 2021 22:55:37 -0300 Subject: [PATCH] Adding Source Generator (#1714) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added Source Generator project * Configure Source Generator project * Make sure that we will use it just in NETSTANDARD1_0 * removed old build and csproj clean up * fixed sample app * added SG dll into Libs folder * Added SourceGenerator project in all solutions * Reference the SG dll Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Javier Suárez --- ...marin.CommunityToolkit.SourceGenerator.dll | Bin 0 -> 11264 bytes Xamarin.CommunityToolkit.All.sln | 10 ++++- samples/XCT.Sample.sln | 30 ++++++++++++++- .../Xamarin.CommunityToolkit.Sample.csproj | 5 ++- .../Helpers/XCT.android.cs | 2 +- .../Helpers/XCT.ios.cs | 2 +- .../Helpers/XCT.shared.cs | 16 ++++++++ .../Xamarin.CommunityToolkit.csproj | 3 +- .../build/PreserveXamarinCommunityToolkit.cs | 5 --- .../build/Xamarin.CommunityToolkit.targets | 7 ---- .../XCTGenerator.cs | 36 ++++++++++++++++++ ...in.CommunityToolkit.SourceGenerator.csproj | 14 +++++++ 12 files changed, 109 insertions(+), 21 deletions(-) create mode 100644 Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll create mode 100644 src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.shared.cs delete mode 100644 src/CommunityToolkit/Xamarin.CommunityToolkit/build/PreserveXamarinCommunityToolkit.cs delete mode 100644 src/CommunityToolkit/Xamarin.CommunityToolkit/build/Xamarin.CommunityToolkit.targets create mode 100644 src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/XCTGenerator.cs create mode 100644 src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.csproj diff --git a/Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll b/Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll new file mode 100644 index 0000000000000000000000000000000000000000..4f357c4577a9012a741039bc4ae9e96987136a11 GIT binary patch literal 11264 zcmeG?c|4TS+Goa+rLrptV=Iy|vJ{eCC`-16vWzj9j2ULeo~=}ttWhGVs7Thd3PovA zNF`K=qD7XnrQ$p9pt|3^_xs)N`|kaH-yipk^SsaYKIeI!bLO0PJg=p5DqsTuu){t# z2f#IWMVdYf{?{NHikC~>SPrVVA4^|DZGS9n??Yx_{OL4rI>8S^Bv7d|CdPw=p$Aei zWGcqk+79DK^CV%HE#r|}Fl}Q3z;+ZHD4hFpZgI3;AcNsW;Q)|<9Ikn;mjS$DV0VWd z0DcyZp7$GJApW!3DF`7SX>7p#0HTWg{k|@c2n#kLXxAD++yN;6Wdva?v}gd9LUjFl z0Q?tu|Hu{d%XOAE7o^SpxDU%Dg)kvak%j=uSg|hn4JlT`K(DZL2Av2gmT&G5;e>rL zc@RaKKK#SdNfa7XM0^F&up_qC!Tv|n2f*+Tl7()C@goiK4GlOzAqIe0UI0)C^MBAJ z(F%M3@T_y4zoJ(pi9%!YqHHH3ph@<1+6#QPc`}F(MTdNUx-@ zTnEhwAs8^UvoJ(0c!k6mq>ja5)o^O6T8NVzfC6C^j9E4krjreT0@!8km~=ALn}KND zfq9FCBgs100W-L!kR>6z)xq2tUh$A#kLVjxXdZ|%Y|s>HrxXC(2r+|F14tMU6@wjF zCQ#0r3gn9Lp_i;H^qX}>_;3ZH5gDS1N7bV_!37pf0%d4E&<9mG!9(x?#R<|-Hc+~T z1^WSl0~Q{_f|pnvEDJgV#7->=2cak%0s{dK%>ztOa}Zw(IXoZ>JqKYl8v+Rsa)MTt zelH5k#seJLv?1Jx)`k(o)FJ?S4E;p$!&NYc*7`-AhGQWV8g_o*fu^C&A)O}P9q;eOi=coo08sz=bZ^ z#Gh<mBeH)2~614@#&diAnGzFbM`s_)YN$WRif1p9jg)ljQlEV?^`wCsRoD ztt2Xm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_f*e(_5lS@SRSjxxgfdNt zX+bFwY9kt+Kpjevd$r&P*05mP#9B`Va0MeJXg^i~ITX&y-}eJqU;l3Zk__n2zcc8g O`Y*BmZ=?UuGw>hKM+iFr literal 0 HcmV?d00001 diff --git a/Xamarin.CommunityToolkit.All.sln b/Xamarin.CommunityToolkit.All.sln index 77ec6c726..97543bf74 100644 --- a/Xamarin.CommunityToolkit.All.sln +++ b/Xamarin.CommunityToolkit.All.sln @@ -1,12 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31019.210 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.31903.286 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit", "src\CommunityToolkit\Xamarin.CommunityToolkit\Xamarin.CommunityToolkit.csproj", "{1B9B44A1-281F-4854-8DA9-4679A34593BB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.Markup", "src\Markup\Xamarin.CommunityToolkit.Markup\Xamarin.CommunityToolkit.Markup.csproj", "{ED6D1344-7A87-4DCF-BBA3-13E319108C56}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.SourceGenerator", "src\SourceGenerator\Xamarin.CommunityToolkit.SourceGenerator\Xamarin.CommunityToolkit.SourceGenerator.csproj", "{13195939-6F8A-4991-B42A-C13DE7ED1EB6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {ED6D1344-7A87-4DCF-BBA3-13E319108C56}.Debug|Any CPU.Build.0 = Debug|Any CPU {ED6D1344-7A87-4DCF-BBA3-13E319108C56}.Release|Any CPU.ActiveCfg = Release|Any CPU {ED6D1344-7A87-4DCF-BBA3-13E319108C56}.Release|Any CPU.Build.0 = Release|Any CPU + {13195939-6F8A-4991-B42A-C13DE7ED1EB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13195939-6F8A-4991-B42A-C13DE7ED1EB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13195939-6F8A-4991-B42A-C13DE7ED1EB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13195939-6F8A-4991-B42A-C13DE7ED1EB6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/XCT.Sample.sln b/samples/XCT.Sample.sln index ac7239f80..260582d63 100644 --- a/samples/XCT.Sample.sln +++ b/samples/XCT.Sample.sln @@ -32,9 +32,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.Sa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.Markup", "..\src\Markup\Xamarin.CommunityToolkit.Markup\Xamarin.CommunityToolkit.Markup.csproj", "{A5AAB927-15D7-498C-8295-4209F21836CE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.CommunityToolkit.Markup.UnitTests", "..\src\Markup\Xamarin.CommunityToolkit.Markup.UnitTests\Xamarin.CommunityToolkit.Markup.UnitTests.csproj", "{AAE423C4-E9B4-434E-885C-2164C12BF79C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.CommunityToolkit.Markup.UnitTests", "..\src\Markup\Xamarin.CommunityToolkit.Markup.UnitTests\Xamarin.CommunityToolkit.Markup.UnitTests.csproj", "{AAE423C4-E9B4-434E-885C-2164C12BF79C}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Xamarin.CommunityToolkit.Sample.FSharp", "XCT.Sample.FSharp\Xamarin.CommunityToolkit.Sample.FSharp.fsproj", "{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Xamarin.CommunityToolkit.Sample.FSharp", "XCT.Sample.FSharp\Xamarin.CommunityToolkit.Sample.FSharp.fsproj", "{D5C2D19A-E929-4587-A9DE-FA50E46AAB59}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.CommunityToolkit.SourceGenerator", "..\src\SourceGenerator\Xamarin.CommunityToolkit.SourceGenerator\Xamarin.CommunityToolkit.SourceGenerator.csproj", "{47143F45-FF3B-4F74-9697-212886E9967E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -354,6 +356,30 @@ Global {D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x64.Build.0 = Release|Any CPU {D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x86.ActiveCfg = Release|Any CPU {D5C2D19A-E929-4587-A9DE-FA50E46AAB59}.Release|x86.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|ARM.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|iPhone.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|x64.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|x64.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|x86.ActiveCfg = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Debug|x86.Build.0 = Debug|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|Any CPU.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|ARM.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|ARM.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|iPhone.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|iPhone.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|x64.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|x64.Build.0 = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|x86.ActiveCfg = Release|Any CPU + {47143F45-FF3B-4F74-9697-212886E9967E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/XCT.Sample/Xamarin.CommunityToolkit.Sample.csproj b/samples/XCT.Sample/Xamarin.CommunityToolkit.Sample.csproj index 17edb0e8e..74bcb3141 100644 --- a/samples/XCT.Sample/Xamarin.CommunityToolkit.Sample.csproj +++ b/samples/XCT.Sample/Xamarin.CommunityToolkit.Sample.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -52,5 +52,8 @@ + diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.android.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.android.cs index e4f0a12fb..1e4e291b2 100644 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.android.cs +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.android.cs @@ -6,7 +6,7 @@ namespace Xamarin.CommunityToolkit.Helpers { - static class XCT + static partial class XCT { static Context? context; static int? sdkInt; diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.ios.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.ios.cs index 786a8deda..d92b5e0fc 100644 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.ios.cs +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.ios.cs @@ -2,7 +2,7 @@ namespace Xamarin.CommunityToolkit.Helpers { - static class XCT + static partial class XCT { static bool? isiOS13OrNewer; diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.shared.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.shared.cs new file mode 100644 index 000000000..f3800fe92 --- /dev/null +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.shared.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Xamarin.CommunityToolkit.Helpers +{ + public static partial class XCT + { + /// + /// Just a wrapper to solve VS xaml issues + /// + public static void Init() + { + } + } +} diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Xamarin.CommunityToolkit.csproj b/src/CommunityToolkit/Xamarin.CommunityToolkit/Xamarin.CommunityToolkit.csproj index c5e1e74c0..0c19205e6 100644 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/Xamarin.CommunityToolkit.csproj +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Xamarin.CommunityToolkit.csproj @@ -210,8 +210,7 @@ - - + diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/build/PreserveXamarinCommunityToolkit.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/build/PreserveXamarinCommunityToolkit.cs deleted file mode 100644 index a29998d3a..000000000 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/build/PreserveXamarinCommunityToolkit.cs +++ /dev/null @@ -1,5 +0,0 @@ -// - -using Xamarin.CommunityToolkit.Helpers; - -[assembly: PreserveToolkit] \ No newline at end of file diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/build/Xamarin.CommunityToolkit.targets b/src/CommunityToolkit/Xamarin.CommunityToolkit/build/Xamarin.CommunityToolkit.targets deleted file mode 100644 index 247083392..000000000 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/build/Xamarin.CommunityToolkit.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/XCTGenerator.cs b/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/XCTGenerator.cs new file mode 100644 index 000000000..99aa3f8a3 --- /dev/null +++ b/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/XCTGenerator.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; + +namespace Xamarin.CommunityToolkit.SourceGenerator +{ + [Generator] + public class XCTGenerator : ISourceGenerator + { + const string code = @" +namespace Xamarin.CommunityToolkit.Initializer +{ + sealed class XCTInitCaller + { + public void CallInit() + { + Xamarin.CommunityToolkit.Helpers.XCT.Init(); + } + } +}"; + + public void Execute(GeneratorExecutionContext context) + { + context.AddSource("InitCaller.g.cs", SourceText.From(code, Encoding.UTF8)); + } + + public void Initialize(GeneratorInitializationContext context) + { + } + } +} diff --git a/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.csproj b/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.csproj new file mode 100644 index 000000000..37326fea7 --- /dev/null +++ b/src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.0 + latest + true + false + + + + + + +