Commit graph

925 commits

Author SHA1 Message Date
Rémi Verschelde
0237d42809
Merge pull request #42547 from neikeq/3.2-rework-csharp-build-panel
[3.2] C#: Re-work solution build output panel
2020-10-20 15:12:30 +02:00
Aaron Franke
730d42d8a4
Add GetStringFromUTF8 and GetStringFromASCII
(cherry picked from commit 029de52001)
2020-10-19 16:10:01 +02:00
Rémi Verschelde
9bbfa929bc
Mono: Fix typo in Godot.NET.Sdk.nuspec
Fixes #42666.

(cherry picked from commit 1af3cf15c2)
2020-10-19 16:09:59 +02:00
Ignacio Etcheverry
fdfba05fab [3.2] 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 '.NET' and now display an error/warning icon
  if the last build had issues.
2020-10-11 16:51:54 +02:00
Sergey Minakov
5d1284204d iOS: port ARC support 2020-10-06 00:23:25 +03:00
Eduardo Rodrigues
f14e569ab3
Fix error message when exporting a write-only property without a setter
(cherry picked from commit aca0cede67)
2020-10-01 16:00:43 +02:00
Hugo Locurcio
7b3f9ebb94
Enable the copy_mono_root SCons option by default
This closes #41652.

(cherry picked from commit cfd564b385)
2020-09-29 13:57:55 +02:00
Aaron Franke
ea3bbbe0f2
Add concatenation support and a new ctor to Godot.Collections.Array
(cherry picked from commit a4dcd48d16)
2020-09-24 14:43:10 +02:00
Ricardo Alcantara
197b375b89
Basis RotationQuat should be public.
(cherry picked from commit a676b8ea66)
2020-09-24 14:43:08 +02:00
Aaron Franke
1dcbcaaa0d
Change inequality comparison operators to use exact equality
(cherry picked from commit d0a1399a1b)
2020-09-24 14:43:08 +02:00
Zae
e5b357cfb1
Fix C# string.IsAbsPath()
(cherry picked from commit b5eea5cfd4)
2020-09-24 14:43:08 +02:00
Raul Santos
cf45fa7f36
Fix ExprMatch stackoverflow
(cherry picked from commit d425cf6fed)
2020-09-24 14:43:07 +02:00
Rémi Verschelde
c8859f0463
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 14:09:51 +02:00
Tom Daffin
46b4e82f92
Add mono log message to error for fatal errors
(cherry picked from commit c15fb42d45)
2020-09-14 12:07:12 +02:00
Ignacio Etcheverry
cdc9fe154f
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.

(cherry picked from commit 1db0395950)
2020-09-13 12:35:34 +02:00
Ignacio Etcheverry
8c5ed68847
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.

(cherry picked from commit 1c74fa4242)
2020-09-08 22:02:24 +02:00
Ignacio Etcheverry
e72ee23c43 [3.2] C#: Fix endless reload loop if project has unicode chars
The assembly modified time wasn't picked properly
as the path was treated as latin-1, so the file
watcher was constantly firing the event.
2020-09-08 19:47:47 +02:00
Alex de la Mare
6474e036ac [3.2] 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 12:10:54 +10:00
Ignacio Etcheverry
9699e83e1e Fix parsing of C# files with spaces in the path
(cherry picked from commit 9e8a5e4b5a)
2020-09-04 08:24:17 +02:00
Rémi Verschelde
9efd555c58
Merge pull request #41754 from neikeq/3.2-csharp-hide-build-button-if-no-proj
[3.2] C#: Hide Build button if there's no solution to build
2020-09-04 08:20:06 +02:00
Rémi Verschelde
93eb9b554e
Merge pull request #41752 from neikeq/fix-invalidopexception-csproj-migration
[3.2] Fix InvalidOperationException when migrating from 3.2.1 or older csproj
2020-09-04 08:19:18 +02:00
Rémi Verschelde
1edd6aa404
Merge pull request #41751 from neikeq/3.2-issue-41745
[3.2] C#: Fix Godot failing to find class namespace
2020-09-04 08:16:30 +02:00
Ignacio Etcheverry
2bb251f628 [3.2] 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:18:42 +02:00
Ignacio Etcheverry
f8e3a74f9e Fix InvalidOperationException when migrating from 3.2.1 or older csproj 2020-09-04 01:49:32 +02:00
Ignacio Etcheverry
b3762622be [3.2] C#: Fix Godot failing to find class namespace
Also avoid searching C# files recursively twice.
2020-09-04 01:31:38 +02:00
Ignacio Etcheverry
bd18b2ff6a [3.2] Fix 'Parameter "assembly" is null' error
This error was normally being printed when
trying to open the project assembly while
the project was not yet built.
The error should not be printed. It's the job
of this method's caller to decide whether to
print an error or not if loading failed.
2020-09-04 01:09:35 +02:00
Ignacio Etcheverry
939ed5dd5b 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.

(cherry picked from commit 206501a45e)
2020-09-03 09:35:41 +02:00
Thaina Yu
cadd39d415
Mono: Improve MSBuildFinder logic on Windows
Support detecting both 32-bit and 64-bit installations of `vswhere.exe`.

(cherry picked from commit 5dc3900727)
2020-08-31 15:29:41 +02:00
Ignacio Etcheverry
789d7fac8a C#: Fix crash on export when incorrectly freeing MonoAssemblyName 2020-08-30 02:01:38 +02:00
Ignacio Etcheverry
a8e1a0f0bc
C#: Fix 'Parameter toolsPath cannot be null' error
(cherry picked from commit 2bd6252e92)
2020-08-25 14:36:40 +02:00
Ignacio Etcheverry
f3ed06cfd7
Mono/C#: Fix editor using wrong project assembly path in rare cases
We were removing invalid path characters from the
name in C++ code, but the C# editor code wasn't.

(cherry picked from commit 8bb48ae57a)
2020-08-21 02:28:18 +02:00
Ignacio Etcheverry
eb30c04c4d
C#: Save newly created csproj files without BOM
(cherry picked from commit b5f6285f34)
2020-08-21 02:28:18 +02:00
Ignacio Etcheverry
a7bd28760e
C#: Fix null exception in our MSBuild logger
(cherry picked from commit 7eed8c5a0c)
2020-08-21 02:28:18 +02:00
Ignacio Etcheverry
c8845291c3
C#: Fix editor unable to play game after IDE PlayRequest
The editor wasn't clearing the debugger agent
settings properly after a processing a play
request from an IDE. This caused consequent play
attempts to fail if not launched from the IDE,
as the game would still attempt and fail to
connect to the debugger.

The concrete cause: Forgetting to clear the
`GODOT_MONO_DEBUGGER_AGENT` environment variable.

(cherry picked from commit 6e7da72648)
2020-08-21 02:28:18 +02:00
Ignacio Etcheverry
c3954441f3 3.2 New csproj style with backport of Godot.NET.Sdk
This is a cherry-pick of
ced77b1e9b
with several 3.2 specific alterations.

There are a lot of build issues coming from
old style projects. At this point fixing every
single one of those would require adding patch
after patch to the project file, which is a
considerable amount work and makes the csproj
even more bloated than it already is.

As such I decided this effort would be better
spent back-porting the Sdk style support that's
already available in 4.0-dev to the 3.2 branch.

This will prevent many issues, but it will also
introduce other benefits, among them:

- While target framework stays as .NET Framework
  v4.7.2, it can be changed to .NET Standard 2.0
  or greater if desired.
- It makes it much easier to add future patches.
  They are added to Godot.NET.Sdk and the only
  change required in Godot code is to update the
  Sdk version to use.
- Default Godot define constants are also
  backported, which fixes IDE issues with the
  preprocessor.

There are a few differences in the changes
applied during patching of the csproj compared
to 4.0 with the purpose of preventing breaking
builds:

- 'TargetFramework' stays net472 both for new
  projects and when importing old ones. It can
  be manually changed to netstandard 2.0+ if
  desired though.

The following features are enabled by default for
new projects. Enabling them in imported projects
may result in errors that must be fixed manually:

- 'EnableDefaultCompileItems' is disabled as it
  can result in undesired C# source files being
  included. Existing include items are kept.
  As long as 'EnableDefaultCompileItems' remains
  disabled, Godot will continue taking care of
  adding and removing C# files to the csproj.
- 'GenerateAssemblyInfo' is disabled as it
  guarantees a build error because of conflicts
  between the existing 'AssemblyInfo.cs' and the
  auto-generated one.
- 'Deterministic' is disabled because it doesn't
  like wildcards in the assembly version (1.0.*)
  that was in the old 'AssemblyInfo.cs'.

Of importance:

This is a breaking change. A great effort was
put in avoiding build errors after upgrading a
project, but there may still be exceptions.

This also breaks forward compatibility. Projects
opened with Godot 3.2.3 won't work out of the box
with older Godot versions. This was already the
case with changes introduced in 3.2.2.

Albeit C# support in 3.2.x was still labeled as
alpha, we've been trying to treat it as stable
for some time. Still the amount of problems this
change solves justifies it, but no more changes
that break project compatibility are to be
introduced from now on (at least for 3.x).
2020-08-20 21:48:59 +02:00
Ignacio Etcheverry
4d7b7d9b73 3.2 C#: Upgrade GodotTools to nuget Microsoft.Build
This upgrade is needed in order to support
reading and editing project files that use Sdks
as well as other new features. A common example
in 3.2 is having to specify a PackageReference
version with a child element rather than the
attribute. This is no longer the case now.

Partial cherry-pick of f3bcd5f8dd
Most of the other changes from that commit were already partially
cherry-picked in 3928fe200f.
2020-08-20 21:45:34 +02:00
Ignacio Etcheverry
e1f17a0b35 3.2 C#/Mono: Check assembly version when loading
Not sure if we should check revision too, but this is good enough for what we want.
This will be needed to load the correct Microsoft.Build when we switch to the nuget version.

Manual cherry-pick of af4acb5b11 (relevant parts)
2020-08-20 21:38:33 +02:00
Nhiqill
8d5dab5a05 Pop from front to avoid infinite loop with nested classes
(cherry picked from commit 42d1b4f389)
2020-07-28 00:57:27 +02:00
Rémi Verschelde
b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
mega-bit
93f297e1d5 Fix typos in GodotSharp code docs
(cherry picked from commit 0ca96ae2c1)
2020-07-24 10:31:57 +02:00
Ignacio Etcheverry
accc30e5e0 C#: Fix restore not called when building game projects
(cherry picked from commit 4a30289eee)
2020-07-24 10:31:57 +02:00
Aaron Franke
e10a1e078f
[3.2] Add C# XML documentation to core C# math types 2020-07-21 21:22:54 -04:00
Andy Maloney
502a3d580f Remove override keyword from csharp_script.h to fix build errors
Fixes godotengine/godot#40572
2020-07-21 13:17:58 -04:00
endlesstravel
13d4813ddf fix crash when pass null in print array in GD.print
fix crash when pass null in print array in GD.print 2

fix crash when pass null in print array in GD.print 3

fix space

(cherry picked from commit d2461bad63)
2020-07-03 15:38:07 +02:00
Rémi Verschelde
d6ff55f30b
Merge pull request #39784 from neikeq/3.2-visualstudio-support
[3.2] C#: Add Visual Studio support
2020-06-26 20:49:35 +02:00
Ignacio Etcheverry
c682410379 Mono/C#: Fix unhandled exception not being printed
For some reason `mono_unhandled_exception` is not
printing the exception as its comment claims.
Use `mono_print_unhandled_exception` instead.

(cherry picked from commit f87ae395ee)
2020-06-26 08:10:24 +02:00
Rémi Verschelde
c8586d3837
Merge pull request #39840 from neikeq/3.2-use-/restore-instead-of-/t-restore
[3.2] Mono/C#: Use /restore instead of /t:restore when building
2020-06-26 08:08:40 +02:00
Ignacio Etcheverry
abc453f9b6 [3.2] Mono/C#: Use /restore instead of /t:restore when building
Documentation recommends not to use /t:restore
together with other targets (like /t:build),
as it messes with the environment.
2020-06-25 23:57:44 +02:00
Ignacio Etcheverry
7af6a4cc50 [3.2] Fix DebugPlay request handler ignoring BuildBeforePlaying
This must have been missed when backporting the new protocol to 3.2.
2020-06-25 21:20:44 +02:00
Ignacio Etcheverry
d0f365fe0f [3.2] C#: Fix completion request with case insensitive resource path
Sometimes Visual Studio documents have the root path all in upper case.
Since Godot doesn't support loading resource files with a case insensitive path,
this makes script resource loading to fail when the Godot editor gets code
completion requests from Visual Studio.
This fix allows the resource path part of the path to be case insensitive. It
still doesn't support cases where the rest of the path is also case insensitive.
For that we would need a proper API for comparing paths. However, this fix
should be enough for our current cases.
2020-06-23 21:04:08 +02:00