summaryrefslogtreecommitdiffstats
path: root/modules/mono/build_scripts/build_assemblies.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix mono SDK references temporarilySpartan3222024-10-231-7/+4
| | | | Rebrand dotnet project metadata to reference Redot
* Rebrand Godot 4.3 to RedotTrashguy2024-10-131-1/+1
|
* Update pre-commit hooks configuration to use `ruff` instead of `black`Jakub Marcowski2024-05-211-7/+3
|
* Enforce using .NET SDK >= 8 in modules/mono/Paul Joannon2024-04-231-9/+6
|
* SCons: Ensure `with` statement where applicableThaddeus Crews2024-03-101-2/+0
|
* Enforce `\n` eol for Python writesThaddeus Crews2024-03-091-2/+2
| | | | • Ensure utf-8 encoding if previously unspecified
* Cleanup C# projects, code quality & stylePaul Joannon2024-02-271-2/+4
| | | | | | | | | | | | | | | | | | | | | New rules: - Do not silence CA1805 any more - Limit where we silence CA1707, CA1711, CA1720 - Enforce severity=warning for IDE0040 - Enforce Allman style braces - Enforce naming conventions (IDE1006 is still severity=suggestion) Fixes: - Fix REFL045, CS1572, CS1573 - Suppress CS0618 when generating `InvokeGodotClassMethod` - Fix indent when generating GD_constants.cs - Temporarily silence CS1734 in generated code - Fix a lot of naming rule violations Misc.: - Remove ReSharper comments for RedundantNameQualifier - Remove suppression attributes for RedundantNameQualifier - Remove severity=warnings for CA1716, CA1304 (already included in the level of analysis we run)
* C#: Improve diagnostic messages and add help linkRaul Santos2023-10-171-1/+27
| | | | | - Reword diagnostic messages. - Add help link to diagnostics.
* C#: Automatically generate version definesRedworkDE2023-06-281-1/+15
|
* Rename `float=64` SCons option to `precision=double`Hugo Locurcio2022-12-101-8/+10
| | | | | This avoids confusion with the old `bits=64` option and building for 64-bit CPUs in general.
* .NET: Generate SdkPackageVersions.props from version.pyRémi Verschelde2022-10-051-0/+50
| | | | | | | | | | | | | | | | | Ensures that the versions always match the Godot version, albeit following SemVer 2.0 so inserting a dot between "beta" and the build number. For "stable" status, we omit the suffix as this would be interpreted as a pre-release build too. So we have: | Godot version | Nupkg version | | -------------- | -------------- | | 4.0.0-beta | 4.0.0-beta | | 4.0.0-beta2 | 4.0.0-beta.2 | | 4.0.0-rc1 | 4.0.0-rc.1 | | 4.0.0-stable | 4.0.0 |
* ci: add Python static analysis check via mypyJiri Suchan2022-09-301-5/+3
|
* Make `push_nupkgs_local` absoluteRaul Santos2022-09-161-1/+3
| | | | | | Ensures the `push_nupkgs_local` argument in build_assemblies.py is an absolute path so the argument can be given as a relative path and it will be converted.
* Add float arg to build_assemblies.pyAlmighty Laxz2022-09-041-3/+11
|
* C#: Make GodotSharp API a NuGet packageIgnacio Roldán Etcheverry2022-08-221-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | In the past, the Godot editor distributed the API assemblies and copied them to project directories for projects to reference them. This changed with the move to .NET 5/6. Godot no longer copies the assemblies to project directories. However, the project Sdk still tried to reference them from the same location. From now on, the GodotSharp API is distributed as a NuGet package, which the Sdk can reference. Added an option to `build_assemblies.py` to copy all Godot NuGet packages to an existing local NuGet source. This will be needed during development, while packages are not published to a remote NuGet repository. This option also makes sure to remove packages of the same version installed (~/.nuget/packages). Very useful during development, when packages change, to make sure the package being used by a project is the same we just built and not one from a previous build. A local NuGet source can be created like this: ``` mkdir ~/MyLocalNuGetSource && \ dotnet nuget add source ~/MyLocalNuGetSource/ -n MyLocalNuGetSource ```
* C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry2022-08-221-1/+1
|
* C#: Begin move to .NET CoreIgnacio Roldán Etcheverry2022-08-221-0/+6
| | | | | | | | | | | | 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.
* C#: Move marshaling logic and generated glue to C#Ignacio Roldán Etcheverry2022-08-221-0/+306
We will be progressively moving most code to C#. The plan is to only use Mono's embedding APIs to set things at launch. This will make it much easier to later support CoreCLR too which doesn't have rich embedding APIs. Additionally the code in C# is more maintainable and makes it easier to implement new features, e.g.: runtime codegen which we could use to avoid using reflection for marshaling everytime a field, property or method is accessed. SOME NOTES ON INTEROP We make the same assumptions as GDNative about the size of the Godot structures we use. We take it a bit further by also assuming the layout of fields in some cases, which is riskier but let's us squeeze out some performance by avoiding unnecessary managed to native calls. Code that deals with native structs is less safe than before as there's no RAII and copy constructors in C#. It's like using the GDNative C API directly. One has to take special care to free values they own. Perhaps we could use roslyn analyzers to check this, but I don't know any that uses attributes to determine what's owned or borrowed. As to why we maily use pointers for native structs instead of ref/out: - AFAIK (and confirmed with a benchmark) ref/out are pinned during P/Invoke calls and that has a cost. - Native struct fields can't be ref/out in the first place. - A `using` local can't be passed as ref/out, only `in`. Calling a method or property on an `in` value makes a silent copy, so we want to avoid `in`. REGARDING THE BUILD SYSTEM There's no longer a `mono_glue=yes/no` SCons options. We no longer need to build with `mono_glue=no`, generate the glue and then build again with `mono_glue=yes`. We build only once and generate the glue (which is in C# now). However, SCons no longer builds the C# projects for us. Instead one must run `build_assemblies.py`, e.g.: ```sh %godot_src_root%/modules/mono/build_scripts/build_assemblies.py \ --godot-output-dir=%godot_src_root%/bin \ --godot-target=release_debug` ``` We could turn this into a custom build target, but I don't know how to do that with SCons (it's possible with Meson). OTHER NOTES Most of the moved code doesn't follow the C# naming convention and still has the word Mono in the names despite no longer dealing with Mono's embedding APIs. This is just temporary while transitioning, to make it easier to understand what was moved where.