Commit graph

129 commits

Author SHA1 Message Date
Ignacio Etcheverry 989b93d6a4
Merge pull request #24091 from neikeq/ii
C#: Improve tool script support and fix reloading issues
2018-11-30 21:39:13 +01:00
Ignacio Etcheverry b9b7dcdf00 C#: Improve tool script support and fix reloading issues 2018-11-30 20:43:06 +01:00
Carter Anderson d339824f15 Parse C# generics and type constraints correctly 2018-11-24 18:29:23 -08:00
Ignacio Etcheverry 43e3582058
Merge pull request #23505 from zorbathut/zorbathut/updateproject
Add option for automatic project updating.
2018-11-08 18:06:24 +01:00
Ignacio Etcheverry 0f3fc93070 Fix assertion fail when loading assembly on project export 2018-11-08 16:47:15 +01:00
Ignacio Etcheverry 02d5ff4cd0 Improve the C# API projects generation
- Now there is only one solution that contains both GodotSharp and GodotSharpEditor project. Previously we had one solution for each project
- GodotSharpEditor reference GodotShatp with a 'ProjectReference'. Previously it was a 'Reference' to the assembly
- This also simplifies the command line option to generate this solution: 'godot --generate-cs-api <OutputDir>'
2018-11-08 01:05:22 +01:00
Ben Rog-Wilhelm ff6588569b Add option for automatic project updating. 2018-11-04 09:55:42 -08:00
Ignacio Etcheverry 2cf02f302f Fix C# parsing the full name of base types
Previously it would fail if the type name included its namespace.
2018-10-28 01:31:27 +02:00
Ignacio Etcheverry 1aac95a737 Parse C# script namespace and class
- Added a very simple parser that can extract the namespace and class name of a C# script.
2018-10-25 18:00:24 +02:00
Ignacio Etcheverry c6e2873605 Fix msvc warnings in mono module
- `modules\mono\csharp_script.cpp(576): warning C4099: 'CSharpScriptDepSort': type name first seen using 'class' now seen using 'struct'`
- `modules\mono\signal_awaiter_utils.cpp(144): warning C4003: not enough actual parameters for macro 'ERR_FAIL_V'`
- `modules\mono\editor\net_solution.cpp(101): warning C4129: '%': unrecognized character escape sequence`
- (several) `modules\mono\glue\cs_compressed.gen.h(222): warning C4129: 'E': unrecognized character escape sequence`
2018-10-25 18:00:24 +02:00
Ignacio Etcheverry 92af2e620b Do not generate API project GUIDs randomly 2018-10-25 18:00:24 +02:00
Ignacio Etcheverry 611a476224 Support globs in csproj includes 2018-10-25 18:00:17 +02:00
Ignacio Etcheverry 454b933106 Fix internal assembly load from
- Also make sure we load API assemblies from 'res://.mono/assemblies/'.
2018-10-22 20:35:44 +02:00
Ignacio Etcheverry 6312f18f8e
Merge pull request #23128 from neikeq/bb
Make sure API assemblies are up to date at startup
2018-10-19 00:24:15 +02:00
Ignacio Etcheverry 00f758099b Make sure API assemblies are up to date at startup
- If there is a solution and C# project at startup, make sure API assemblies are up to date.
- Fix prebuilt assemblies only being used when building the game project, and not in other instances.
2018-10-19 00:13:15 +02:00
Ignacio Etcheverry 2adef1e52f Fix prefix erasing for the generated C# enum constants 2018-10-18 20:11:11 +02:00
Ignacio Etcheverry 23ae64b15e C#: Optimize struct marshalling
- We no longer box struct to return them from internal calls.
- Use reinterpret_cast if the managed struct layout is the same as the native struct.
2018-10-17 22:36:26 +02:00
Ignacio Etcheverry eeaa9124af C# API: Hide method bind fields from debugger 2018-10-16 17:22:27 +02:00
Ignacio Etcheverry 3a9b23bcc2 Check if directory exists before trying to delete it 2018-10-08 23:03:58 +02:00
Ignacio Etcheverry c1dad2ae2d C# bindings generator fixes
- Fix unused bool local for MonoBoolean argument.
- Append U to API hashes. Fixes warning: 'integer constant is so large that it is unsigned'
2018-10-07 11:00:05 +02:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Rémi Verschelde aa85b7ed62
Merge pull request #22688 from neikeq/lotsofgoodies
Mono: Editor and export template dependencies and fixes
2018-10-05 16:24:21 +02:00
Ignacio Etcheverry d7ece43b74 Mono: Editor and export template dependencies and fixes
- Bundle editor dependencies:
    - 'GodotSharp': Root data directory for the editor
        - 'Tools': Editor dependencies. Only GodotSharp.dll for now.
        - 'Api': Prebuilt GodotSharp and GodotSharpEditor API assemblies.
        - 'Mono': Mono files to bundle with the editor.
            - 'bin': (Optional, not used for now) Mono bin directory.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
            - 'lib/mono/4.5': Framework assemblies.
    - Added build option to copy the required files from the mono installation to 'GodotSharp/Mono'. Enable with 'copy_mono_root=yes'. Disabled by default.

- Export template dependencies:
    - 'data_AppName'/'data_Godot':
        - 'Mono': Mono files to bundle with the game.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
    - The data directory is generated when compiling and must be bundled with the export templates. In the case of OSX, the data directory must be placed inside the 'osx.zip' export template.
    - In OSX, alternative location for directories (needed for app bundles) are:
        - 'data_AppName/Mono/etc' --> '../Resources/GodotSharp/Mono/etc'
        - 'data_AppName/Mono/lib' --> '../Frameworks/GodotSharp/Mono/lib'

- The editor can bundle prebuilt API assemblies.
    - Generate them with a tools build by running: `--generate-cs-core-api <GodotSharp_OutputDir> --generate-cs-editor-api <GodotSharpEditor_OutputDir> <GodotSharp_OutputDir>/bin/Release/GodotSharp.dll` (This command will be simplified in the future and both projects will be in the same solution)
    - Build the solutions and copy the output files to '#bin/GodotSharp/Api'.
- Fixed API assembly being added twice during the export process.
2018-10-03 19:16:29 +02:00
Ignacio Etcheverry 2c8980f44c Fix GCC compiler warning in mono module
- thread_local.h: 'delegating constructors only available with -std=c++11 or -std=gnu++11'
- mono_reg_utils.cpp: 'extra tokens at end of #endif directive'
- mono_bottom_panel.cpp: '<fieldB> will be initialized after <fieldA> when initialized here'
- bindings_generator.cpp: 'name lookup of 'i' changed (...) matches this 'i' under ISO standard rules (...) matches this 'i' under old rules (...)'
2018-10-03 00:56:28 +02:00
Ignacio Etcheverry e463834a8b Fix missing mono internal call
- Also fixed uninitalized variable in buildscript
2018-09-17 22:54:47 +02:00
Ignacio Etcheverry 50f6dbff87 Mono: Fix opening code editors in OSX and cleanup 2018-09-17 20:00:19 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Ignacio Etcheverry d21c64cc3b C#: Fix cs_files glue mismatch bug 2018-09-12 03:24:08 +02:00
Ignacio Etcheverry e558e1ec09 Fix/workaround for issue #21667
When a Reference managed instance is garbage collected and its finalizer is called, it could happen that the native instance is referenced once again before the finalizer can unreference and memdelete it. The workaround is to create a new managed instance when this happens (at least for now).
2018-09-12 03:24:08 +02:00
Ignacio Etcheverry 61426464ea Add some mono root hint dirs for OSX
Fixes #13355
2018-09-12 03:24:08 +02:00
Ignacio Etcheverry b1356a3590 Cleanup of c# api files and bindings generator
- We no longer generate RID and NodePath C# classes. Both will be maintained manually.
- We no longer generate C# declarations and runtime registration of internal calls for the following classes: RID, NodePath, String, GD, SignalAwaiter and Godot.Object (partial base).
- We no longer auto-generate the base members of Godot.Object. They will be maintained manually as a partial class.

This makes it easier to maintain these C# classes and their internal calls, as well as the bindings generator which no longer generates C# classes that don't derive from Godot Object, and it no longer generates the Godot.Object base members (which where unreadable in the bindings generator code).

- Added missing 'RID(Object from)' constructor to the RID C# class.
- Replaced MONO_GLUE_DISABLED constant macro with MONO_GLUE_ENABLED.
- Add sources in module/mono/glue even if glue is disabled, but surround glue files with ifdef MONO_GLUE_ENABLED.
2018-09-12 03:23:45 +02:00
Ignacio Etcheverry aa2bcf3dfc C# generated classes ignore warning CS1591 and cleanup 2018-08-27 20:39:51 +02:00
exts 035d498af2 Added Collections namespace to Array & Dictionary 2018-08-25 17:19:37 -05:00
Rémi Verschelde de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
Ignacio Etcheverry 7287300433 Mono: Improve C# core files (glue/cs_files) buildsystem
- Search C# files recursively in 'glue/cs_files'.
- Determine a version for the C# core files automatically. The latest modified time will do for now.
2018-08-17 13:51:55 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Ignacio Etcheverry fe28e323b3
Merge pull request #20298 from PJB3005/18-07-20-mono-partial-api-ext
Makes Mono binding classes partial & adds GetNode<T>.
2018-07-25 18:03:57 +02:00
Ignacio Etcheverry 779c9d638e
Merge pull request #15880 from neikeq/better-collections
Mono: Add Dictionary and Array classes
2018-07-23 23:59:04 +02:00
Aaron Franke 69530ef614 [Mono] Update about/warning text
I've removed the section about being unable to export games using C# - as you are now able to do this, as long as the export templates are installed. Also, I've made a few minor grammar tweaks.
2018-07-21 15:26:41 -05:00
Pieter-Jan Briers a8c97eb094 Makes Mono bindings partial & adds GetNode<T>. 2018-07-20 13:55:13 +02:00
Ignacio Etcheverry ee3c476c9a Add Array and Dictionary wrapper classes to C# 2018-07-20 01:44:30 +02:00
Ignacio Etcheverry a731bd5864
Merge pull request #20253 from neikeq/nobranchnameideasfeelsbadman
Make C# bindings generator ignore disabled classes
2018-07-18 21:20:34 +02:00
Ignacio Etcheverry 92c7fe422b Make C# bindings generator ignore disabled classes 2018-07-18 21:15:41 +02:00
Mads Ynddal 39aabba0a9 Added path for Mono installed through Homebrew
On macOS, it is common to install packages like Mono through the third-party
package-manager Homebrew. This commit simply adds an additional path to
where Homebrew installs the Mono framework.
2018-07-10 00:29:05 +02:00
Ignacio Etcheverry 4739cb8c00 Mono: Pending exceptions and cleanup 2018-07-04 03:08:29 +02:00
Kelly Thomas 17516822f9 allow undefined GODOT_DEBUG_MSBUILD environment variable 2018-06-06 22:31:54 +08:00
Ignacio Etcheverry 4a021fa7a2 Mono: Add 'View log' button to open the MSBuild log of a build 2018-06-05 22:21:52 +02:00
Ignacio Etcheverry 25f10b3c40 Mono: Fix passing wrong logger assembly path to MSBuild
- Add option to print MSBuild's stdout and stderr instead of redirecting it. This can be enabled by setting the environment variable: Godot_DEBUG_MSBUILD=1
2018-06-05 22:18:43 +02:00
Michele Valente 6c74f3de6d fixes build error on Linux after its introduction in #18949
The function expects now a return value. Returning NULL seems to work in
this case.
2018-05-17 11:34:05 +02:00
Ignacio Etcheverry 01397a10d9 Mono: Project building fixes
- Set (Csc/Vbc/Fsc)ToolExe environment variables to point to the batch files in Mono's bin directory when building with Mono's MSBuild.
- Set Mono's MSBuild as the default build tool on Windows.
- Generate projects with portable DebugType instead of full.
2018-05-17 01:26:23 +02:00