Display the build date in the editor and when starting the engine

This can be used to quickly see how recent a development build is,
without having to look up the commit date manually.
When juggling around with various builds (e.g. for benchmarking),
this can also be used to ensure that you're actually running the
binary you intended to run.

The date stored is the date of the Git commit that is built, not
the current date at the time of building the binary. This ensures
binaries can remain reproducible.

The version timestamp can be accessed using the `timestamp` key
of the `Engine.get_version_info()` return value.
This commit is contained in:
Hugo Locurcio 2022-03-12 02:04:14 +01:00
parent 8f3e2a6113
commit 67e9ccdbc4
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
9 changed files with 69 additions and 7 deletions

View file

@ -30,6 +30,7 @@
#include "editor_bottom_panel.h"
#include "core/os/time.h"
#include "core/version.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_about.h"
@ -253,7 +254,13 @@ EditorBottomPanel::EditorBottomPanel() {
// Fade out the version label to be less prominent, but still readable.
version_btn->set_self_modulate(Color(1, 1, 1, 0.65));
version_btn->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
version_btn->set_tooltip_text(TTR("Click to copy."));
String build_date;
if (VERSION_TIMESTAMP > 0) {
build_date = Time::get_singleton()->get_datetime_string_from_unix_time(VERSION_TIMESTAMP, true) + " UTC";
} else {
build_date = TTR("(unknown)");
}
version_btn->set_tooltip_text(vformat(TTR("Git commit date: %s\nClick to copy the version information."), build_date));
version_btn->connect("pressed", callable_mp(this, &EditorBottomPanel::_version_button_pressed));
version_info_vbox->add_child(version_btn);