Skip to content

Commit e74f398

Browse files
committed
Improve fileref file
1 parent b7acfdd commit e74f398

8 files changed

Lines changed: 16 additions & 11 deletions

File tree

schemas

Submodule schemas updated 40 files

src/TL_file_ref_map_schema.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
"type": "Vector t"
2626
},
2727
{
28-
"id": "1304071212",
28+
"id": "679692403",
2929
"predicate": "fileReferenceMap",
3030
"params": [
31+
{
32+
"name": "layer",
33+
"type": "int"
34+
},
3135
{
3236
"name": "db_schema",
3337
"type": "string"

src/TL_file_ref_map_schema.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ true#3fedd339 = True;
55
vector#1cb5c415 {t:Type} # [ t ] = Vector t;
66

77
// Root
8-
fileReferenceMap#4dba8c2c db_schema:string db_schema_json:string locations:Vector<Location> sources:Vector<Source> skipped:Vector<SkippedSource> actions:Vector<Action> = FileReferenceMap;
8+
fileReferenceMap#28834873 layer:int db_schema:string db_schema_json:string locations:Vector<Location> sources:Vector<Source> skipped:Vector<SkippedSource> actions:Vector<Action> = FileReferenceMap;
99

1010
locationIncoming#e18770f4 predicate:string stored_constructor:string = Location;
1111
locationOutgoing#e7740ae0 predicate:string stored_constructor:string = Location;

src/file_ref_map.dat

4 Bytes
Binary file not shown.

src/file_ref_map.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tools/FileRefExtractor/BuildMode/Ast.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function crc(string $schema): string
5858
return $id;
5959
}
6060

61-
public function finalize(array $outgoingCons, array $incomingCons, string $refMapFile, string $refMapFileJson): void
61+
public function finalize(int $layer, array $outgoingCons, array $incomingCons, string $refMapFile, string $refMapFileJson): void
6262
{
6363
$locations = [];
6464

@@ -103,6 +103,7 @@ public function finalize(array $outgoingCons, array $incomingCons, string $refMa
103103
}
104104
$value = [
105105
'_' => 'fileReferenceMap',
106+
'layer' => $layer,
106107
'db_schema' => $dbSchema,
107108
'db_schema_json' => json_encode($dbSchemaJSON, flags: JSON_THROW_ON_ERROR),
108109
'locations' => $locations,

tools/FileRefExtractor/FileRefGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
final class FileRefGenerator
4444
{
45-
public static function generate(int|string $layer, string $inputSchema, string $outputFile, string $outputFileJson): void
45+
public static function generate(int $layer, string $inputSchema, string $outputFile, string $outputFileJson): void
4646
{
4747
Magic::start(false);
4848
$schema = new TLSchema;
@@ -680,7 +680,7 @@ static function (array $stack) use ($locations, $TL, $tmp, &$traversalPairs, &$v
680680
}
681681
}
682682

683-
$output->finalize(array_filter($outgoingCons), $incomingCons, $outputFile, $outputFileJson);
683+
$output->finalize($layer, array_filter($outgoingCons), $incomingCons, $outputFile, $outputFileJson);
684684

685685
echo("OK $layer!\n".PHP_EOL);
686686
}

tools/gen_filerefmap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ function generate(int $layer, string $schema): void
6464
}
6565

6666
if (isset($argv[1])) {
67-
if (count($argv) < 4) {
68-
die("Usage:\n{$argv[0]} <inputSchema> <output> <outputJson>\nOR\n{$argv[0]} (no args, uses schemas in schemas folder)\n");
67+
if (count($argv) < 5) {
68+
die("Usage:\n{$argv[0]} <layer> <inputSchema> <output> <outputJson>\nOR\n{$argv[0]} (no args, uses schemas in schemas folder)\n");
6969
}
7070

7171
FileRefGenerator::generate(
72-
$argv[1],
73-
$argv[1],
72+
(int)$argv[1],
7473
$argv[2],
7574
$argv[3],
75+
$argv[4],
7676
);
7777
die;
7878
}

0 commit comments

Comments
 (0)