diff --git a/Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll b/Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll new file mode 100644 index 000000000..4f357c457 Binary files /dev/null and b/Libs/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.dll differ 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 + + + + + + +