|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +import * as path from "node:path"; |
| 4 | +import { execFileSync } from "node:child_process"; |
| 5 | + |
| 6 | +const targets = [ |
| 7 | + ["Belt_HashSetString.res", "hashset.res.cppo", "TYPE_STRING"], |
| 8 | + ["Belt_HashSetString.resi", "hashset.resi.cppo", "TYPE_STRING"], |
| 9 | + ["Belt_HashSetInt.res", "hashset.res.cppo", "TYPE_INT"], |
| 10 | + ["Belt_HashSetInt.resi", "hashset.resi.cppo", "TYPE_INT"], |
| 11 | + ["Belt_HashMapString.res", "hashmap.res.cppo", "TYPE_STRING"], |
| 12 | + ["Belt_HashMapString.resi", "hashmap.resi.cppo", "TYPE_STRING"], |
| 13 | + ["Belt_HashMapInt.res", "hashmap.res.cppo", "TYPE_INT"], |
| 14 | + ["Belt_HashMapInt.resi", "hashmap.resi.cppo", "TYPE_INT"], |
| 15 | + ["Belt_MapString.res", "map.res.cppo", "TYPE_STRING"], |
| 16 | + ["Belt_MapString.resi", "map.resi.cppo", "TYPE_STRING"], |
| 17 | + ["Belt_MapInt.res", "map.res.cppo", "TYPE_INT"], |
| 18 | + ["Belt_MapInt.resi", "map.resi.cppo", "TYPE_INT"], |
| 19 | + ["Belt_SetString.res", "belt_Set.res.cppo", "TYPE_STRING"], |
| 20 | + ["Belt_SetString.resi", "belt_Set.resi.cppo", "TYPE_STRING"], |
| 21 | + ["Belt_SetInt.res", "belt_Set.res.cppo", "TYPE_INT"], |
| 22 | + ["Belt_SetInt.resi", "belt_Set.resi.cppo", "TYPE_INT"], |
| 23 | + ["Belt_MutableMapString.res", "mapm.res.cppo", "TYPE_STRING"], |
| 24 | + ["Belt_MutableMapString.resi", "mapm.resi.cppo", "TYPE_STRING"], |
| 25 | + ["Belt_MutableMapInt.res", "mapm.res.cppo", "TYPE_INT"], |
| 26 | + ["Belt_MutableMapInt.resi", "mapm.resi.cppo", "TYPE_INT"], |
| 27 | + ["Belt_MutableSetString.res", "setm.res.cppo", "TYPE_STRING"], |
| 28 | + ["Belt_MutableSetString.resi", "setm.resi.cppo", "TYPE_STRING"], |
| 29 | + ["Belt_MutableSetInt.res", "setm.res.cppo", "TYPE_INT"], |
| 30 | + ["Belt_MutableSetInt.resi", "setm.resi.cppo", "TYPE_INT"], |
| 31 | + ["Belt_SortArrayString.res", "sort.res.cppo", "TYPE_STRING"], |
| 32 | + ["Belt_SortArrayString.resi", "sort.resi.cppo", "TYPE_STRING"], |
| 33 | + ["Belt_SortArrayInt.res", "sort.res.cppo", "TYPE_INT"], |
| 34 | + ["Belt_SortArrayInt.resi", "sort.resi.cppo", "TYPE_INT"], |
| 35 | + ["Belt_internalMapString.res", "internal_map.res.cppo", "TYPE_STRING"], |
| 36 | + ["Belt_internalMapInt.res", "internal_map.res.cppo", "TYPE_INT"], |
| 37 | + ["Belt_internalSetString.res", "internal_set.res.cppo", "TYPE_STRING"], |
| 38 | + ["Belt_internalSetInt.res", "internal_set.res.cppo", "TYPE_INT"], |
| 39 | +]; |
| 40 | + |
| 41 | +const runtimePath = path.join(import.meta.dirname, ".."); |
| 42 | +for (const [output, input, type] of targets) { |
| 43 | + const inputPath = path.join(runtimePath, "cppo", input); |
| 44 | + const outputPath = path.join(runtimePath, output); |
| 45 | + execFileSync("cppo", ["-n", "-D", type, inputPath, "-o", outputPath], { |
| 46 | + stdio: "inherit", |
| 47 | + }); |
| 48 | +} |
0 commit comments