diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/extension_api_validation/4.2-stable.expected | 16 | ||||
-rw-r--r-- | misc/scripts/dotnet_format.py | 30 | ||||
-rwxr-xr-x | misc/scripts/dotnet_format.sh | 37 |
3 files changed, 46 insertions, 37 deletions
diff --git a/misc/extension_api_validation/4.2-stable.expected b/misc/extension_api_validation/4.2-stable.expected index c0a1e58c62..49e871e203 100644 --- a/misc/extension_api_validation/4.2-stable.expected +++ b/misc/extension_api_validation/4.2-stable.expected @@ -224,3 +224,19 @@ Validate extension JSON: JSON file: Field was added in a way that breaks compati Added a return value for add_bone. Should not affect existing regular use - the return value would just be unused. Compatibility method registered. + + +GH-89024 +-------- +Validate extension JSON: Error: Field 'classes/RichTextLabel/methods/push_meta/arguments': size changed value in new API, from 1 to 2. + +Added optional argument. Compatibility method registered. + + +GH-88081 +-------- +Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_bottom_panel/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_dock/arguments': size changed value in new API, from 2 to 3. + +Added optional argument to add_control_to_bottom_panel and add_control_to_dock to specify a shortcut that toggles the bottom panel/dock's visibility. +Compatibility method registered. diff --git a/misc/scripts/dotnet_format.py b/misc/scripts/dotnet_format.py new file mode 100644 index 0000000000..de414bbe30 --- /dev/null +++ b/misc/scripts/dotnet_format.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import glob +import os +import sys + +# Create dummy generated files. +for path in [ + "modules/mono/SdkPackageVersions.props", +]: + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, "w") as f: + f.write("<Project />") + +# Avoid importing GeneratedIncludes.props. +os.environ["GodotSkipGenerated"] = "true" + +# Match all the input files to their respective C# project. +input_files = [os.path.normpath(x) for x in sys.argv] +projects = { + path: [f for f in sys.argv if os.path.commonpath([f, path]) == path] + for path in [os.path.dirname(f) for f in glob.glob("**/*.csproj", recursive=True)] +} + +# Run dotnet format on all projects with more than 0 modified files. +for path, files in projects.items(): + if len(files) > 0: + command = f"dotnet format {path} --include {' '.join(files)}" + os.system(command) diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh deleted file mode 100755 index e2b4ba5e43..0000000000 --- a/misc/scripts/dotnet_format.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -# This script runs dotnet format on all relevant files in the repo. -# This is the primary script responsible for fixing style violations in C# files. - -set -uo pipefail - -# Create dummy generated files. -echo "<Project />" > modules/mono/SdkPackageVersions.props -mkdir -p modules/mono/glue/GodotSharp/GodotSharp/Generated -echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharp/Generated/GeneratedIncludes.props -mkdir -p modules/mono/glue/GodotSharp/GodotSharpEditor/Generated -echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GeneratedIncludes.props - -# Loops through all C# projects tracked by Git. -git ls-files -- '*.csproj' \ - ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' | -while read -r f; do - # Run dotnet format. - dotnet format "$f" -done - -diff=$(git diff --color) - -# If no diff has been generated all is OK, clean up, and exit. -if [ -z "$diff" ] ; then - printf "\e[1;32m*** Files in this commit comply with the dotnet format style rules.\e[0m\n" - exit 0 -fi - -# A diff has been created, notify the user, clean up, and exit. -printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" -# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' - -printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" -exit 1 |