Core: Move generated VERSION_HASH to a .cpp file

This lets us have its definition in `core/version.h` and avoid
rebuilding a handful of files every time the commit hash changes.
This commit is contained in:
Rémi Verschelde 2022-02-08 20:50:37 +01:00
parent 3cb9dc78d6
commit 90162851a7
No known key found for this signature in database
GPG key ID: C3336907360768E1
13 changed files with 26 additions and 43 deletions

View file

@ -36,7 +36,6 @@
#include "core/io/marshalls.h"
#include "core/string/ustring.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
#include "editor/debugger/debug_adapter/debug_adapter_protocol.h"
#include "editor/debugger/editor_network_profiler.h"
#include "editor/debugger/editor_performance_profiler.h"
@ -1543,19 +1542,10 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
const int line_number = file_line_number[1].to_int();
// Construct a GitHub repository URL and open it in the user's default web browser.
if (String(VERSION_HASH).length() >= 1) {
// Git commit hash information available; use it for greater accuracy, including for development versions.
OS::get_singleton()->shell_open(vformat("https://github.com/godotengine/godot/blob/%s/%s#L%d",
VERSION_HASH,
file,
line_number));
} else {
// Git commit hash information unavailable; fall back to tagged releases.
OS::get_singleton()->shell_open(vformat("https://github.com/godotengine/godot/blob/%s-stable/%s#L%d",
VERSION_NUMBER,
file,
line_number));
}
// If the commit hash is available, use it for greater accuracy. Otherwise fall back to tagged release.
String git_ref = String(VERSION_HASH).is_empty() ? String(VERSION_NUMBER) + "-stable" : String(VERSION_HASH);
OS::get_singleton()->shell_open(vformat("https://github.com/godotengine/godot/blob/%s/%s#L%d",
git_ref, file, line_number));
} break;
case ACTION_DELETE_BREAKPOINT: {
const TreeItem *selected = breakpoints_tree->get_selected();