summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp43
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.h3
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp13
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.h2
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp9
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.h2
-rw-r--r--modules/gdscript/language_server/lsp.hpp35
-rw-r--r--platform/android/export/export.cpp10
-rw-r--r--platform/android/java/app/AndroidManifest.xml7
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/export/export.cpp35
-rw-r--r--platform/osx/os_osx.mm7
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/x11/os_x11.cpp2
14 files changed, 143 insertions, 34 deletions
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index 6db8cb2c88..ae44137fef 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -105,6 +105,40 @@ void ExtendGDScriptParser::update_symbols() {
}
}
+void ExtendGDScriptParser::update_document_links(const String &p_code) {
+ document_links.clear();
+
+ GDScriptTokenizerText tokenizer;
+ FileAccessRef fs = FileAccess::create(FileAccess::ACCESS_RESOURCES);
+ tokenizer.set_code(p_code);
+ while (true) {
+ if (tokenizer.get_token() == GDScriptTokenizer::TK_EOF) {
+ break;
+ } else if (tokenizer.get_token() == GDScriptTokenizer::TK_CONSTANT) {
+ Variant const_val = tokenizer.get_token_constant();
+ if (const_val.get_type() == Variant::STRING) {
+ String path = const_val;
+ bool exists = fs->file_exists(path);
+ if (!exists) {
+ path = get_path().get_base_dir() + "/" + path;
+ exists = fs->file_exists(path);
+ }
+ if (exists) {
+ String value = const_val;
+ lsp::DocumentLink link;
+ link.target = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(path);
+ link.range.start.line = LINE_NUMBER_TO_INDEX(tokenizer.get_token_line());
+ link.range.end.line = link.range.start.line;
+ link.range.end.character = LINE_NUMBER_TO_INDEX(tokenizer.get_token_column());
+ link.range.start.character = link.range.end.character - value.length();
+ document_links.push_back(link);
+ }
+ }
+ }
+ tokenizer.advance();
+ }
+}
+
void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol) {
const String uri = get_uri();
@@ -345,13 +379,13 @@ String ExtendGDScriptParser::marked_documentation(const String &p_bbcode) {
if (block_start != -1) {
code_block_indent = block_start;
in_code_block = true;
- line = "'''gdscript\n";
+ line = "\n";
} else if (in_code_block) {
line = "\t" + line.substr(code_block_indent, line.length());
}
if (in_code_block && line.find("[/codeblock]") != -1) {
- line = "'''\n\n";
+ line = "\n";
in_code_block = false;
}
@@ -572,6 +606,10 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String
return NULL;
}
+const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
+ return document_links;
+}
+
const Array &ExtendGDScriptParser::get_member_completions() {
if (member_completions.empty()) {
@@ -755,5 +793,6 @@ Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) {
Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, NULL, false);
update_diagnostics();
update_symbols();
+ update_document_links(p_code);
return err;
}
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h
index dd0453d3ff..71db78c245 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.h
+++ b/modules/gdscript/language_server/gdscript_extend_parser.h
@@ -56,12 +56,14 @@ class ExtendGDScriptParser : public GDScriptParser {
lsp::DocumentSymbol class_symbol;
Vector<lsp::Diagnostic> diagnostics;
+ List<lsp::DocumentLink> document_links;
ClassMembers members;
HashMap<String, ClassMembers> inner_classes;
void update_diagnostics();
void update_symbols();
+ void update_document_links(const String &p_code);
void parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol);
void parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol);
@@ -93,6 +95,7 @@ public:
const lsp::DocumentSymbol *get_symbol_defined_at_line(int p_line) const;
const lsp::DocumentSymbol *get_member_symbol(const String &p_name, const String &p_subclass = "") const;
+ const List<lsp::DocumentLink> &get_document_links() const;
const Array &get_member_completions();
Dictionary generate_api() const;
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index 7c58c7aa15..f51f3671dd 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -271,8 +271,17 @@ Array GDScriptTextDocument::codeLens(const Dictionary &p_params) {
return arr;
}
-Variant GDScriptTextDocument::documentLink(const Dictionary &p_params) {
- Variant ret;
+Array GDScriptTextDocument::documentLink(const Dictionary &p_params) {
+ Array ret;
+
+ lsp::DocumentLinkParams params;
+ params.load(p_params);
+
+ List<lsp::DocumentLink> links;
+ GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_document_links(params.textDocument.uri, links);
+ for (const List<lsp::DocumentLink>::Element *E = links.front(); E; E = E->next()) {
+ ret.push_back(E->get().to_json());
+ }
return ret;
}
diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h
index d15022d2c4..0b8103f175 100644
--- a/modules/gdscript/language_server/gdscript_text_document.h
+++ b/modules/gdscript/language_server/gdscript_text_document.h
@@ -59,7 +59,7 @@ public:
Dictionary resolve(const Dictionary &p_params);
Array foldingRange(const Dictionary &p_params);
Array codeLens(const Dictionary &p_params);
- Variant documentLink(const Dictionary &p_params);
+ Array documentLink(const Dictionary &p_params);
Array colorPresentation(const Dictionary &p_params);
Variant hover(const Dictionary &p_params);
Array definition(const Dictionary &p_params);
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index 1901daacff..b42464aa8a 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -475,6 +475,15 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
}
}
+void GDScriptWorkspace::resolve_document_links(const String &p_uri, List<lsp::DocumentLink> &r_list) {
+ if (const ExtendGDScriptParser *parser = get_parse_successed_script(get_file_path(p_uri))) {
+ const List<lsp::DocumentLink> &links = parser->get_document_links();
+ for (const List<lsp::DocumentLink>::Element *E = links.front(); E; E = E->next()) {
+ r_list.push_back(E->get());
+ }
+ }
+}
+
Dictionary GDScriptWorkspace::generate_script_api(const String &p_path) {
Dictionary api;
if (const ExtendGDScriptParser *parser = get_parse_successed_script(p_path)) {
diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h
index adce169d4b..23e89ea3f3 100644
--- a/modules/gdscript/language_server/gdscript_workspace.h
+++ b/modules/gdscript/language_server/gdscript_workspace.h
@@ -53,7 +53,6 @@ protected:
ExtendGDScriptParser *get_parse_successed_script(const String &p_path);
ExtendGDScriptParser *get_parse_result(const String &p_path);
- void strip_flat_symbols(const String &p_branch);
void list_script_files(const String &p_root_dir, List<String> &r_files);
public:
@@ -82,6 +81,7 @@ public:
const lsp::DocumentSymbol *resolve_symbol(const lsp::TextDocumentPositionParams &p_doc_pos, const String &p_symbol_name = "", bool p_func_requred = false);
void resolve_related_symbols(const lsp::TextDocumentPositionParams &p_doc_pos, List<const lsp::DocumentSymbol *> &r_list);
+ void resolve_document_links(const String &p_uri, List<lsp::DocumentLink> &r_list);
Dictionary generate_script_api(const String &p_path);
GDScriptWorkspace();
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index 3e57b6ee7e..e60e28cc15 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -199,6 +199,41 @@ struct TextDocumentPositionParams {
}
};
+struct DocumentLinkParams {
+ /**
+ * The document to provide document links for.
+ */
+ TextDocumentIdentifier textDocument;
+
+ _FORCE_INLINE_ void load(const Dictionary &p_params) {
+ textDocument.load(p_params["textDocument"]);
+ }
+};
+
+/**
+ * A document link is a range in a text document that links to an internal or external resource, like another
+ * text document or a web site.
+ */
+struct DocumentLink {
+
+ /**
+ * The range this link applies to.
+ */
+ Range range;
+
+ /**
+ * The uri this link points to. If missing a resolve request is sent later.
+ */
+ DocumentUri target;
+
+ Dictionary to_json() const {
+ Dictionary dict;
+ dict["range"] = range.to_json();
+ dict["target"] = target;
+ return dict;
+ }
+};
+
/**
* A textual edit applicable to a text document.
*/
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 94dffd8a84..b61575e2aa 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1290,7 +1290,7 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/degrees_of_freedom", PROPERTY_HINT_ENUM, "None,3DOF and 6DOF,6DOF"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true));
- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), true));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "custom_package/use_custom_build"), false));
@@ -1875,7 +1875,7 @@ public:
new_file += "<!--CHUNK_" + text + "_BEGIN-->\n";
if (!found) {
- ERR_PRINTS("No end marker found in AndroidManifest.conf for chunk: " + text);
+ ERR_PRINTS("No end marker found in AndroidManifest.xml for chunk: " + text);
f->seek(pos);
} else {
//add chunk lines
@@ -1894,7 +1894,7 @@ public:
String last_tag = "android:icon=\"@drawable/icon\"";
int last_tag_pos = l.find(last_tag);
if (last_tag_pos == -1) {
- WARN_PRINTS("No adding of application tags because could not find last tag for <application: " + last_tag);
+ ERR_PRINTS("Not adding application attributes as the expected tag was not found in '<application': " + last_tag);
new_file += l + "\n";
} else {
String base = l.substr(0, last_tag_pos + last_tag.length());
@@ -1980,9 +1980,9 @@ public:
return ERR_CANT_CREATE;
}
if (p_debug) {
- src_apk = build_path.plus_file("build/outputs/apk/debug/build-debug-unsigned.apk");
+ src_apk = build_path.plus_file("build/outputs/apk/debug/android_debug.apk");
} else {
- src_apk = build_path.plus_file("build/outputs/apk/release/build-release-unsigned.apk");
+ src_apk = build_path.plus_file("build/outputs/apk/release/android_release.apk");
}
if (!FileAccess::exists(src_apk)) {
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index d5f4ba18d6..ba01ec313b 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -26,11 +26,8 @@
<!-- Any tag in this line after android:icon will be erased when doing custom builds. -->
<!-- If you want to add tags manually, do before it. -->
- <application
- android:label="@string/godot_project_name_string"
- android:allowBackup="false"
- tools:ignore="GoogleAppIndexingWarning"
- android:icon="@drawable/icon" >
+ <!-- WARNING: This should stay on a single line until the parsing code is improved. See GH-32414. -->
+ <application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@drawable/icon" >
<!-- The following metadata values are replaced when Godot exports, modifying them here has no effect. -->
<!-- Do these changes in the export preset. Adding new ones is fine. -->
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 0179bf813d..b0661cb4dd 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -574,6 +574,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
}, cursors[p_shape].utf8().get_data());
/* clang-format on */
cursors[p_shape] = "";
+
+ cursors_cache.erase(p_shape);
}
set_cursor_shape(cursor_shape);
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 94090bcdc1..c8ecbd5a2d 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -133,7 +133,9 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
#ifdef OSX_ENABLED
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/identity"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/timestamp"), true));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/hardened_runtime"), true));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements", PROPERTY_HINT_GLOBAL_FILE, "*.plist"), ""));
#endif
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
@@ -360,9 +362,17 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset
Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
List<String> args;
+ if (p_preset->get("codesign/timestamp")) {
+ args.push_back("--timestamp");
+ }
+ if (p_preset->get("codesign/hardened_runtime")) {
+ args.push_back("--options");
+ args.push_back("runtime");
+ }
+
if (p_preset->get("codesign/entitlements") != "") {
/* this should point to our entitlements.plist file that sandboxes our application, I don't know if this should also be placed in our app bundle */
- args.push_back("-entitlements");
+ args.push_back("--entitlements");
args.push_back(p_preset->get("codesign/entitlements"));
}
args.push_back("-s");
@@ -379,6 +389,10 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese
EditorNode::add_io_error("codesign: no identity found");
return FAILED;
}
+ if ((str.find("unrecognized blob type") != -1) || (str.find("cannot read entitlement data") != -1)) {
+ EditorNode::add_io_error("codesign: invalid entitlements file");
+ return FAILED;
+ }
return OK;
}
@@ -386,7 +400,9 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese
Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name) {
List<String> args;
- OS::get_singleton()->move_to_trash(p_dmg_path);
+ if (FileAccess::exists(p_dmg_path)) {
+ OS::get_singleton()->move_to_trash(p_dmg_path);
+ }
args.push_back("create");
args.push_back(p_dmg_path);
@@ -673,19 +689,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
///@TODO we should check the contents of /Contents/Frameworks for frameworks to sign
}
- if (err == OK && identity != "") {
- // we should probably loop through all resources and sign them?
- err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Resources/icon.icns");
- }
-
- if (err == OK && identity != "") {
- err = _code_sign(p_preset, pack_path);
- }
-
- if (err == OK && identity != "") {
- err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Info.plist");
- }
-
// and finally create a DMG
if (err == OK) {
if (ep.step("Making DMG", 3)) {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index f48d4a307d..d30cb1c092 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1973,11 +1973,16 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
[nsimage release];
} else {
// Reset to default system cursor
- cursors[p_shape] = NULL;
+ if (cursors[p_shape] != NULL) {
+ [cursors[p_shape] release];
+ cursors[p_shape] = NULL;
+ }
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index facf5b8d91..81b8d08b3d 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2485,11 +2485,16 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
DeleteObject(bitmap);
} else {
// Reset to default system cursor
- cursors[p_shape] = NULL;
+ if (cursors[p_shape]) {
+ DestroyIcon(cursors[p_shape]);
+ cursors[p_shape] = NULL;
+ }
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 687981f32b..39160ee720 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -2996,6 +2996,8 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
CursorShape c = current_cursor;
current_cursor = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}