summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Godot.SourceGenerators.Sample.csproj
Commit message (Collapse)AuthorAgeFilesLines
* Dotnet: Fix attributes for `sln`/`csproj` filesThaddeus Crews2024-05-031-1/+1
|
* C# Add test suite for Diagnostic Analyzers: GlobalClass and MustBeVariantAlberto Vilches2024-01-151-0/+1
|
* C#: Fix building projects for MSBuild before 17.3RedworkDE2023-03-061-1/+1
|
* C#: Encode GodotProjectDir as Base64 to prevent issues with special charactersRaul Santos2023-03-041-0/+1
|
* C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry2022-08-221-1/+1
|
* C#: Add source generator for properties and exports default valuesIgnacio Roldán Etcheverry2022-08-221-0/+2
| | | | | | | | | | | | | | The editor no longer needs to create temporary instances to get the default values. The initializer values of the exported properties are still evaluated at runtime. For example, in the following example, `GetInitialValue()` will be called when first looks for default values: ``` [Export] int MyValue = GetInitialValue(); ``` Exporting fields with a non-supported type now results in a compiler error rather than a runtime error when the script is used.
* C#: Begin move to .NET CoreIgnacio Roldán Etcheverry2022-08-221-1/+1
| | | | | | | | | | | | We're targeting .NET 5 for now to make development easier while .NET 6 is not yet released. TEMPORARY REGRESSIONS --------------------- Assembly unloading is not implemented yet. As such, many Godot resources are leaked at exit. This will be re-implemented later together with assembly hot-reloading.
* Add C# source generator for a new ScriptPath attributeIgnacio Etcheverry2021-03-061-0/+31
This source generator adds a newly introduced attribute, `ScriptPath` to all classes that: - Are top-level classes (not inner/nested). - Have the `partial` modifier. - Inherit `Godot.Object`. - The class name matches the file name. A build error is thrown if the generator finds a class that meets these conditions but is not declared `partial`, unless the class is annotated with the `DisableGodotGenerators` attribute. We also generate an `AssemblyHasScripts` assembly attribute which Godot uses to get all the script classes in the assembly, eliminating the need for Godot to search them. We can also avoid searching in assemblies that don't have this attribute. This will be good for performance in the future once we support multiple assemblies with Godot script classes. This is an example of what the generated code looks like: ``` using Godot; namespace Foo { [ScriptPathAttribute("res://Player.cs")] // Multiple partial declarations are allowed [ScriptPathAttribute("res://Foo/Player.cs")] partial class Player {} } [assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })] ``` The new attributes replace script metadata which we were generating by determining the namespace of script classes with a very simple parser. This fixes several issues with the old approach related to parser errors and conditional compilation. It also makes the task part of the MSBuild project build, rather than a separate step executed by the Godot editor.