virtualx-engine/modules/mono/build_scripts
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
..
__init__.py
api_solution_build.py SCons: Format buildsystem files with psf/black 2020-03-30 09:05:53 +02:00
gen_cs_glue_version.py SCons: Format buildsystem files with psf/black 2020-03-30 09:05:53 +02:00
godot_net_sdk_build.py Add C# source generator for a new ScriptPath attribute 2021-03-06 21:50:32 +01:00
godot_tools_build.py C#: Add VisualStudio support 2020-06-15 21:29:16 +02:00
make_android_mono_config.py Mono: Fix Android build after #36311 2020-12-03 11:17:03 +01:00
mono_android_config.xml Mono/C#: Several android fixes 2019-12-04 19:03:42 +01:00
mono_configure.py Merge pull request #44105 from neikeq/mono-wasm-m2n-hook 2020-12-17 09:58:24 +01:00
mono_reg_utils.py Merge python EnvironmentError, IOError and WindowsError into OSError. 2020-09-02 15:58:07 +01:00
solution_builder.py Remove unused Python local variables. 2020-09-11 11:39:15 +01:00