Commit graph

18 commits

Author SHA1 Message Date
Ignacio Roldán Etcheverry 50b603c7dc C#: Begin move to .NET Core
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.
2021-09-22 08:27:12 +02:00
Ignacio Roldán Etcheverry f744d99179 C#: Restructure code prior move to .NET Core
The main focus here was to remove the majority of code that relied on
Mono's embedding APIs, specially the reflection APIs. The embedding
APIs we still use are the bare minimum we need for things to work.
A lot of code was moved to C#. We no longer deal with any managed
objects (`MonoObject*`, and such) in native code, and all marshaling
is done in C#.

The reason for restructuring the code and move away from embedding APIs
is that once we move to .NET Core, we will be limited by the much more
minimal .NET hosting.

PERFORMANCE REGRESSIONS
-----------------------

Some parts of the code were written with little to no concern about
performance. This includes code that calls into script methods and
accesses script fields, properties and events.
The reason for this is that all of that will be moved to source
generators, so any work prior to that would be a waste of time.

DISABLED FEATURES
-----------------

Some code was removed as it no longer makes sense (or won't make sense
in the future).
Other parts were commented out with `#if 0`s and TODO warnings because
it doesn't make much sense to work on them yet as those parts will
change heavily when we switch to .NET Core but also when we start
introducing source generators.
As such, the following features were disabled temporarily:
- Assembly-reloading (will be done with ALCs in .NET Core).
- Properties/fields exports and script method listing (will be
  handled by source generators in the future).
- Exception logging in the editor and stack info for errors.
- Exporting games.
- Building of C# projects. We no longer copy the Godot API assemblies
  to the project directory, so MSBuild won't be able to find them. The
  idea is to turn them into NuGet packages in the future, which could
  also be obtained from local NuGet sources during development.
2021-09-22 06:38:00 +02:00
Raul Santos d636ebbfe9 Ignore paths with invalid chars in PathWhich 2021-07-27 04:16:20 +02:00
Raul Santos accd05f4ad Use Array.Empty instead of allocating a every time
Use `System.Array.Empty<T>` to get an empty array instead of allocating
a new one every time. Since arrays are immutable there is no need to
allocate them every time.
2021-07-26 03:52:31 +02:00
Lorenz Junglas 7e2b495435 Adressed Review
Identifier "macOS" => "MacOS"
Platform/SDK name reverted to "osx"
2020-10-08 13:51:19 +02:00
Lorenz Junglas 519f369795 C# GodotTools: Replace platform Identifier "OSX" with "macOS"
Because `Strings OS_OSX::get_name() const` now returns "macOS" (15a9f94346)
The C# GodotTools were still using "OSX" as identifier a few things were borken (e.g. dotnet/msbuild detection).
2020-10-08 13:51:19 +02:00
Ignacio Etcheverry f3bcd5f8dd C#: Use Sdks in GodotTools csprojs and switch to nuget Microsoft.Build 2020-05-09 21:36:31 +02:00
Ignacio Etcheverry 77dd061345 Mono/C#: Add iOS support
Right now, games only work on devices when exported with FullAOT+Interpreter.
There are some issues left that need to addressed for FullAOT alone. Right now,
it's giving issues with the Godot.NativeCalls static constructor.
2020-03-31 09:37:16 +02:00
Mateo Kuruk Miccino f387b9b4f4 Multiple changes to DisplayServerX11
- Travis: Change x11 to linuxbsd
- SCons: Change x11 plataform to linuxbsd
- Plugins: Remove ; to avoid fallthrough warning
- DisplayServerX11: Implement set_icon
- DisplayServerX11: Fix X11 bug when a window was erased from windows
  map, all the changes from that erased windows are sending to the main
  window
- DisplayServerX11: Reorder create_window commands
- DisplayServerX11: Change every Size2 to Size2i and Rect2 to Rect2i
  where it belongs

+ More X11 fixes which have been integrated directly back into reduz's
original commits while rebasing the branch.
2020-03-26 15:49:54 +01:00
Dan Kramer 097d1c9383 add suggested fix 2019-12-21 13:26:29 -05:00
Ignacio Etcheverry 5a3ccf4f14 Mono/C#: Remove GodotTools dependency on the Mono.Posix assembly
MSBuild on Windows uses the system .NET Framework BCL instead of Mono's. Because
of this, it may not be able to find the Mono.Posix assembly, so it's better
not to depend on it. We needed Mono.Posix to call Syscall.access, so we can
replace this with an internal call that does the same in C++.
2019-12-21 15:55:45 +01:00
Aaron Franke 5771f9959c
Mono formatting
No space for casting, add spaces inside braces, 4 space indentation, remove trailing indentation, remove BOM.
2019-12-11 16:32:47 -05:00
Ivan Shakhov 8fbc9d33fd Support Rider as External Editor 2019-12-11 08:39:04 +01:00
Ignacio Etcheverry 066ae9d83b Mono/C#: Several android fixes
- Added correct config file for android dllmaps.
- Fix __Internal DllImports with a dlopen fallback.
- Add missing P/Invoke functions and internal calls expected by the monodroid BCL and our custom version of the 'Android.Runtime.AndroidEnvironment' class (this last one can be found in the godot-mono-builds repo).
- Make sure to set 'btls' instead of 'legacy' as the default TLS provider on Android.
2019-12-04 19:03:42 +01:00
Ignacio Etcheverry f91416d9ac C#: Fix PathWhich on Windows when name already has extension
Also make the Posix version of PathWhich check if the file has executable access.
2019-11-21 14:53:00 +01:00
Ignacio Etcheverry 2b67924a0b Mono/C#: Initial exporter support for AOT compilation 2019-11-15 03:22:18 +01:00
Ignacio Etcheverry de7c2ad21b Mono/C#: WebAssembly support 2019-11-13 21:41:11 +01:00
Ignacio Etcheverry 270af6fa08 Re-write mono module editor code in C#
Make the build system automatically build the C# Api assemblies to be shipped with the editor.
Make the editor, editor player and debug export templates use Api assemblies built with debug symbols.
Always run MSBuild to build the editor tools and Api assemblies when building Godot.
Several bugs fixed related to assembly hot reloading and restoring state.
Fix StringExtensions internal calls not being registered correctly, resulting in MissingMethodException.
2019-07-05 09:38:23 +02:00