Polyphase Game Engine
Loading...
Searching...
No Matches
EngineRuntimeManifest.h
Go to the documentation of this file.
1#pragma once
2
3// EngineRuntimeManifest
4//
5// In-memory representation of the `engine-runtime.json` file that the
6// build system emits next to a shared Polyphase engine runtime
7// (PolyphaseGame.dll / libPolyphaseGame.so). The validator (W3) reads
8// this manifest to decide whether a vendored runtime is compatible with
9// the current source tree.
10//
11// This header is intentionally NOT editor-only (no `#if EDITOR`): the
12// parser/serializer must be reachable from the editor, from CLI / smoke
13// utilities, and from any future headless tool.
14//
15// JSON schema (v1, frozen):
16// {
17// "schemaVersion": 1,
18// "engine": { "name", "version", "versionMajor", "abi",
19// "buildHash", "buildTimestampUtc" },
20// "target": { "platform", "arch", "config" },
21// "addonApiVersion": <uint>,
22// "assetVersion": <uint>,
23// "binary": { "module", "importLib", "debugSymbols",
24// "moduleSha256", "moduleSize" },
25// "requiredExports": [ ... ],
26// "compiler": { "id", "version", "crt" }
27// }
28//
29// Optional binary fields (`importLib`, `debugSymbols`) are encoded as
30// empty strings (`""`) when not applicable. The serializer ALWAYS emits
31// the keys with empty string values rather than omitting them, so the
32// schema shape stays uniform across platforms. The parser accepts both
33// missing keys and empty strings.
34
35#include <cstdint>
36#include <string>
37#include <vector>
38
40{
41 uint32_t schemaVersion = 0;
42
43 std::string engineName;
44 std::string engineVersion; // e.g. "6.2.0-beta.4"
45 uint32_t engineVersionMajor = 0;
46 uint32_t engineAbi = 0;
47 std::string buildHash; // git short SHA or "local"
48 std::string buildTimestampUtc; // ISO-8601
49
50 std::string targetPlatform; // "Windows" | "Linux"
51 std::string targetArch; // "x64"
52 std::string targetConfig; // "Debug" | "Release"
53
54 uint32_t addonApiVersion = 0;
55 uint32_t assetVersion = 0;
56
57 std::string binaryModule; // file name only (e.g. "libPolyphaseGame.so")
58 std::string binaryImportLib; // empty if N/A (Linux .so has no import lib)
59 std::string binaryDebugSymbols; // empty if N/A
60 std::string binaryModuleSha256; // lowercase hex, 64 chars
61 uint64_t binaryModuleSize = 0;
62
63 std::vector<std::string> requiredExports;
64
65 std::string compilerId; // "MSVC" | "GCC" | "Clang"
66 std::string compilerVersion;
67 std::string compilerCrt; // "MultiThreadedDLL" | "libstdc++" | ...
68};
69
70// Parses a JSON document held in memory. Returns false and sets outError
71// to a specific diagnostic on the first missing-required-key or
72// type-mismatch problem encountered. Missing optional keys leave the
73// corresponding `out` field at its default-initialized value.
74bool ParseEngineRuntimeManifestJson(const std::string& json,
76 std::string& outError);
77
78// Reads jsonPath from disk and forwards to ParseEngineRuntimeManifestJson.
79// Returns false (with outError set) on file-not-found or parse failure.
80bool LoadEngineRuntimeManifest(const std::string& jsonPath,
82 std::string& outError);
83
84// Returns a pretty-printed (rapidjson PrettyWriter) JSON document.
85// The output is valid JSON suitable for round-tripping through
86// ParseEngineRuntimeManifestJson.
std::string SerializeEngineRuntimeManifest(const EngineRuntimeManifest &m)
Definition EngineRuntimeManifest.cpp:210
bool LoadEngineRuntimeManifest(const std::string &jsonPath, EngineRuntimeManifest &out, std::string &outError)
Definition EngineRuntimeManifest.cpp:189
bool ParseEngineRuntimeManifestJson(const std::string &json, EngineRuntimeManifest &out, std::string &outError)
Definition EngineRuntimeManifest.cpp:102
Definition EngineRuntimeManifest.h:40
std::string binaryModuleSha256
Definition EngineRuntimeManifest.h:60
uint32_t addonApiVersion
Definition EngineRuntimeManifest.h:54
std::string targetArch
Definition EngineRuntimeManifest.h:51
uint32_t engineAbi
Definition EngineRuntimeManifest.h:46
std::string engineVersion
Definition EngineRuntimeManifest.h:44
std::vector< std::string > requiredExports
Definition EngineRuntimeManifest.h:63
uint32_t assetVersion
Definition EngineRuntimeManifest.h:55
std::string compilerVersion
Definition EngineRuntimeManifest.h:66
uint32_t engineVersionMajor
Definition EngineRuntimeManifest.h:45
std::string binaryModule
Definition EngineRuntimeManifest.h:57
std::string engineName
Definition EngineRuntimeManifest.h:43
std::string binaryDebugSymbols
Definition EngineRuntimeManifest.h:59
std::string binaryImportLib
Definition EngineRuntimeManifest.h:58
std::string compilerCrt
Definition EngineRuntimeManifest.h:67
uint64_t binaryModuleSize
Definition EngineRuntimeManifest.h:61
std::string buildHash
Definition EngineRuntimeManifest.h:47
std::string targetConfig
Definition EngineRuntimeManifest.h:52
std::string compilerId
Definition EngineRuntimeManifest.h:65
uint32_t schemaVersion
Definition EngineRuntimeManifest.h:41
std::string buildTimestampUtc
Definition EngineRuntimeManifest.h:48
std::string targetPlatform
Definition EngineRuntimeManifest.h:50