2022-10-12 14:21:34 +00:00
|
|
|
def run(target, source, env):
|
|
|
|
src = source[0]
|
|
|
|
dst = target[0]
|
|
|
|
f = open(src, "r", encoding="utf-8")
|
|
|
|
g = open(dst, "w", encoding="utf-8")
|
|
|
|
|
|
|
|
g.write(
|
|
|
|
"""/* THIS FILE IS GENERATED DO NOT EDIT */
|
2022-12-07 11:11:28 +00:00
|
|
|
#ifndef GDEXTENSION_INTERFACE_DUMP_H
|
|
|
|
#define GDEXTENSION_INTERFACE_DUMP_H
|
2022-10-12 14:21:34 +00:00
|
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
|
|
|
|
#include "core/io/file_access.h"
|
|
|
|
#include "core/string/ustring.h"
|
|
|
|
|
2022-12-07 11:11:28 +00:00
|
|
|
class GDExtensionInterfaceDump {
|
2022-10-12 14:21:34 +00:00
|
|
|
private:
|
2022-12-07 11:11:28 +00:00
|
|
|
static constexpr char const *gdextension_interface_dump ="""
|
2022-10-12 14:21:34 +00:00
|
|
|
)
|
|
|
|
for line in f:
|
|
|
|
g.write('"' + line.rstrip().replace('"', '\\"') + '\\n"\n')
|
|
|
|
g.write(";\n")
|
|
|
|
|
|
|
|
g.write(
|
|
|
|
"""
|
|
|
|
public:
|
2022-12-07 11:11:28 +00:00
|
|
|
static void generate_gdextension_interface_file(const String &p_path) {
|
2022-10-12 14:21:34 +00:00
|
|
|
Ref<FileAccess> fa = FileAccess::open(p_path, FileAccess::WRITE);
|
2023-03-08 04:30:37 +00:00
|
|
|
ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path));
|
2022-12-07 11:11:28 +00:00
|
|
|
CharString cs(gdextension_interface_dump);
|
2022-10-12 14:21:34 +00:00
|
|
|
fa->store_buffer((const uint8_t *)cs.ptr(), cs.length());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TOOLS_ENABLED
|
|
|
|
|
2022-12-07 11:11:28 +00:00
|
|
|
#endif // GDEXTENSION_INTERFACE_DUMP_H
|
2022-10-12 14:21:34 +00:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
g.close()
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
from platform_methods import subprocess_main
|
|
|
|
|
|
|
|
subprocess_main(globals())
|