From 6947bed015c33706b9a441fd47cd84f0da99097c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 19 Nov 2017 21:18:01 +0100 Subject: Pass engine name and version parts as proper strings Removes the need for _MKSTR all over the place which has the drawback of converting _MKSTR(UNKNOWN_DEFINE) to "UKNOWN_DEFINE" instead of throwing a compilation error. --- core/engine.cpp | 6 +++--- core/os/os.cpp | 2 +- core/version.h | 6 +++--- editor/doc/doc_data.cpp | 2 +- editor/doc/doc_dump.cpp | 2 +- editor/editor_export.cpp | 2 +- editor/editor_node.cpp | 2 +- editor/export_template_manager.cpp | 2 +- editor/project_manager.cpp | 9 +++------ main/main.cpp | 2 +- methods.py | 10 +++++----- platform/android/export/export.cpp | 2 +- platform/osx/os_osx.mm | 2 +- platform/windows/godot_res.rc | 8 ++++---- platform/windows/os_windows.cpp | 2 +- 15 files changed, 28 insertions(+), 31 deletions(-) diff --git a/core/engine.cpp b/core/engine.cpp index 31abcd62ef..9a3c6248a8 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -84,11 +84,11 @@ Dictionary Engine::get_version_info() const { #else dict["patch"] = 0; #endif - dict["status"] = _MKSTR(VERSION_STATUS); - dict["revision"] = _MKSTR(VERSION_REVISION); + dict["status"] = VERSION_STATUS; + dict["revision"] = VERSION_REVISION; dict["year"] = VERSION_YEAR; - String hash = String(VERSION_HASH); + String hash = VERSION_HASH; dict["hash"] = hash.length() == 0 ? String("unknown") : hash; String stringver = String(dict["major"]) + "." + String(dict["minor"]); diff --git a/core/os/os.cpp b/core/os/os.cpp index 8d050c1c4c..65d0b2e05d 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -279,7 +279,7 @@ String OS::get_safe_application_name() const { String OS::get_godot_dir_name() const { // Default to lowercase, so only override when different case is needed - return String(_MKSTR(VERSION_SHORT_NAME)).to_lower(); + return String(VERSION_SHORT_NAME).to_lower(); } // OS equivalent of XDG_DATA_HOME diff --git a/core/version.h b/core/version.h index 7d2c47df6a..01c251c113 100644 --- a/core/version.h +++ b/core/version.h @@ -30,8 +30,8 @@ #include "version_generated.gen.h" #ifdef VERSION_PATCH -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION) VERSION_MODULE_CONFIG +#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." VERSION_STATUS "." VERSION_REVISION VERSION_MODULE_CONFIG #else -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION) VERSION_MODULE_CONFIG +#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." VERSION_STATUS "." VERSION_REVISION VERSION_MODULE_CONFIG #endif // VERSION_PATCH -#define VERSION_FULL_NAME "" _MKSTR(VERSION_NAME) " v" VERSION_MKSTRING +#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_MKSTRING diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index f7f823c945..1f9884aa70 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -951,7 +951,7 @@ Error DocData::save_classes(const String &p_default_path, const Map"); diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp index 45b7613659..9dd05d9d0f 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -82,7 +82,7 @@ void DocDump::dump(const String &p_file) { FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE); _write_string(f, 0, ""); - _write_string(f, 0, String(""); + _write_string(f, 0, String(""); while (class_list.size()) { diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 6d832fb23b..519bc33d42 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -336,7 +336,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { - String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + VERSION_MODULE_CONFIG; + String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG; String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(current_version).plus_file(template_file_name); if (FileAccess::exists(template_path)) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6b4184f48e..7627fecc43 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -147,7 +147,7 @@ void EditorNode::_update_scene_tabs() { void EditorNode::_update_title() { String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String title = appname.empty() ? String(VERSION_FULL_NAME) : String(_MKSTR(VERSION_NAME) + String(" - ") + appname); + String title = appname.empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname); String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); if (!edited.empty()) title += " - " + String(edited.get_file()); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index cc550ab3d5..d208bbe662 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -67,7 +67,7 @@ void ExportTemplateManager::_update_template_list() { memdelete(d); - String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + VERSION_MODULE_CONFIG; + String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG; Label *current = memnew(Label); current->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index cc9de3e44d..16b85121ef 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -233,7 +233,7 @@ private: fdialog->set_mode(FileDialog::MODE_OPEN_FILE); fdialog->clear_filters(); - fdialog->add_filter("project.godot ; " _MKSTR(VERSION_NAME) " Project"); + fdialog->add_filter("project.godot ; " VERSION_NAME " Project"); } else { fdialog->set_mode(FileDialog::MODE_OPEN_DIR); } @@ -1483,13 +1483,13 @@ ProjectManager::ProjectManager() { String cp; cp.push_back(0xA9); cp.push_back(0); - OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME) + String(" - ") + TTR("Project Manager") + " - " + cp + " 2008-2017 Juan Linietsky, Ariel Manzur & Godot Contributors"); + OS::get_singleton()->set_window_title(VERSION_NAME + String(" - ") + TTR("Project Manager") + " - " + cp + " 2008-2017 Juan Linietsky, Ariel Manzur & Godot Contributors"); HBoxContainer *top_hb = memnew(HBoxContainer); vb->add_child(top_hb); CenterContainer *ccl = memnew(CenterContainer); Label *l = memnew(Label); - l->set_text(_MKSTR(VERSION_NAME) + String(" - ") + TTR("Project Manager")); + l->set_text(VERSION_NAME + String(" - ") + TTR("Project Manager")); ccl->add_child(l); top_hb->add_child(ccl); top_hb->add_spacer(); @@ -1498,11 +1498,8 @@ ProjectManager::ProjectManager() { 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->set_align(Label::ALIGN_CENTER); top_hb->add_child(l); - //vb->add_child(memnew(HSeparator)); - //vb->add_margin_child("\n",memnew(Control)); Control *center_box = memnew(Control); center_box->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/main/main.cpp b/main/main.cpp index f6b11bc3ca..c4bca94b44 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -177,7 +177,7 @@ static String get_full_version_string() { void Main::print_help(const char *p_binary) { - print_line(String(_MKSTR(VERSION_NAME)) + " v" + get_full_version_string() + " - https://godotengine.org"); + print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - https://godotengine.org"); OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n"); OS::get_singleton()->print("\n"); diff --git a/methods.py b/methods.py index c8cc84eb4c..511faf7ec1 100644 --- a/methods.py +++ b/methods.py @@ -1150,7 +1150,7 @@ def build_gles3_headers(target, source, env): def add_module_version_string(self,s): - self.module_version_string+="."+s + self.module_version_string += "." + s def update_version(module_version_string=""): @@ -1162,14 +1162,14 @@ def update_version(module_version_string=""): import version f = open("core/version_generated.gen.h", "w") - f.write("#define VERSION_SHORT_NAME " + str(version.short_name) + "\n") - f.write("#define VERSION_NAME " + str(version.name) + "\n") + f.write("#define VERSION_SHORT_NAME \"" + str(version.short_name) + "\"\n") + f.write("#define VERSION_NAME \"" + str(version.name) + "\"\n") f.write("#define VERSION_MAJOR " + str(version.major) + "\n") f.write("#define VERSION_MINOR " + str(version.minor) + "\n") if (hasattr(version, 'patch')): f.write("#define VERSION_PATCH " + str(version.patch) + "\n") - f.write("#define VERSION_REVISION " + str(rev) + "\n") - f.write("#define VERSION_STATUS " + str(version.status) + "\n") + f.write("#define VERSION_REVISION \"" + str(rev) + "\"\n") + f.write("#define VERSION_STATUS \"" + str(version.status) + "\"\n") f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n") import datetime f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n") diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index c15aa2bd71..e1ff12c5ac 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -370,7 +370,7 @@ class EditorExportAndroid : public EditorExportPlatform { } if (aname == "") { - aname = _MKSTR(VERSION_NAME); + aname = VERSION_NAME; } return aname; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index ec8ec613d3..110cb776ee 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1369,7 +1369,7 @@ String OS_OSX::get_cache_path() const { // Get properly capitalized engine name for system paths String OS_OSX::get_godot_dir_name() const { - return String(_MKSTR(VERSION_SHORT_NAME)).capitalize(); + return String(VERSION_SHORT_NAME).capitalize(); } String OS_OSX::get_system_dir(SystemDir p_dir) const { diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc index b86869d316..7b745f0f97 100644 --- a/platform/windows/godot_res.rc +++ b/platform/windows/godot_res.rc @@ -23,13 +23,13 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Godot Engine" - VALUE "FileDescription", _MKSTR(VERSION_NAME) " Editor" + VALUE "FileDescription", VERSION_NAME " Editor" VALUE "FileVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) - VALUE "ProductName", _MKSTR(VERSION_NAME) + VALUE "ProductName", VERSION_NAME VALUE "Licence", "MIT" VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur" - VALUE "Info", "http://www.godotengine.org" - VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." _MKSTR(VERSION_REVISION) + VALUE "Info", "https://godotengine.org" + VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." VERSION_REVISION END END BLOCK "VarFileInfo" diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 70ac57c7bf..72d51ad62a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2166,7 +2166,7 @@ String OS_Windows::get_cache_path() const { // Get properly capitalized engine name for system paths String OS_Windows::get_godot_dir_name() const { - return String(_MKSTR(VERSION_SHORT_NAME)).capitalize(); + return String(VERSION_SHORT_NAME).capitalize(); } String OS_Windows::get_system_dir(SystemDir p_dir) const { -- cgit v1.2.3 From 3fd23da5ee2e69e1aca663b52ecf1f3d61188a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 19 Nov 2017 21:26:05 +0100 Subject: Rename the version's "revision" to "build" That "revision" was inherited from SVN days but had been since then used to give information about the build: "custom_build", "official", "". It can now be overridden with the BUILD_NAME environment variable. --- core/engine.cpp | 4 ++-- core/version.h | 4 ++-- doc/classes/Engine.xml | 4 ++-- methods.py | 10 +++++----- platform/windows/godot_res.rc | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/engine.cpp b/core/engine.cpp index 9a3c6248a8..53c7a73b43 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -85,7 +85,7 @@ Dictionary Engine::get_version_info() const { dict["patch"] = 0; #endif dict["status"] = VERSION_STATUS; - dict["revision"] = VERSION_REVISION; + dict["build"] = VERSION_BUILD; dict["year"] = VERSION_YEAR; String hash = VERSION_HASH; @@ -94,7 +94,7 @@ Dictionary Engine::get_version_info() const { String stringver = String(dict["major"]) + "." + String(dict["minor"]); if ((int)dict["patch"] != 0) stringver += "." + String(dict["patch"]); - stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; + stringver += "-" + String(dict["status"]) + " (" + String(dict["build"]) + ")"; dict["string"] = stringver; return dict; diff --git a/core/version.h b/core/version.h index 01c251c113..b217d82c5d 100644 --- a/core/version.h +++ b/core/version.h @@ -30,8 +30,8 @@ #include "version_generated.gen.h" #ifdef VERSION_PATCH -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." VERSION_STATUS "." VERSION_REVISION VERSION_MODULE_CONFIG +#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG #else -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." VERSION_STATUS "." VERSION_REVISION VERSION_MODULE_CONFIG +#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG #endif // VERSION_PATCH #define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_MKSTRING diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index f43bbc2e9d..090e0d7910 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -71,8 +71,8 @@ "minor" - Holds the minor version number as a String "patch" - Holds the patch version number as a String "status" - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String - "revision" - Holds the revision (e.g. "custom-build") as a String - "string" - major + minor + patch + status + revision in a single String + "build" - Holds the build name (e.g. "custom-build") as a String + "string" - major + minor + patch + status + build in a single String diff --git a/methods.py b/methods.py index 511faf7ec1..2be73f02d2 100644 --- a/methods.py +++ b/methods.py @@ -1154,11 +1154,11 @@ def add_module_version_string(self,s): def update_version(module_version_string=""): - rev = "custom_build" + build_name = "custom_build" + if (os.getenv("BUILD_NAME") != None): + build_name = os.getenv("BUILD_NAME") + print("Using custom build name: " + build_name) - if (os.getenv("BUILD_REVISION") != None): - rev = os.getenv("BUILD_REVISION") - print("Using custom revision: " + rev) import version f = open("core/version_generated.gen.h", "w") @@ -1168,8 +1168,8 @@ def update_version(module_version_string=""): f.write("#define VERSION_MINOR " + str(version.minor) + "\n") if (hasattr(version, 'patch')): f.write("#define VERSION_PATCH " + str(version.patch) + "\n") - f.write("#define VERSION_REVISION \"" + str(rev) + "\"\n") f.write("#define VERSION_STATUS \"" + str(version.status) + "\"\n") + f.write("#define VERSION_BUILD \"" + str(build_name) + "\"\n") f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n") import datetime f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n") diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc index 7b745f0f97..c535a749c0 100644 --- a/platform/windows/godot_res.rc +++ b/platform/windows/godot_res.rc @@ -29,7 +29,7 @@ BEGIN VALUE "Licence", "MIT" VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur" VALUE "Info", "https://godotengine.org" - VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." VERSION_REVISION + VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." VERSION_BUILD END END BLOCK "VarFileInfo" -- cgit v1.2.3