Commit graph

862 commits

Author SHA1 Message Date
Ignacio Etcheverry 3928fe200f [3.2] C#: Support for building with the dotnet CLI
By adding a reference to the 'Microsoft.NETFramework.ReferenceAssemblies' nuget
package, we can build projects targeting .NET Framework with the dotnet CLI.
By referencing this package we also don't need to install Mono on Linux/macOS
or .NET Framework on Windows, as the assemblies are taken from the package.
2020-05-11 19:48:50 +02:00
Ignacio Etcheverry 683e19306e Mono: Use msbuild instead of nuget.exe for restoring
- Make GodotTools output directly to the SCons output directory.
- Removed xbuild_fallback from the build system.

(cherry picked from commit b61ffef0ab)
2020-05-11 11:01:13 +02:00
Ignacio Etcheverry 34132d2f67 Mono: Fix hot-reloading of nested classes
(cherry picked from commit e0a001549e)
2020-05-11 11:01:13 +02:00
Ignacio Etcheverry fb2e00a854 [3.2] C#: Rewrite GodotTools messaging protocol 2020-05-10 21:05:00 +02:00
Nannaquin 9e4de37e88 Fix growMargin() not returning modified Rect2/Rect2i
(cherry picked from commit 0ac6f4c40b)
2020-05-01 10:56:58 +02:00
Ignacio Etcheverry 8cdcb410e0 Mono/C#: Fix load hook not called for some assemblies on domain reload
(cherry picked from commit f5510262bc)
2020-04-27 10:15:24 +02:00
Ignacio Etcheverry a98d44f654 C#: Fix always saving copy of csproj even with no changes
This was a regression from 93d7ec8836 (#38110).
Mono's old implementation of Microsoft.Build hardcodes HasUnsavedChanges to
always return true.
This workaround can be reverted once we switch to official Microsoft.Build.

(cherry picked from commit 81f13f6171)
2020-04-27 10:15:07 +02:00
Ignacio Etcheverry 6aca932659 C#: Revert marshalling of IDictionary/IEnumerable implementing types
Added marshalling for `System.Collections.Generic.List<T>` and
`System.Collections.Generic.Dictionary<TKey, TValue>`.
2020-04-23 15:36:01 +02:00
Ignacio Etcheverry dfdb7bdc87 Mono/C#: Fix assemblies being reloaded a second time unnecesarily
(cherry picked from commit c9882e61e2)
2020-04-23 11:34:42 +02:00
Ignacio Etcheverry cf729f2111 Mono/C#: Allow exporting System.Array of type Godot.Object
(cherry picked from commit 0fec3cb5ed)
2020-04-23 11:17:23 +02:00
Ignacio Etcheverry 317d8decad Mono/C#: Allow debugging exported games
- Include PDB files in exported games.
- Release export templates also allow debugging now.

Right now the only way to enable debugging in exported games is with the  environment variables, which may be cumbersome or not even possible on some platforms.

(cherry picked from commit 71fc87e101)
2020-04-23 11:15:35 +02:00
Ignacio Etcheverry 08f41f474b C#: Save copy of sln and csproj before applying fixes
(cherry picked from commit 93d7ec8836)
2020-04-23 11:14:57 +02:00
Rémi Verschelde cb1366f006 Mono: Fix include for Android support
This was a typo in #37153.

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
(cherry picked from commit 408fab8442)
2020-04-18 22:02:07 +02:00
Ignacio Etcheverry 445f1c6e7b 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-04-14 18:03:10 +02:00
Ignacio Etcheverry 6b38fe691a Mono/C#: Fix MinGW build not supporting .lib libraries
MinGW should support both its own format `.a` and MSVC's format `.lib`, but Mono's module was only using the former. With this change it's now possible to build with MinGW and link the official Mono for Windows which is built with MSVC.
2020-04-14 18:03:10 +02:00
Hugo Locurcio dd4569f15c Remove syntax highlighting for C# verbatim strings due to bugs
This closes #32336.

(cherry picked from commit 49efd6093e)
2020-04-06 18:18:38 +02:00
Ivan.Shakhov 66e4c8be23 fix RiderPathLocator - searching for toolbox on Mac
(cherry picked from commit dc16b8742a)
2020-04-06 18:15:20 +02:00
Ignacio Etcheverry bda993dd79 C#: Fix uses of old Configuration names
(cherry picked from commit 66c0b7ce98)
2020-04-06 18:14:07 +02:00
Andrii Doroshenko (Xrayez) 8fedcfbed2 Generate command line help text for mono module
(cherry picked from commit 94b6c1363c)
2020-03-25 11:38:54 +01:00
Ivan.Shakhov 9d0518cf80 Fix warning: Property not found: mono/editor/editor_path_optional (#36995)
(cherry picked from commit 05946be2f1)
2020-03-25 11:38:54 +01:00
Ignacio Etcheverry d46fcbb16a C#: Replace uses of old Configuration and update old csprojs
(cherry picked from commit 1b634785b5)
2020-03-25 11:38:54 +01:00
Ivan Shakhov b874e84147 reorder solution configurations + migration
(cherry picked from commit ce01b83c4a)
2020-03-25 11:38:54 +01:00
Ignacio Etcheverry d1a5f8dbf2 [3.2] Sync csproj when files are changed from the Godot FileSystem dock 2020-03-18 17:57:45 +01:00
Phischermen 69c1805735 Added parameters to Load()
(cherry picked from commit 1b0819bd59)
2020-03-06 23:55:25 +01:00
Rémi Verschelde 4c325c0732 Mono: Fix detection of Apple platforms in build script
(cherry picked from commit 5b040ef2e8)
2020-03-06 23:51:26 +01:00
Ivan Shakhov 88f0cd0b27 On Windows find Rider installed for CurrentUser
(cherry picked from commit c95e20a089)
2020-03-04 12:40:15 +01:00
Raul Santos 447acafa97 Fix missing null check in Mono Binding of GD.print
(cherry picked from commit 6b9c22542f)
2020-03-04 12:40:15 +01:00
Ivan Shakhov f0b63b47aa use Rider MSBuild on Windows, when Rider is selected as external editor
(cherry picked from commit a9c2ab81cf)
2020-03-04 12:40:14 +01:00
Ivan Shakhov 8337cc5f7d Support toolbox custom "Tools install location", by reading .settings.json
(cherry picked from commit 33af53c1a6)
2020-03-04 12:40:14 +01:00
Rémi Verschelde 57de8397b2 Fix Mono check for unsafe object references
(cherry picked from commit 09534e2922)
2020-02-14 16:10:06 +01:00
Raul Santos 0fb35401d4 Avoid going out of bounds in IsSubsequenceOf
Closes #35598

(cherry picked from commit 4b79ef5ebe)
2020-02-14 16:03:18 +01:00
Aaron Franke 9a396a4e07 [Mono] Basis/Transforms Array operator comments and improvements
The behavior for Basis and Transform2D is unchanged, and Transform gets new behavior. All of the behavior is identical to GDScript's behavior. 

(cherry picked from commit 0a39c7b354)
2020-02-14 15:53:59 +01:00
Fabián L 04cfcb3ba0 Fixed GetNodeOrNull<T>
GetNodeOrNull<T> was using GetNode instead of GetNodeOrNull

(cherry picked from commit f595486076)
2020-02-06 13:02:07 +01:00
Rémi Verschelde c96f08dc86
Merge pull request #35527 from neikeq/issue-35259
Mono/C#: Fix _update_exports possible crash with Reference types
2020-01-24 21:51:57 +01:00
Rémi Verschelde 75ab07546b
Merge pull request #35524 from neikeq/issue-35496
Fix C# preprocessor infinite loop and incorrect parsing of `#if!`
2020-01-24 21:51:38 +01:00
Ignacio Etcheverry 966a126186 Mono/C#: Fix _update_exports possible crash with Reference types
The code was attempting to dynamic cast the native instance to Reference after
the managed instance was disposed. As the managed instance acts as a Ref,
the native instance was freed during that disposal.
This made the dynamic cast fail and we attempted to memdelete a second time.

The fix is to make the dynamic cast before disposal.
2020-01-24 18:28:40 +01:00
Ignacio Etcheverry 0604b1839d Fix C# preprocessor infinite loop and incorrect parsing of #if! 2020-01-24 17:53:17 +01:00
Rémi Verschelde 55f580b24a
Merge pull request #35491 from neikeq/issue-35450
Mono/C#: Lighten up unsafe reference checks
2020-01-23 23:06:58 +01:00
Ignacio Etcheverry 55b2e58a98 Mono/C#: Lighten up unsafe reference checks
Because of the weird case with multi-threading and ResourceLoader, it can be the case that a resource is GCed while being referenced again in the main thread. In such cases, a new unsafe reference is created before the finalizer thread removes the previous one.
2020-01-23 21:23:32 +01:00
Rémi Verschelde cadf946863
Merge pull request #35478 from neikeq/issue-32260
Mono/C#: Add setting to include I18N assemblies in the exported game
2020-01-23 18:24:15 +01:00
Ignacio Etcheverry 59ec19d5a8 Mono/C#: Add setting to include I18N assemblies in the exported game 2020-01-23 17:47:09 +01:00
Rémi Verschelde b75fff5a56
Merge pull request #35473 from neikeq/default-to-net47
Mono/C#: Default to net47 for new projects
2020-01-23 17:23:33 +01:00
Ignacio Etcheverry 82b0899e54 Mono/C#: Add Basis.Slerp, update Quat.Xform and add some math checks 2020-01-23 16:13:28 +01:00
Ignacio Etcheverry d9ff5f7fc2 Mono/C#: Default to net47 for new projects 2020-01-23 15:57:47 +01:00
Ignacio Etcheverry d53c15b12c Make script class parser errors to not abort the build
As our script class parser is error prone, we should not impede the build from continuing because of a parsing error.
This should be reverted in the future once we switch to Roslyn.
2020-01-21 20:07:26 +01:00
Ignacio Etcheverry 378fc592b1 Add dummy preprocessor for the C# script class parser
No attempts are made at conditional compilation. The main if branch is always assumed to be true.
2020-01-21 19:57:38 +01:00
Ignacio Etcheverry e4330e33e6 Mono/C#: Fix error when parsing nested generics
Also fixed the editor not including the parse error message in the error.
2020-01-20 19:08:08 +01:00
Ignacio Etcheverry a6105c8ea0 Fix ClassDB API portability with some android and editor classes
- `EditorNavigationMeshGenerator` was being registered as part of the Core API,
even after d3f48f88bb. We must make sure to
set Editor as the current ClassDB API type before creating an instance.

- The `VisualScriptEngineSingleton.constant` property has a property hint string
that's different between tools and non-tools builds. This commit makes the
hint string to no longer be set in `_bind_methods`, and to instead set it in
`_validate_property`. This way it's ignored when calculating the API hash.

- `JavaClassWrapper` is now registered in ClassDB on all platforms,
using a dummy implementation on platforms other than Android.
This fixes API portability between Android and other platforms.

- Updated `--class-db-json` command to ignore non-virtual methods that start
with an underscore (see: 4be87c6016).
2020-01-19 20:15:13 +01:00
Ignacio Roldán Etcheverry 1191d26ddc
Merge pull request #35208 from neikeq/mono-lazy-thread-attach
Mono/C#: Script interface calls now attach the current thread
2020-01-16 21:27:08 +01:00
Ignacio Etcheverry d68b9c20d6 Mono/C#: Script interface calls now attach the current thread
Added guards to all C# script interface calls to attach the current thread
for the current scope if the thread is not already attached.
This is far from ideal, as attaching the thread is not cheap and all managed
thread local storage is lost when we detach the thread at the end of the calls.
However, it's the best we can do for now to avoid crashing
when an unattached thread tries to interact with C# code.
2020-01-16 17:47:36 +01:00