virtualx-engine/modules/mono/mono_gd
Ignacio Etcheverry e2afe700f6 Add C# source generator for a new ScriptPath attribute
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.
2021-03-06 21:50:32 +01:00
..
support Modernize Thread 2021-01-29 12:02:13 +01:00
android_mono_config.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono.cpp Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
gd_mono.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_assembly.cpp Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
gd_mono_assembly.h Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
gd_mono_cache.cpp Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
gd_mono_cache.h Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
gd_mono_class.cpp C # mono supports Unicode code 2021-01-19 21:44:07 +08:00
gd_mono_class.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_field.cpp C # mono supports Unicode code 2021-01-19 21:44:07 +08:00
gd_mono_field.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_header.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_internals.cpp Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_internals.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_log.cpp Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
gd_mono_log.h Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
gd_mono_marshal.cpp Merge pull request #45029 from neikeq/issue-40023 2021-01-26 15:30:44 +01:00
gd_mono_marshal.h C#: Fix System.Collections.Generic.List marshalling 2021-01-08 21:51:25 +01:00
gd_mono_method.cpp Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_method.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_method_thunk.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_property.cpp C # mono supports Unicode code 2021-01-19 21:44:07 +08:00
gd_mono_property.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_utils.cpp Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_utils.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_wasm_m2n.cpp Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
gd_mono_wasm_m2n.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
i_mono_class_member.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
managed_type.cpp Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
managed_type.h Update copyright statements to 2021 2021-01-01 20:19:21 +01:00