Include Git hash in the engine
This commit is contained in:
parent
159b1fc65f
commit
5a9eb5ef58
|
@ -30,6 +30,7 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "version_hash.gen.h"
|
||||||
|
|
||||||
void Engine::set_iterations_per_second(int p_ips) {
|
void Engine::set_iterations_per_second(int p_ips) {
|
||||||
|
|
||||||
|
@ -87,6 +88,9 @@ Dictionary Engine::get_version_info() const {
|
||||||
dict["revision"] = _MKSTR(VERSION_REVISION);
|
dict["revision"] = _MKSTR(VERSION_REVISION);
|
||||||
dict["year"] = VERSION_YEAR;
|
dict["year"] = VERSION_YEAR;
|
||||||
|
|
||||||
|
String hash = String(VERSION_HASH);
|
||||||
|
dict["hash"] = hash.length() == 0 ? String("unknown") : hash;
|
||||||
|
|
||||||
String stringver = String(dict["major"]) + "." + String(dict["minor"]);
|
String stringver = String(dict["major"]) + "." + String(dict["minor"]);
|
||||||
if ((int)dict["patch"] != 0)
|
if ((int)dict["patch"] != 0)
|
||||||
stringver += "." + String(dict["patch"]);
|
stringver += "." + String(dict["patch"]);
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "scene/gui/texture_rect.h"
|
#include "scene/gui/texture_rect.h"
|
||||||
#include "scene/gui/tool_button.h"
|
#include "scene/gui/tool_button.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "version_hash.gen.h"
|
||||||
|
|
||||||
class NewProjectDialog : public ConfirmationDialog {
|
class NewProjectDialog : public ConfirmationDialog {
|
||||||
|
|
||||||
|
@ -1244,7 +1245,10 @@ ProjectManager::ProjectManager() {
|
||||||
top_hb->add_child(ccl);
|
top_hb->add_child(ccl);
|
||||||
top_hb->add_spacer();
|
top_hb->add_spacer();
|
||||||
l = memnew(Label);
|
l = memnew(Label);
|
||||||
l->set_text("v" VERSION_MKSTRING);
|
String hash = String(VERSION_HASH);
|
||||||
|
if (hash.length() != 0)
|
||||||
|
hash = "." + hash.left(7);
|
||||||
|
l->set_text("v" VERSION_MKSTRING "" + hash);
|
||||||
//l->add_font_override("font",get_font("bold","Fonts"));
|
//l->add_font_override("font",get_font("bold","Fonts"));
|
||||||
l->set_align(Label::ALIGN_CENTER);
|
l->set_align(Label::ALIGN_CENTER);
|
||||||
top_hb->add_child(l);
|
top_hb->add_child(l);
|
||||||
|
|
14
methods.py
14
methods.py
|
@ -1176,6 +1176,20 @@ def update_version():
|
||||||
f.write("#define VERSION_STATUS " + str(version.status) + "\n")
|
f.write("#define VERSION_STATUS " + str(version.status) + "\n")
|
||||||
import datetime
|
import datetime
|
||||||
f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n")
|
f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
fhash = open("core/version_hash.gen.h", "wb")
|
||||||
|
githash = ""
|
||||||
|
if os.path.isfile(".git/HEAD"):
|
||||||
|
head = open(".git/HEAD", "rb").readline().strip()
|
||||||
|
if head.startswith("ref: "):
|
||||||
|
head = ".git/" + head[5:]
|
||||||
|
if os.path.isfile(head):
|
||||||
|
githash = open(head, "rb").readline().strip()
|
||||||
|
else:
|
||||||
|
githash = head
|
||||||
|
fhash.write("#define VERSION_HASH \"" + githash + "\"")
|
||||||
|
fhash.close()
|
||||||
|
|
||||||
|
|
||||||
def parse_cg_file(fname, uniforms, sizes, conditionals):
|
def parse_cg_file(fname, uniforms, sizes, conditionals):
|
||||||
|
|
Loading…
Reference in a new issue