layout: restructure into src/ tests/ android/ scripts/ tools/

- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
  (+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
  perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten

No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-29 19:08:19 +09:00
co-authored by Claude Opus 5.5
parent 70710477cf
commit a46093104c
2817 changed files with 13728 additions and 13744 deletions
@@ -2,13 +2,13 @@
"""Generate the empty platform skeleton for mirrored platform-layer headers (docs/PORT-PLAN.md 2A).
platform_stub.py list platform-layer headers in the mirror, with their stub state
platform_stub.py gen [<header>...] [--force] write extension/src/platform/<Lib>/<File>.cpp
platform_stub.py gen [<header>...] [--force] write src/platform/<Lib>/<File>.cpp
(no args: every platform header; never overwrites
without --force, so hand-written implementations stay)
platform_stub.py pending <header> <symbol>... [--ctor]
append stubs of just those members (the linker's
undefined-symbol names, demangled as ld prints them) to the stand-in of a not-yet-ported
logic unit, extension/src/platform/pending/<Lib>/<File>.cpp;
logic unit, src/platform/pending/<Lib>/<File>.cpp;
--ctor adds the class constructor/destructor so the
singleton can exist (its members still default-construct)
@@ -18,7 +18,7 @@
A stub file defines everything the header declares and does not define: non-pure, non-template member
functions, constructors/destructors, free functions, and static data members. Declarations come from
clang's AST of the header's gate translation unit (the library StdAfx.h + the header, with the exact
flags from the macOS gate build's compile_commands.json: `script/port_gate.sh macos` first), dumped per
flags from the macOS gate build's compile_commands.json: `scripts/port_gate.sh macos` first), dumped per
class/function name with -ast-dump-filter. Definitions use trailing return types, so types nested in the
class resolve in class scope, and `decltype(C::x) C::x{}` for static data. Each body is
MT_PLATFORM_STUB() plus a default return (platform/PlatformStub.h); `grep -r MT_PLATFORM_STUB` is the
@@ -45,7 +45,7 @@ import refroot # script directory is on sys.path when run directly
REPO = refroot.repo_root()
PORT = REPO / "extension" / "src" / "port"
PLATFORM = REPO / "extension" / "src" / "platform"
GATE_BUILD = REPO / "build-port-gate" / "macos"
GATE_BUILD = REPO / "build/port-gate" / "macos"
MARK = "platform_stub.py"
COMMENT = re.compile(r"//[^\n]*|/\*.*?\*/", re.S)
@@ -103,7 +103,7 @@ def scan(header: Path) -> tuple[list[str], list[str]]:
def gate_command(rel: str) -> tuple[list[str], str]:
db = GATE_BUILD / "compile_commands.json"
if not db.is_file():
raise SystemExit(f"{db}: missing; run `script/port_gate.sh macos` (it exports compile commands)")
raise SystemExit(f"{db}: missing; run `scripts/port_gate.sh macos` (it exports compile commands)")
tu = re.sub(r"[^A-Za-z0-9_]", "_", rel)
for entry in json.loads(db.read_text()):
if Path(entry["file"]).name == f"{tu}.cpp":
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Copy 40250 sources into the port mirror (extension/src/port/<Lib>/<File>) with mechanical edits only.
"""Copy 40250 sources into the port mirror (src/port/<Lib>/<File>) with mechanical edits only.
port_copy.py copy <rel> [<rel>...] [--force] write the mechanical copy (refuses to overwrite without --force)
port_copy.py diff [<rel>...] show the manual edits: port file vs its mechanical copy
@@ -11,7 +11,7 @@ live in `audit/port-map/<unit path>.json`; functions without an entry count as T
port_map.py show <unit> per-function status of one unit
port_map.py check stale hashes, unknown functions, tag mismatches, layout
Layers: `logic` (ported into extension/src/port/<Lib>/<File>, same names as 40250), `python`
Layers: `logic` (ported into src/port/<Lib>/<File>, same names as 40250), `python`
(the embedded-Python track: Python binding modules, EterPythonLib window system, ScriptLib and the
Python root) and `platform` (Direct3D/Granny/Miles/Win32 rendering, audio and OS plumbing, covered
by adapters). Progress is reported per layer so platform code does not dilute the logic figure.
@@ -35,7 +35,7 @@ STATUSES = ("TODO", "PORTED", "RUN_AS_IS", "ADAPTED", "N_A", "DIVERGENT", "NEEDS
DONE = {"PORTED", "RUN_AS_IS", "ADAPTED", "N_A"}
PY_ROOT = "../../Client/Eternexus/root"
UNIT_DIRS = REFERENCE_DIRS + ("EterBase", "EterPythonLib", "ScriptLib", "SpeedTreeLib", "SphereLib", "EterImageLib")
PORT_DIR = "extension/src/port"
PORT_DIR = "src/port"
LAYERS = ("logic", "python", "platform")
# EterBase units that wrap Win32 file/OS/UI resources. The rest (tea, lzo, cipher, Random, Stl, Timer, Poly/*)
# is plain logic and is ported into the mirror; CRC32 and Utils mix pure helpers with Win32 calls and stay here.
@@ -180,7 +180,7 @@ def layer(unit: str) -> str:
def port_file(unit: str) -> str:
"""Expected implementation path stem for a `logic` unit (`extension/src/port/GameLib/ActorInstance`)."""
"""Expected implementation path stem for a `logic` unit (`src/port/GameLib/ActorInstance`)."""
return f"{PORT_DIR}/{unit.rsplit('.', 1)[0]}"
@@ -300,7 +300,7 @@ def cmd_show(repo: Path, units: dict[str, Path], args) -> int:
def scan_tags(repo: Path) -> dict[str, list[str]]:
tags: dict[str, list[str]] = {}
for base, pattern in (("project", "*.gd"), ("extension/src", "*.[ch]*")):
for base, pattern in (("src", "*.[ch]*"),):
for path in (repo / base).rglob(pattern):
if "/addons/" in path.as_posix():
continue
@@ -3,11 +3,11 @@
stub_constants.py [--check]
The stub modules in extension/src/platform/ScriptLib/GameplayModules.cpp only export names. Their
The stub modules in src/platform/ScriptLib/GameplayModules.cpp only export names. Their
constants are data the root scripts compute with (uiSafebox divides by safebox.SAFEBOX_SLOT_Y_COUNT),
so each stub module gets its 40250 init function's `PyModule_Add{Int,String}Constant` lines verbatim,
with the preprocessor lines around them and the source file's includes, in
extension/src/platform/ScriptLib/GameplayModuleConstants.cpp as `AddStubConstants_<module>(poModule)`.
src/platform/ScriptLib/GameplayModuleConstants.cpp as `AddStubConstants_<module>(poModule)`.
A module that is ported for real drops out of the stub list and out of this file.
The stub functions themselves (`stub_<module>_<Name>` in GameplayModules.cpp) return a zero value of
@@ -26,8 +26,8 @@ import sys
import refroot
REPO = refroot.repo_root()
STUBS = REPO / "extension/src/platform/ScriptLib/GameplayModules.cpp"
OUT = REPO / "extension/src/platform/ScriptLib/GameplayModuleConstants.cpp"
STUBS = REPO / "src/platform/ScriptLib/GameplayModules.cpp"
OUT = REPO / "src/platform/ScriptLib/GameplayModuleConstants.cpp"
INIT = re.compile(r'Py_InitModule\("([A-Za-z_]+)"')
KEEP = re.compile(r'^\s*(PyModule_Add(Int|String)Constant\s*\(|#\s*(if|ifdef|ifndef|elif|else|endif)\b)')
INCLUDE = re.compile(r'^\s*#\s*include\s*"([^"]+)"')
@@ -169,7 +169,7 @@ def generate() -> str:
"// module's init function with the preprocessor lines around them.",
'#include "UserInterface/StdAfx.h"',
]
root = REPO / "extension/src/port"
root = REPO / "src/port"
port = {p.relative_to(root).as_posix().lower(): p.relative_to(root).as_posix() for p in root.rglob("*.h")}
includes, bodies = [], []
for module in modules: