Skip to content

Commit c1b7865

Browse files
committed
Merge pull request #103557 from aaronfranke/godot-version-defines
Rename version defines to `GODOT_VERSION_*` to match GDExtension godot-cpp
2 parents 0cc7e2c + 97ee05e commit c1b7865

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+221
-198
lines changed

core/SCsub

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,17 @@ def version_info_builder(target, source, env):
181181
with methods.generated_wrapper(str(target[0])) as file:
182182
file.write(
183183
"""\
184-
#define VERSION_SHORT_NAME "{short_name}"
185-
#define VERSION_NAME "{name}"
186-
#define VERSION_MAJOR {major}
187-
#define VERSION_MINOR {minor}
188-
#define VERSION_PATCH {patch}
189-
#define VERSION_STATUS "{status}"
190-
#define VERSION_BUILD "{build}"
191-
#define VERSION_MODULE_CONFIG "{module_config}"
192-
#define VERSION_WEBSITE "{website}"
193-
#define VERSION_DOCS_BRANCH "{docs_branch}"
194-
#define VERSION_DOCS_URL "https://docs.godotengine.org/en/" VERSION_DOCS_BRANCH
184+
#define GODOT_VERSION_SHORT_NAME "{short_name}"
185+
#define GODOT_VERSION_NAME "{name}"
186+
#define GODOT_VERSION_MAJOR {major}
187+
#define GODOT_VERSION_MINOR {minor}
188+
#define GODOT_VERSION_PATCH {patch}
189+
#define GODOT_VERSION_STATUS "{status}"
190+
#define GODOT_VERSION_BUILD "{build}"
191+
#define GODOT_VERSION_MODULE_CONFIG "{module_config}"
192+
#define GODOT_VERSION_WEBSITE "{website}"
193+
#define GODOT_VERSION_DOCS_BRANCH "{docs_branch}"
194+
#define GODOT_VERSION_DOCS_URL "https://docs.godotengine.org/en/" GODOT_VERSION_DOCS_BRANCH
195195
""".format(**source[0].read())
196196
)
197197

@@ -210,8 +210,8 @@ def version_hash_builder(target, source, env):
210210
"""\
211211
#include "core/version.h"
212212
213-
const char *const VERSION_HASH = "{git_hash}";
214-
const uint64_t VERSION_TIMESTAMP = {git_timestamp};
213+
const char *const GODOT_VERSION_HASH = "{git_hash}";
214+
const uint64_t GODOT_VERSION_TIMESTAMP = {git_timestamp};
215215
""".format(**source[0].read())
216216
)
217217

core/config/engine.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ double Engine::get_unfrozen_time_scale() const {
125125

126126
Dictionary Engine::get_version_info() const {
127127
Dictionary dict;
128-
dict["major"] = VERSION_MAJOR;
129-
dict["minor"] = VERSION_MINOR;
130-
dict["patch"] = VERSION_PATCH;
131-
dict["hex"] = VERSION_HEX;
132-
dict["status"] = VERSION_STATUS;
133-
dict["build"] = VERSION_BUILD;
134-
135-
String hash = String(VERSION_HASH);
128+
dict["major"] = GODOT_VERSION_MAJOR;
129+
dict["minor"] = GODOT_VERSION_MINOR;
130+
dict["patch"] = GODOT_VERSION_PATCH;
131+
dict["hex"] = GODOT_VERSION_HEX;
132+
dict["status"] = GODOT_VERSION_STATUS;
133+
dict["build"] = GODOT_VERSION_BUILD;
134+
135+
String hash = String(GODOT_VERSION_HASH);
136136
dict["hash"] = hash.is_empty() ? String("unknown") : hash;
137137

138-
dict["timestamp"] = VERSION_TIMESTAMP;
138+
dict["timestamp"] = GODOT_VERSION_TIMESTAMP;
139139

140140
String stringver = String(dict["major"]) + "." + String(dict["minor"]);
141141
if ((int)dict["patch"] != 0) {

core/config/project_settings.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ String ProjectSettings::get_imported_files_path() const {
7777
// This is used by the project manager to provide the initial_settings for config/features.
7878
const PackedStringArray ProjectSettings::get_required_features() {
7979
PackedStringArray features;
80-
features.append(VERSION_BRANCH);
80+
features.append(GODOT_VERSION_BRANCH);
8181
#ifdef REAL_T_IS_DOUBLE
8282
features.append("Double Precision");
8383
#endif
@@ -92,9 +92,9 @@ const PackedStringArray ProjectSettings::_get_supported_features() {
9292
#endif
9393
// Allow pinning to a specific patch number or build type by marking
9494
// them as supported. They're only used if the user adds them manually.
95-
features.append(VERSION_BRANCH "." _MKSTR(VERSION_PATCH));
96-
features.append(VERSION_FULL_CONFIG);
97-
features.append(VERSION_FULL_BUILD);
95+
features.append(GODOT_VERSION_BRANCH "." _MKSTR(GODOT_VERSION_PATCH));
96+
features.append(GODOT_VERSION_FULL_CONFIG);
97+
features.append(GODOT_VERSION_FULL_BUILD);
9898

9999
#ifdef RD_ENABLED
100100
features.append("Forward Plus");

core/extension/extension_api_dump.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
106106
{
107107
//header
108108
Dictionary header;
109-
header["version_major"] = VERSION_MAJOR;
110-
header["version_minor"] = VERSION_MINOR;
111-
#if VERSION_PATCH
112-
header["version_patch"] = VERSION_PATCH;
109+
header["version_major"] = GODOT_VERSION_MAJOR;
110+
header["version_minor"] = GODOT_VERSION_MINOR;
111+
#if GODOT_VERSION_PATCH
112+
header["version_patch"] = GODOT_VERSION_PATCH;
113113
#else
114114
header["version_patch"] = 0;
115115
#endif
116-
header["version_status"] = VERSION_STATUS;
117-
header["version_build"] = VERSION_BUILD;
118-
header["version_full_name"] = VERSION_FULL_NAME;
116+
header["version_status"] = GODOT_VERSION_STATUS;
117+
header["version_build"] = GODOT_VERSION_BUILD;
118+
header["version_full_name"] = GODOT_VERSION_FULL_NAME;
119119

120120
#if REAL_T_IS_DOUBLE
121121
header["precision"] = "double";
@@ -1603,8 +1603,8 @@ Error GDExtensionAPIDump::validate_extension_json_file(const String &p_path) {
16031603
int major = header["version_major"];
16041604
int minor = header["version_minor"];
16051605

1606-
ERR_FAIL_COND_V_MSG(major != VERSION_MAJOR, ERR_INVALID_DATA, vformat("JSON API dump is for a different engine version (%d) than this one (%d)", major, VERSION_MAJOR));
1607-
ERR_FAIL_COND_V_MSG(minor > VERSION_MINOR, ERR_INVALID_DATA, vformat("JSON API dump is for a newer version of the engine: %d.%d", major, minor));
1606+
ERR_FAIL_COND_V_MSG(major != GODOT_VERSION_MAJOR, ERR_INVALID_DATA, vformat("JSON API dump is for a different engine version (%d) than this one (%d)", major, GODOT_VERSION_MAJOR));
1607+
ERR_FAIL_COND_V_MSG(minor > GODOT_VERSION_MINOR, ERR_INVALID_DATA, vformat("JSON API dump is for a newer version of the engine: %d.%d", major, minor));
16081608
}
16091609

16101610
bool failed = false;

core/extension/gdextension_interface.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,23 +243,23 @@ GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name)
243243

244244
#ifndef DISABLE_DEPRECATED
245245
static void gdextension_get_godot_version(GDExtensionGodotVersion *r_godot_version) {
246-
r_godot_version->major = VERSION_MAJOR;
247-
r_godot_version->minor = VERSION_MINOR;
248-
r_godot_version->patch = VERSION_PATCH;
249-
r_godot_version->string = VERSION_FULL_NAME;
246+
r_godot_version->major = GODOT_VERSION_MAJOR;
247+
r_godot_version->minor = GODOT_VERSION_MINOR;
248+
r_godot_version->patch = GODOT_VERSION_PATCH;
249+
r_godot_version->string = GODOT_VERSION_FULL_NAME;
250250
}
251251
#endif
252252

253253
static void gdextension_get_godot_version2(GDExtensionGodotVersion2 *r_godot_version) {
254-
r_godot_version->major = VERSION_MAJOR;
255-
r_godot_version->minor = VERSION_MINOR;
256-
r_godot_version->patch = VERSION_PATCH;
257-
r_godot_version->hex = VERSION_HEX;
258-
r_godot_version->status = VERSION_STATUS;
259-
r_godot_version->build = VERSION_BUILD;
260-
r_godot_version->hash = VERSION_HASH;
261-
r_godot_version->timestamp = VERSION_TIMESTAMP;
262-
r_godot_version->string = VERSION_FULL_NAME;
254+
r_godot_version->major = GODOT_VERSION_MAJOR;
255+
r_godot_version->minor = GODOT_VERSION_MINOR;
256+
r_godot_version->patch = GODOT_VERSION_PATCH;
257+
r_godot_version->hex = GODOT_VERSION_HEX;
258+
r_godot_version->status = GODOT_VERSION_STATUS;
259+
r_godot_version->build = GODOT_VERSION_BUILD;
260+
r_godot_version->hash = GODOT_VERSION_HASH;
261+
r_godot_version->timestamp = GODOT_VERSION_TIMESTAMP;
262+
r_godot_version->string = GODOT_VERSION_FULL_NAME;
263263
}
264264

265265
// Memory Functions

core/extension/gdextension_library_loader.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
307307

308308
bool compatible = true;
309309
// Check version lexicographically.
310-
if (VERSION_MAJOR != compatibility_minimum[0]) {
311-
compatible = VERSION_MAJOR > compatibility_minimum[0];
312-
} else if (VERSION_MINOR != compatibility_minimum[1]) {
313-
compatible = VERSION_MINOR > compatibility_minimum[1];
310+
if (GODOT_VERSION_MAJOR != compatibility_minimum[0]) {
311+
compatible = GODOT_VERSION_MAJOR > compatibility_minimum[0];
312+
} else if (GODOT_VERSION_MINOR != compatibility_minimum[1]) {
313+
compatible = GODOT_VERSION_MINOR > compatibility_minimum[1];
314314
} else {
315-
compatible = VERSION_PATCH >= compatibility_minimum[2];
315+
compatible = GODOT_VERSION_PATCH >= compatibility_minimum[2];
316316
}
317317
if (!compatible) {
318318
ERR_PRINT(vformat("GDExtension only compatible with Godot version %d.%d.%d or later: %s", compatibility_minimum[0], compatibility_minimum[1], compatibility_minimum[2], p_path));
@@ -334,15 +334,15 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
334334
}
335335

336336
compatible = true;
337-
if (VERSION_MAJOR != compatibility_maximum[0]) {
338-
compatible = VERSION_MAJOR < compatibility_maximum[0];
339-
} else if (VERSION_MINOR != compatibility_maximum[1]) {
340-
compatible = VERSION_MINOR < compatibility_maximum[1];
337+
if (GODOT_VERSION_MAJOR != compatibility_maximum[0]) {
338+
compatible = GODOT_VERSION_MAJOR < compatibility_maximum[0];
339+
} else if (GODOT_VERSION_MINOR != compatibility_maximum[1]) {
340+
compatible = GODOT_VERSION_MINOR < compatibility_maximum[1];
341341
}
342-
#if VERSION_PATCH
342+
#if GODOT_VERSION_PATCH
343343
// #if check to avoid -Wtype-limits warning when 0.
344344
else {
345-
compatible = VERSION_PATCH <= compatibility_maximum[2];
345+
compatible = GODOT_VERSION_PATCH <= compatibility_maximum[2];
346346
}
347347
#endif
348348

core/io/file_access_pack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
264264
f->get_32(); // patch number, not used for validation.
265265

266266
ERR_FAIL_COND_V_MSG(version != PACK_FORMAT_VERSION, false, vformat("Pack version unsupported: %d.", version));
267-
ERR_FAIL_COND_V_MSG(ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), false, vformat("Pack created with a newer version of the engine: %d.%d.", ver_major, ver_minor));
267+
ERR_FAIL_COND_V_MSG(ver_major > GODOT_VERSION_MAJOR || (ver_major == GODOT_VERSION_MAJOR && ver_minor > GODOT_VERSION_MINOR), false, vformat("Pack created with a newer version of the engine: %d.%d.", ver_major, ver_minor));
268268

269269
uint32_t pack_flags = f->get_32();
270270
uint64_t file_base = f->get_64();

core/io/http_client_tcp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
196196
// Should it add utf8 encoding?
197197
}
198198
if (add_uagent) {
199-
request += "User-Agent: GodotEngine/" + String(VERSION_FULL_BUILD) + " (" + OS::get_singleton()->get_name() + ")\r\n";
199+
request += "User-Agent: GodotEngine/" + String(GODOT_VERSION_FULL_BUILD) + " (" + OS::get_singleton()->get_name() + ")\r\n";
200200
}
201201
if (add_accept) {
202202
request += "Accept: */*\r\n";

core/io/pck_packer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ Error PCKPacker::pck_start(const String &p_pck_path, int p_alignment, const Stri
9191

9292
file->store_32(PACK_HEADER_MAGIC);
9393
file->store_32(PACK_FORMAT_VERSION);
94-
file->store_32(VERSION_MAJOR);
95-
file->store_32(VERSION_MINOR);
96-
file->store_32(VERSION_PATCH);
94+
file->store_32(GODOT_VERSION_MAJOR);
95+
file->store_32(GODOT_VERSION_MINOR);
96+
file->store_32(GODOT_VERSION_PATCH);
9797

9898
uint32_t pack_flags = 0;
9999
if (enc_dir) {

core/io/resource_format_binary.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,10 +1028,10 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_f, bool p_no_resources, bool p
10281028
print_bl("minor: " + itos(ver_minor));
10291029
print_bl("format: " + itos(ver_format));
10301030

1031-
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
1031+
if (ver_format > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
10321032
f.unref();
10331033
ERR_FAIL_MSG(vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
1034-
local_path, ver_format, ver_major, ver_minor, VERSION_BRANCH));
1034+
local_path, ver_format, ver_major, ver_minor, GODOT_VERSION_BRANCH));
10351035
}
10361036

10371037
type = get_unicode_string();
@@ -1155,7 +1155,7 @@ String ResourceLoaderBinary::recognize(Ref<FileAccess> p_f) {
11551155
f->get_32(); // ver_minor
11561156
uint32_t ver_fmt = f->get_32();
11571157

1158-
if (ver_fmt > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
1158+
if (ver_fmt > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
11591159
f.unref();
11601160
return "";
11611161
}
@@ -1196,7 +1196,7 @@ String ResourceLoaderBinary::recognize_script_class(Ref<FileAccess> p_f) {
11961196
f->get_32(); // ver_minor
11971197
uint32_t ver_fmt = f->get_32();
11981198

1199-
if (ver_fmt > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
1199+
if (ver_fmt > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
12001200
f.unref();
12011201
return "";
12021202
}
@@ -1392,10 +1392,10 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
13921392
return ResourceFormatSaverBinary::singleton->save(res, p_path);
13931393
}
13941394

1395-
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
1395+
if (ver_format > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
13961396
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED,
13971397
vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
1398-
local_path, ver_format, ver_major, ver_minor, VERSION_BRANCH));
1398+
local_path, ver_format, ver_major, ver_minor, GODOT_VERSION_BRANCH));
13991399
}
14001400

14011401
// Since we're not actually converting the file contents, leave the version
@@ -2180,8 +2180,8 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
21802180
}
21812181

21822182
f->store_32(0); //64 bits file, false for now
2183-
f->store_32(VERSION_MAJOR);
2184-
f->store_32(VERSION_MINOR);
2183+
f->store_32(GODOT_VERSION_MAJOR);
2184+
f->store_32(GODOT_VERSION_MINOR);
21852185
f->store_32(FORMAT_VERSION);
21862186

21872187
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
@@ -2444,10 +2444,10 @@ Error ResourceFormatSaverBinaryInstance::set_uid(const String &p_path, ResourceU
24442444
return ERR_UNAVAILABLE;
24452445
}
24462446

2447-
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
2447+
if (ver_format > FORMAT_VERSION || ver_major > GODOT_VERSION_MAJOR) {
24482448
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED,
24492449
vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
2450-
local_path, ver_format, ver_major, ver_minor, VERSION_BRANCH));
2450+
local_path, ver_format, ver_major, ver_minor, GODOT_VERSION_BRANCH));
24512451
}
24522452

24532453
// Since we're not actually converting the file contents, leave the version

0 commit comments

Comments
 (0)