This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 459
Adding Source Generator #1714
Merged
Merged
Adding Source Generator #1714
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5b8a17b
Added Source Generator project
pictos 3caa45b
Configure Source Generator project
pictos 82a1648
Make sure that we will use it just in NETSTANDARD1_0
pictos f0dce50
removed old build and csproj clean up
pictos 23e344e
fixed sample app
pictos 18b212e
added SG dll into Libs folder
pictos 39c17c7
Added SourceGenerator project in all solutions
pictos a9873c2
Reference the SG dll
pictos 7761269
Merge branch 'main' into pj/source-generator
TheCodeTraveler dcbfa3d
Merge branch 'main' into pj/source-generator
pictos 7911759
Merge branch 'main' into pj/source-generator
TheCodeTraveler 59a1358
Merge branch 'main' into pj/source-generator
jsuarezruiz 9f3e5b5
Merge branch 'main' into pj/source-generator
jsuarezruiz 57cae22
Merge branch 'main' into pj/source-generator
TheCodeTraveler afaba99
Merge branch 'main' into pj/source-generator
pictos f93a8ad
Merge branch 'main' into pj/source-generator
pictos f80a0ea
Merge branch 'main' into pj/source-generator
TheCodeTraveler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/XCT.shared.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Xamarin.CommunityToolkit.Helpers | ||
{ | ||
public static partial class XCT | ||
{ | ||
/// <summary> | ||
/// Just a wrapper to solve VS xaml issues | ||
/// </summary> | ||
public static void Init() | ||
{ | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
src/CommunityToolkit/Xamarin.CommunityToolkit/build/PreserveXamarinCommunityToolkit.cs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/CommunityToolkit/Xamarin.CommunityToolkit/build/Xamarin.CommunityToolkit.targets
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
src/SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator/XCTGenerator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
{ | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../Xamarin.CommunityToolkit.SourceGenerator/Xamarin.CommunityToolkit.SourceGenerator.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<IsRoslynComponent>true</IsRoslynComponent> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" /> | ||
</ItemGroup> | ||
</Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.