Clean up ProjectConverter3To4 architecture, move renames map to separate file

This allows properly limiting what features depend on the RegEx module
(doing the actual conversion) and what features only require the renames
data (GDScript suggestions).

Also better excludes the conversion command line options when actually
disabling deprecated code.

Fixes #73029.
This commit is contained in:
Rémi Verschelde
2023-02-10 09:07:01 +01:00
parent 929ee61170
commit e19e6b09b9
7 changed files with 2070 additions and 1994 deletions
+26 -19
View File
@@ -33,31 +33,36 @@
#ifndef DISABLE_DEPRECATED
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
#include "modules/modules_enabled.gen.h" // For regex.
#ifndef MODULE_REGEX_ENABLED
#include "core/error/error_macros.h"
class ProjectConverter3To4 {
public:
ProjectConverter3To4(int, int) {}
bool validate_conversion() {
ERR_FAIL_V_MSG(false, "Can't validate conversion for Godot 3.x projects, because RegEx module is disabled.");
}
bool convert() {
ERR_FAIL_V_MSG(false, "Can't run converter for Godot 3.x projects, because RegEx module is disabled.");
}
};
#else // Has regex.
#include "core/string/ustring.h"
#include "core/templates/local_vector.h"
#include "core/templates/vector.h"
class RegEx;
class ProjectConverter3To4 {
public:
class RegExContainer;
static const char *enum_renames[][2];
static const char *gdscript_function_renames[][2];
static const char *csharp_function_renames[][2];
static const char *gdscript_properties_renames[][2];
static const char *csharp_properties_renames[][2];
static const char *gdscript_signals_renames[][2];
static const char *csharp_signals_renames[][2];
static const char *project_settings_renames[][2];
static const char *input_map_renames[][2];
static const char *builtin_types_renames[][2];
static const char *shaders_renames[][2];
static const char *class_renames[][2];
static const char *color_renames[][2];
private:
uint64_t maximum_file_size;
uint64_t maximum_line_length;
@@ -108,10 +113,12 @@ private:
public:
ProjectConverter3To4(int, int);
int validate_conversion();
int convert();
bool validate_conversion();
bool convert();
};
#endif // MODULE_REGEX_ENABLED
#endif // DISABLE_DEPRECATED
#endif // PROJECT_CONVERTER_3_TO_4_H