summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/SCsub2
-rw-r--r--modules/gdscript/editor/script_templates/SCsub2
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp8
-rw-r--r--modules/gdscript/gdscript_editor.cpp18
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.gd28
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.out10
-rw-r--r--modules/mbedtls/SCsub3
-rw-r--r--modules/mbedtls/tests/test_crypto_mbedtls.cpp39
-rw-r--r--modules/mbedtls/tests/test_crypto_mbedtls.h31
-rw-r--r--modules/mono/editor/bindings_generator.cpp25
-rw-r--r--modules/mono/editor/script_templates/SCsub2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj2
-rw-r--r--modules/openxr/doc_classes/OpenXRAction.xml2
-rw-r--r--modules/text_server_adv/gdextension_build/methods.py8
-rw-r--r--modules/text_server_fb/gdextension_build/methods.py8
16 files changed, 162 insertions, 28 deletions
diff --git a/modules/SCsub b/modules/SCsub
index 7c9946170f..87c59c3bcc 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -19,7 +19,6 @@ env.CommandNoCache(
Value(env.module_list),
env.Run(
modules_builders.generate_modules_enabled,
- "Generating enabled modules header.",
# NOTE: No need to run in subprocess since this is still executed serially.
subprocess=False,
),
@@ -58,7 +57,6 @@ if env["tests"]:
test_headers,
env.Run(
modules_builders.generate_modules_tests,
- "Generating modules tests header.",
# NOTE: No need to run in subprocess since this is still executed serially.
subprocess=False,
),
diff --git a/modules/gdscript/editor/script_templates/SCsub b/modules/gdscript/editor/script_templates/SCsub
index 2266ef2d01..5db7e3fc3b 100644
--- a/modules/gdscript/editor/script_templates/SCsub
+++ b/modules/gdscript/editor/script_templates/SCsub
@@ -5,7 +5,7 @@ Import("env")
import editor.template_builders as build_template_gd
env["BUILDERS"]["MakeGDTemplateBuilder"] = Builder(
- action=env.Run(build_template_gd.make_templates, "Generating GDScript templates header."),
+ action=env.Run(build_template_gd.make_templates),
suffix=".h",
src_suffix=".gd",
)
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 98d4a19a87..3ec5098c21 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3360,12 +3360,8 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
parser->push_warning(p_call, GDScriptWarning::RETURN_VALUE_DISCARDED, p_call->function_name);
}
- if (method_flags.has_flag(METHOD_FLAG_STATIC) && !is_constructor && !base_type.is_meta_type && !(is_self && static_context)) {
- String caller_type = String(base_type.native_type);
-
- if (caller_type.is_empty()) {
- caller_type = base_type.to_string();
- }
+ if (method_flags.has_flag(METHOD_FLAG_STATIC) && !is_constructor && !base_type.is_meta_type && !is_self) {
+ String caller_type = base_type.to_string();
parser->push_warning(p_call, GDScriptWarning::STATIC_CALLED_ON_INSTANCE, p_call->function_name, caller_type);
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index babd2c1772..12ff22c878 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -828,17 +828,21 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio
return arghint;
}
-static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_list) {
+static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_list, const StringName &p_required_type = StringName()) {
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
+ const bool requires_type = p_required_type;
for (int i = 0; i < p_dir->get_file_count(); i++) {
+ if (requires_type && !ClassDB::is_parent_class(p_dir->get_file_type(i), p_required_type)) {
+ continue;
+ }
ScriptLanguage::CodeCompletionOption option(p_dir->get_file_path(i), ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH);
option.insert_text = option.display.quote(quote_style);
r_list.insert(option.display, option);
}
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
- _get_directory_contents(p_dir->get_subdir(i), r_list);
+ _get_directory_contents(p_dir->get_subdir(i), r_list, p_required_type);
}
}
@@ -2803,6 +2807,16 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
r_result.insert(option.display, option);
}
}
+ if (EDITOR_GET("text_editor/completion/complete_file_paths")) {
+ if (p_argidx == 0 && p_method == SNAME("change_scene_to_file") && ClassDB::is_parent_class(class_name, SNAME("SceneTree"))) {
+ HashMap<String, ScriptLanguage::CodeCompletionOption> list;
+ _get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), list, SNAME("PackedScene"));
+ for (const KeyValue<String, ScriptLanguage::CodeCompletionOption> &key_value_pair : list) {
+ ScriptLanguage::CodeCompletionOption option = key_value_pair.value;
+ r_result.insert(option.display, option);
+ }
+ }
+ }
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
} break;
diff --git a/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.gd b/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.gd
index 29d8501b78..193faab5d0 100644
--- a/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.gd
+++ b/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.gd
@@ -1,11 +1,23 @@
-class Player:
- var x = 3
+class_name TestStaticCalledOnInstance
+
+class Inner:
+ static func static_func():
+ pass
+
+static func static_func():
+ pass
func test():
- # These should not emit a warning.
- var _player = Player.new()
- print(String.num_uint64(8589934592)) # 2 ^ 33
+ print(String.num_uint64(8589934592))
+ var some_string := String()
+ print(some_string.num_uint64(8589934592)) # Warning.
+
+ TestStaticCalledOnInstance.static_func()
+ static_func()
+ self.static_func()
+ var other := TestStaticCalledOnInstance.new()
+ other.static_func() # Warning.
- # This should emit a warning.
- var some_string = String()
- print(some_string.num_uint64(8589934592)) # 2 ^ 33
+ Inner.static_func()
+ var inner := Inner.new()
+ inner.static_func() # Warning.
diff --git a/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.out b/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.out
index 77994ce9ba..c00f3d093a 100644
--- a/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.out
+++ b/modules/gdscript/tests/scripts/parser/warnings/static_called_on_instance.out
@@ -1,7 +1,15 @@
GDTEST_OK
>> WARNING
->> Line: 11
+>> Line: 13
>> STATIC_CALLED_ON_INSTANCE
>> The function "num_uint64()" is a static function but was called from an instance. Instead, it should be directly called from the type: "String.num_uint64()".
+>> WARNING
+>> Line: 19
+>> STATIC_CALLED_ON_INSTANCE
+>> The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "TestStaticCalledOnInstance.static_func()".
+>> WARNING
+>> Line: 23
+>> STATIC_CALLED_ON_INSTANCE
+>> The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "Inner.static_func()".
8589934592
8589934592
diff --git a/modules/mbedtls/SCsub b/modules/mbedtls/SCsub
index 7c1204d2b7..4b8f65d8ff 100644
--- a/modules/mbedtls/SCsub
+++ b/modules/mbedtls/SCsub
@@ -121,6 +121,9 @@ if env["tests"]:
env_mbed_tls.Append(CPPDEFINES=["TESTS_ENABLED"])
env_mbed_tls.add_source_files(module_obj, "./tests/*.cpp")
+ if env["disable_exceptions"]:
+ env_mbed_tls.Append(CPPDEFINES=["DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS"])
+
env.modules_sources += module_obj
# Needed to force rebuilding the module files when the thirdparty library is updated.
diff --git a/modules/mbedtls/tests/test_crypto_mbedtls.cpp b/modules/mbedtls/tests/test_crypto_mbedtls.cpp
index 22d79b79f9..b96a072146 100644
--- a/modules/mbedtls/tests/test_crypto_mbedtls.cpp
+++ b/modules/mbedtls/tests/test_crypto_mbedtls.cpp
@@ -33,6 +33,7 @@
#include "../crypto_mbedtls.h"
#include "tests/test_macros.h"
+#include "tests/test_utils.h"
namespace TestCryptoMbedTLS {
@@ -60,4 +61,42 @@ void hmac_context_digest_test(HashingContext::HashType ht, String expected_hex)
String hex = String::hex_encode_buffer(digest.ptr(), digest.size());
CHECK(hex == expected_hex);
}
+
+Ref<CryptoKey> create_crypto_key(const String &p_key_path, bool p_public_only) {
+ Ref<CryptoKey> crypto_key = Ref<CryptoKey>(CryptoKey::create());
+ crypto_key->load(p_key_path, p_public_only);
+ return crypto_key;
+}
+
+String read_file_s(const String &p_file_path) {
+ Ref<FileAccess> file_access = FileAccess::open(p_file_path, FileAccess::READ);
+ REQUIRE(file_access.is_valid());
+ return file_access->get_as_utf8_string();
+}
+
+bool files_equal(const String &p_in_path, const String &p_out_path) {
+ const String s_in = read_file_s(p_in_path);
+ const String s_out = read_file_s(p_out_path);
+ return s_in == s_out;
+}
+
+void crypto_key_public_only_test(const String &p_key_path, bool p_public_only) {
+ Ref<CryptoKey> crypto_key = create_crypto_key(p_key_path, p_public_only);
+ bool is_equal = crypto_key->is_public_only() == p_public_only;
+ CHECK(is_equal);
+}
+
+void crypto_key_save_test(const String &p_in_path, const String &p_out_path, bool p_public_only) {
+ Ref<CryptoKey> crypto_key = create_crypto_key(p_in_path, p_public_only);
+ crypto_key->save(p_out_path, p_public_only);
+ bool is_equal = files_equal(p_in_path, p_out_path);
+ CHECK(is_equal);
+}
+
+void crypto_key_save_public_only_test(const String &p_in_priv_path, const String &p_in_pub_path, const String &p_out_path) {
+ Ref<CryptoKey> crypto_key = create_crypto_key(p_in_priv_path, false);
+ crypto_key->save(p_out_path, true);
+ bool is_equal = files_equal(p_in_pub_path, p_out_path);
+ CHECK(is_equal);
+}
} // namespace TestCryptoMbedTLS
diff --git a/modules/mbedtls/tests/test_crypto_mbedtls.h b/modules/mbedtls/tests/test_crypto_mbedtls.h
index 0b24925d6b..5ec78d18a3 100644
--- a/modules/mbedtls/tests/test_crypto_mbedtls.h
+++ b/modules/mbedtls/tests/test_crypto_mbedtls.h
@@ -31,9 +31,11 @@
#ifndef TEST_CRYPTO_MBEDTLS_H
#define TEST_CRYPTO_MBEDTLS_H
+#include "core/crypto/crypto.h"
#include "core/crypto/hashing_context.h"
#include "tests/test_macros.h"
+#include "tests/test_utils.h"
namespace TestCryptoMbedTLS {
@@ -56,6 +58,35 @@ TEST_CASE("[HMACContext] HMAC digest") {
// SHA-1
hmac_context_digest_test(HashingContext::HashType::HASH_SHA1, "a0ac4cd68a2f4812c355983d94e8d025afe7dddf");
}
+
+void crypto_key_public_only_test(const String &p_key_path, bool public_only);
+
+TEST_CASE("[Crypto] CryptoKey is_public_only") {
+ crypto_key_public_only_test(TestUtils::get_data_path("crypto/in.key"), false);
+ crypto_key_public_only_test(TestUtils::get_data_path("crypto/in.pub"), true);
+}
+
+void crypto_key_save_test(const String &p_in_path, const String &p_out_path, bool public_only);
+
+TEST_CASE("[Crypto] CryptoKey save") {
+ const String in_priv_path = TestUtils::get_data_path("crypto/in.key");
+ const String out_priv_path = TestUtils::get_data_path("crypto/out.key");
+ crypto_key_save_test(in_priv_path, out_priv_path, false);
+
+ const String in_pub_path = TestUtils::get_data_path("crypto/in.pub");
+ const String out_pub_path = TestUtils::get_data_path("crypto/out.pub");
+ crypto_key_save_test(in_pub_path, out_pub_path, true);
+}
+
+void crypto_key_save_public_only_test(const String &p_in_priv_path, const String &p_in_pub_path, const String &p_out_path);
+
+TEST_CASE("[Crypto] CryptoKey save public_only") {
+ const String in_priv_path = TestUtils::get_data_path("crypto/in.key");
+ const String in_pub_path = TestUtils::get_data_path("crypto/in.pub");
+ const String out_path = TestUtils::get_data_path("crypto/out_public_only.pub");
+ crypto_key_save_public_only_test(in_priv_path, in_pub_path, out_path);
+}
+
} // namespace TestCryptoMbedTLS
#endif // TEST_CRYPTO_MBEDTLS_H
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 0a9162bd28..5cb177676c 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -121,6 +121,10 @@ StringBuilder &operator<<(StringBuilder &r_sb, const char *p_cstring) {
// This must be kept in sync with `ignored_types` in csharp_script.cpp
const Vector<String> ignored_types = {};
+// Special [code] keywords to wrap with <see langword="code"/> instead of <c>code</c>.
+// Don't check against all C# reserved words, as many cases are GDScript-specific.
+const Vector<String> langword_check = { "true", "false", "null" };
+
void BindingsGenerator::TypeInterface::postsetup_enum_type(BindingsGenerator::TypeInterface &r_enum_itype) {
// C interface for enums is the same as that of 'uint32_t'. Remember to apply
// any of the changes done here to the 'uint32_t' type interface as well.
@@ -670,11 +674,24 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "code" || tag.begins_with("code ")) {
- xml_output.append("<c>");
+ int end = bbcode.find("[", brk_end);
+ if (end == -1) {
+ end = bbcode.length();
+ }
+ String code = bbcode.substr(brk_end + 1, end - brk_end - 1);
+ if (langword_check.has(code)) {
+ xml_output.append("<see langword=\"");
+ xml_output.append(code);
+ xml_output.append("\"/>");
- code_tag = true;
- pos = brk_end + 1;
- tag_stack.push_front("code");
+ pos = brk_end + code.length() + 8;
+ } else {
+ xml_output.append("<c>");
+
+ code_tag = true;
+ pos = brk_end + 1;
+ tag_stack.push_front("code");
+ }
} else if (tag == "codeblock" || tag.begins_with("codeblock ")) {
xml_output.append("<code>");
diff --git a/modules/mono/editor/script_templates/SCsub b/modules/mono/editor/script_templates/SCsub
index 39f6cb5c01..01c293c25d 100644
--- a/modules/mono/editor/script_templates/SCsub
+++ b/modules/mono/editor/script_templates/SCsub
@@ -5,7 +5,7 @@ Import("env")
import editor.template_builders as build_template_cs
env["BUILDERS"]["MakeCSharpTemplateBuilder"] = Builder(
- action=env.Run(build_template_cs.make_templates, "Generating C# templates header."),
+ action=env.Run(build_template_cs.make_templates),
suffix=".h",
src_suffix=".cs",
)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
index db16b1fe1d..d54942e654 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
@@ -142,5 +142,5 @@
We can't use wildcards as there may be undesired old files still hanging around.
Fortunately code completion, go to definition and such still work.
-->
- <Import Project="Generated\GeneratedIncludes.props" />
+ <Import Condition=" '$(GodotSkipGenerated)' == '' " Project="Generated\GeneratedIncludes.props" />
</Project>
diff --git a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
index 31e20e4ecd..c32cbcd3d1 100644
--- a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
@@ -44,5 +44,5 @@
We can't use wildcards as there may be undesired old files still hanging around.
Fortunately code completion, go to definition and such still work.
-->
- <Import Project="Generated\GeneratedIncludes.props" />
+ <Import Condition=" '$(GodotSkipGenerated)' == '' " Project="Generated\GeneratedIncludes.props" />
</Project>
diff --git a/modules/openxr/doc_classes/OpenXRAction.xml b/modules/openxr/doc_classes/OpenXRAction.xml
index 6a3529e43e..2a9f255f2f 100644
--- a/modules/openxr/doc_classes/OpenXRAction.xml
+++ b/modules/openxr/doc_classes/OpenXRAction.xml
@@ -4,7 +4,7 @@
An OpenXR action.
</brief_description>
<description>
- This resource defines an OpenXR action. Actions can be used both for inputs (buttons/joystick/trigger/etc) and outputs (haptics).
+ This resource defines an OpenXR action. Actions can be used both for inputs (buttons, joysticks, triggers, etc.) and outputs (haptics).
OpenXR performs automatic conversion between action type and input type whenever possible. An analog trigger bound to a boolean action will thus return [code]false[/code] if the trigger is depressed and [code]true[/code] if pressed fully.
Actions are not directly bound to specific devices, instead OpenXR recognizes a limited number of top level paths that identify devices by usage. We can restrict which devices an action can be bound to by these top level paths. For instance an action that should only be used for hand held controllers can have the top level paths "/user/hand/left" and "/user/hand/right" associated with them. See the [url=https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-reserved]reserved path section in the OpenXR specification[/url] for more info on the top level paths.
Note that the name of the resource is used to register the action with.
diff --git a/modules/text_server_adv/gdextension_build/methods.py b/modules/text_server_adv/gdextension_build/methods.py
index e58bc3abec..327097a3df 100644
--- a/modules/text_server_adv/gdextension_build/methods.py
+++ b/modules/text_server_adv/gdextension_build/methods.py
@@ -42,6 +42,12 @@ def no_verbose(sys, env):
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
+ compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(
+ colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
+ )
+ generated_file_message = "{}Generating {}$TARGET{} ...{}".format(
+ colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
+ )
env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message])
@@ -53,6 +59,8 @@ def no_verbose(sys, env):
env.Append(LINKCOMSTR=[link_program_message])
env.Append(JARCOMSTR=[java_library_message])
env.Append(JAVACCOMSTR=[java_compile_source_message])
+ env.Append(RCCOMSTR=[compiled_resource_message])
+ env.Append(GENCOMSTR=[generated_file_message])
def disable_warnings(self):
diff --git a/modules/text_server_fb/gdextension_build/methods.py b/modules/text_server_fb/gdextension_build/methods.py
index e58bc3abec..327097a3df 100644
--- a/modules/text_server_fb/gdextension_build/methods.py
+++ b/modules/text_server_fb/gdextension_build/methods.py
@@ -42,6 +42,12 @@ def no_verbose(sys, env):
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
+ compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(
+ colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
+ )
+ generated_file_message = "{}Generating {}$TARGET{} ...{}".format(
+ colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
+ )
env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message])
@@ -53,6 +59,8 @@ def no_verbose(sys, env):
env.Append(LINKCOMSTR=[link_program_message])
env.Append(JARCOMSTR=[java_library_message])
env.Append(JAVACCOMSTR=[java_compile_source_message])
+ env.Append(RCCOMSTR=[compiled_resource_message])
+ env.Append(GENCOMSTR=[generated_file_message])
def disable_warnings(self):