Commit graph

395 commits

Author SHA1 Message Date
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
Pedro J. Estébanez 23907e6f19 Make glue generation shutdown more graceful 2021-02-22 11:06:33 +01:00
Rémi Verschelde ed8333f6bc
Merge pull request #45158 from aaronfranke/cs-packedarray
Add C# array features from core PackedArrays
2021-02-20 09:42:30 +01:00
Rémi Verschelde 8eaea1db53
Merge pull request #45032 from neikeq/classdb-tests-for-44856
Add ClassDB tests to look for core API deps on editor API
2021-02-18 15:16:52 +01:00
Aaron Franke 614299aedb
Add C# array features from core PackedArrays 2021-02-16 15:24:44 -05:00
bruvzg e304f716c7
[Mono] Use the same search logic for both MSBuild and dotnet, add custom search paths on macOS. 2021-02-04 22:39:38 +02:00
Ivan Shakhov deef9a73a5 Fix off by one error navigating to line number in Rider
Fixes https://github.com/JetBrains/godot-support/issues/61
2021-01-28 22:41:12 +01:00
Rémi Verschelde 76c6007aa6
Cleanup: Remove executable bit from files which don't need it
Drop unused xpmfix.sh script.
2021-01-19 23:36:42 +01:00
Rémi Verschelde 0b409d89d0
Merge pull request #45136 from akien-mga/clang-format-11
CI: Update to clang-format 11 and apply ternary operator changes
2021-01-13 16:10:44 +01:00
Marcel Admiraal 3ee860e3d1 Update Mono module to use new execute method. 2021-01-13 09:34:14 +00:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Ignacio Etcheverry fafdc0b0c1 Add ClassDB tests to look for core API deps on editor API
The ClassDB tests will detect when the core API has dependencies on
the editor API, which is not allowed.

This should prevent or warn early about issues like #44856
2021-01-09 00:18:03 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Rémi Verschelde b07a3f503b
Merge pull request #44105 from neikeq/mono-wasm-m2n-hook
Mono: Make Godot provide its own WASM m2n trampolines
2020-12-17 09:58:24 +01:00
Ignacio Etcheverry 7439b5595d Mono: Make Godot provide its own WASM m2n trampolines
This depends on a custom Mono patch from this commit:
godotengine/godot-mono-builds@0e312939bd
2020-12-14 21:16:01 +01:00
Ignacio Etcheverry b98e8b11e6 Mono: Add extra WASM framework assemblies on game export
This is needed with newer Mono versions, at least with Mono 6.12+

Depends on the following commit from our build scripts:
godotengine/godot-mono-builds@9d75cff174
2020-12-14 20:55:29 +01:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Rémi Verschelde af61ad5e36
Merge pull request #44107 from neikeq/fix-slow-build-log-update
C#: Fix very slow build log update in the editor
2020-12-05 16:41:24 +01:00
Ignacio Etcheverry b0eb9061e4 C#: Fix very slow build log update in the editor 2020-12-05 00:43:24 +01:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
Thakee Nathees 42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Rémi Verschelde c11992ed48
Merge pull request #43029 from neikeq/offline-nuget-fallback
C#: Make editor create NuGet fallback folder for Godot packages
2020-10-27 08:07:58 +01:00
Ignacio Etcheverry 34960cb936 C#: Fix custom event signals crash on hot-reload
Cleanup and re-initialization of event signals before
and after hot-reload should be working correctly now.
2020-10-26 07:00:51 +01:00
Ignacio Etcheverry 64b5ee7010 C#: Make editor create NuGet fallback folder for Godot packages
Main benefits:
- Projects can be built offline. Previously you needed internet
  access the first time building to download the packages.
- Changes to packages like Godot.NET.Sdk can be easily tested
  before publishing. This was already possible but required
  too many manual steps.
- First time builds are a bit faster, as the Sdk package doesn't
  need to be downloaded. In practice, the package is very small
  so it makes little difference.

Bumped Godot.NET.Sdk to 4.0.0-dev3 in order to enable the
recent changes regarding '.mono/' -> '.godot/mono/'.
2020-10-23 10:54:49 +02:00
Ignacio Etcheverry f06f91281c C#: Re-work solution build output panel
- Removed item list that displayed multiple build
  configurations launched. Now we only display
  the last build that was launched.
- Display build output next to the issues list.
  Its visibility can be toggled off/on.
  This build output is obtained from the MSBuild
  process rather than the MSBuild logger. As such
  it displays some MSBuild fatal errors that
  previously couldn't be displayed.
- Added a context menu to the issues list with
  the option to copy the issue text.
- Replaced the 'Build Project' button in the panel
  with a popup menu with the options:
  - Build Solution
  - Rebuild Solution
  - Clean Solution
- The bottom panel button was renamed from 'Mono'
  to 'MSBuild' and now display an error/warning icon
  if the last build had issues.
2020-10-23 07:49:39 +02:00
Rémi Verschelde 1af3cf15c2
Mono: Fix typo in Godot.NET.Sdk.nuspec
Fixes #42666.
2020-10-09 13:37:07 +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
Aaron Franke 42e70a77ef
Rename the ".mono" folder to ".godot/mono" 2020-09-23 15:42:29 -04:00
Rémi Verschelde 3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
Ignacio Etcheverry 1db0395950 C#: Fix csproj not synced on file move/removal from FS dock
When NormalizePath was called with an absolute
path (with drive letter) on Windows, it would
prepend a file path separator to the path, e.g.:
'\C:\Program Files\'.
Apparently this was still accepted as a valid
path by DotNetGlob and it stopped working when
we switched to MSBuildGlob.
2020-09-13 03:46:27 +02:00
Ignacio Etcheverry 1c74fa4242 C#: Use BOM when creating a solution
At least on Windows there seems to be issues if
the solution has no BOM and contains a project
with cyrillic chars.
2020-09-08 20:06:07 +02:00
Alex de la Mare 8dbd7155b5 Handle csproj "Remove" globs
MSBuild Item returns empty strings if an attribute isn't set (which
caused an IndexOutOfRangeException in NormalizePath).

We were treating Excludes incorrectly, Remove directives provide the
intended behaviour in the auto-including csproj format.
2020-09-06 11:34:04 +10:00
Rémi Verschelde 5c55c41c9d
Merge pull request #41753 from neikeq/csharp-hide-build-button-if-no-proj
C#: Hide Build button if there's no solution to build
2020-09-04 08:19:53 +02:00
Rémi Verschelde 15efe040f9
Merge pull request #41747 from neikeq/issue-41446
Fix parsing of C# files with spaces in the path
2020-09-04 08:16:56 +02:00
Rémi Verschelde 90601bb659
Merge pull request #41750 from neikeq/issue-41745
C#: Fix Godot failing to find class namespace
2020-09-04 08:15:49 +02:00
Ignacio Etcheverry 173f7d800b C#: Hide Build button if there's no solution to build
Same as we do with the bottom panel. Mainly to
avoid bothering if the project is not using C#.
2020-09-04 02:07:12 +02:00
Ignacio Etcheverry a0ef3ba5c8 C#: Fix Godot failing to find class namespace 2020-09-04 01:26:05 +02:00
Ignacio Etcheverry 9e8a5e4b5a Fix parsing of C# files with spaces in the path 2020-09-04 01:01:10 +02:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Ignacio Etcheverry 206501a45e C#: Fix Windows detection for copying MSBuild stub
Previous condition checked only the host
platform. This was a problem as our official
builds are from Linux.
2020-09-03 09:09:04 +02:00
Rémi Verschelde 30029e1d7f
Merge pull request #41611 from neikeq/issue-41444
C#: Fix crash on export when incorrectly freeing MonoAssemblyName
2020-08-30 12:02:55 +02:00
Ignacio Etcheverry 99740850a2 C#: Fix InvalidCastException on export 2020-08-30 01:55:21 +02:00
Ignacio Etcheverry 7c7d724453 C#: Fix crash on export when incorrectly freeing MonoAssemblyName 2020-08-30 01:48:43 +02:00
Thaina Yu 5dc3900727
Mono: Improve MSBuildFinder logic on Windows
Support detecting both 32-bit and 64-bit installations of `vswhere.exe`.
2020-08-29 12:55:29 +02:00