diff options
Diffstat (limited to 'codegen.php')
-rw-r--r-- | codegen.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/codegen.php b/codegen.php new file mode 100644 index 0000000..a842b32 --- /dev/null +++ b/codegen.php @@ -0,0 +1,23 @@ +<?php + +require_once __DIR__ . "/common.php"; +$cg_dir = SRCDIR . "/codegen"; +foreach (scandir($cg_dir) as $cg_ent) { + $cg_path = $cg_dir . "/" . $cg_ent; + if ( + $cg_ent[0] === "." || + !is_file($cg_path) || + strtolower(pathinfo($cg_ent, PATHINFO_EXTENSION)) !== "php" + ) continue; + echo "[codegen] $cg_ent "; + $data = include $cg_path; + if (!is_array($data) || count($data) !== 2) { + trigger_error( + "Invalid data returned from codegen script '$cg_ent'", + E_USER_WARNING, + ); + continue; + } + echo "-> $data[0]\n"; + file_put_contents(__DIR__ . "/build/" . $data[0], $data[1]); +} |