diff --git a/core/class_db.cpp b/core/class_db.cpp index afcc8de0f23..3c9dae1acb4 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -347,7 +347,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { OBJTYPE_RLOCK; #ifdef DEBUG_METHODS_ENABLED - uint64_t hash = hash_djb2_one_64(HashMapHasherDefault::hash(VERSION_FULL_NAME)); + uint64_t hash = hash_djb2_one_64(HashMapHasherDefault::hash(VERSION_FULL_CONFIG)); List names; diff --git a/core/version.h b/core/version.h index 7a55d69ad7f..d39172865a0 100644 --- a/core/version.h +++ b/core/version.h @@ -30,9 +30,32 @@ #include "version_generated.gen.h" +// Godot versions are of the form . for the initial release, +// and then .. for subsequent bugfix releases where != 0 +// That's arbitrary, but we find it pretty and it's the current policy. + +// Defines the main "branch" version. Patch versions in this branch should be +// forward-compatible. +// Example: "3.1" +#define VERSION_BRANCH "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) #ifdef VERSION_PATCH -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG +// Example: "3.1.4" +#define VERSION_NUMBER "" VERSION_BRANCH "." _MKSTR(VERSION_PATCH) #else -#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG +// Example: "3.1" +#define VERSION_NUMBER "" VERSION_BRANCH #endif // VERSION_PATCH -#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_MKSTRING + +// Describes the full configuration of that Godot version, including the version number, +// the status (beta, stable, etc.) and potential module-specific features (e.g. mono). +// Example: "3.1.4.stable.mono" +#define VERSION_FULL_CONFIG "" VERSION_NUMBER "." VERSION_STATUS VERSION_MODULE_CONFIG + +// Similar to VERSION_FULL_CONFIG, but also includes the (potentially custom) VERSION_BUILD +// description (e.g. official, custom_build, etc.). +// Example: "3.1.4.stable.mono.official" +#define VERSION_FULL_BUILD "" VERSION_FULL_CONFIG "." VERSION_BUILD + +// Same as above, but prepended with Godot's name and a cosmetic "v" for "version". +// Example: "Godot v3.1.4.stable.official.mono" +#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_FULL_BUILD diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 3a418e5f33e..3434aa33f99 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -974,7 +974,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 905732a43fa..adbe23dcd5f 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -83,7 +83,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 c9ac62a74de..c3c16a41ba2 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -337,7 +337,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) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG; + String current_version = VERSION_FULL_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/export_template_manager.cpp b/editor/export_template_manager.cpp index 0363b2eaa3a..aeb1e694442 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -68,7 +68,7 @@ void ExportTemplateManager::_update_template_list() { memdelete(d); - String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG; + String current_version = VERSION_FULL_CONFIG; Label *current = memnew(Label); current->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index b8bf2b97f63..76254187aca 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -30,11 +30,10 @@ #include "asset_library_editor_plugin.h" +#include "core/io/json.h" +#include "core/version.h" #include "editor_node.h" #include "editor_settings.h" -#include "io/json.h" - -#include "version_generated.gen.h" void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost) { @@ -877,7 +876,8 @@ void EditorAssetLibrary::_search(int p_page) { } args += String() + "sort=" + sort_key[sort->get_selected()]; - args += "&godot_version=" + itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR); + // We use the "branch" version, i.e. major.minor, as patch releases should be compatible + args += "&godot_version=" + String(VERSION_BRANCH); String support_list; for (int i = 0; i < SUPPORT_MAX; i++) { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index f51e691be39..295d9439ada 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -244,7 +244,7 @@ void ThemeEditor::_save_template_cbk(String fname) { file->store_line("; "); file->store_line("; ******************* "); file->store_line("; "); - file->store_line("; Template Generated Using: " + String(VERSION_MKSTRING)); + file->store_line("; Template Generated Using: " + String(VERSION_FULL_BUILD)); file->store_line("; "); file->store_line("; "); file->store_line(""); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9c3b09608bd..cfdfb0a3414 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1541,7 +1541,7 @@ ProjectManager::ProjectManager() { String hash = String(VERSION_HASH); if (hash.length() != 0) hash = "." + hash.left(7); - l->set_text("v" VERSION_MKSTRING "" + hash); + l->set_text("v" VERSION_FULL_BUILD "" + hash); l->set_align(Label::ALIGN_CENTER); top_hb->add_child(l); diff --git a/main/main.cpp b/main/main.cpp index 6b43219e59b..4db3f9d974c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -174,7 +174,7 @@ static String get_full_version_string() { String hash = String(VERSION_HASH); if (hash.length() != 0) hash = "." + hash.left(7); - return String(VERSION_MKSTRING) + hash; + return String(VERSION_FULL_BUILD) + hash; } //#define DEBUG_INIT diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc index c535a749c08..f2dca10d55c 100644 --- a/platform/windows/godot_res.rc +++ b/platform/windows/godot_res.rc @@ -3,11 +3,9 @@ #define _STR(m_x) #m_x #define _MKSTR(m_x) _STR(m_x) #endif + #ifndef VERSION_PATCH #define VERSION_PATCH 0 -#define PATCH_STRING -#else -#define PATCH_STRING "." _MKSTR(VERSION_PATCH) #endif GODOT_ICON ICON platform/windows/godot.ico @@ -24,12 +22,12 @@ BEGIN BEGIN VALUE "CompanyName", "Godot Engine" VALUE "FileDescription", VERSION_NAME " Editor" - VALUE "FileVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) + VALUE "FileVersion", VERSION_NUMBER VALUE "ProductName", VERSION_NAME VALUE "Licence", "MIT" - VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur" + VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur and contributors" VALUE "Info", "https://godotengine.org" - VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." VERSION_BUILD + VALUE "ProductVersion", VERSION_FULL_BUILD END END BLOCK "VarFileInfo" diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 3d58aa65f81..ae21775c55d 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -121,7 +121,7 @@ Error HTTPRequest::request(const String &p_url, const Vector &p_custom_h } if (!has_user_agent) { - headers.push_back("User-Agent: GodotEngine/" + String(VERSION_MKSTRING) + " (" + OS::get_singleton()->get_name() + ")"); + headers.push_back("User-Agent: GodotEngine/" + String(VERSION_FULL_BUILD) + " (" + OS::get_singleton()->get_name() + ")"); } if (!has_accept) { diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 91c801c016f..bb5295709a4 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -1506,7 +1506,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r title += "load_steps=" + itos(load_steps) + " "; } title += "format=" + itos(FORMAT_VERSION) + ""; - //title+="engine_version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\""; f->store_string(title); f->store_line("]\n"); //one empty line