-
Notifications
You must be signed in to change notification settings - Fork 71
/
gen_sample_output.ps1
executable file
·82 lines (72 loc) · 16.7 KB
/
gen_sample_output.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
$PSDefaultParameterValues['*:Encoding'] = 'UTF-8'
$OutputEncoding = [System.Text.UTF8Encoding]::new()
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
Set-Location $SCRIPT_DIR
$XRESLOADER = Get-ChildItem -Path "../target" -Filter "xresloader-*-jar-with-dependencies.jar" -Name | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if (-Not $XRESLOADER) {
$XRESLOADER = Get-ChildItem -Path "../target" -Filter "*.jar" -Name -Exclude "original-*.jar" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
}
$XRESLOADER = "../target/" + $XRESLOADER
if (!(Test-Path $XRESLOADER)) {
Write-Output "xresloader not found."
exit 0;
}
Write-Output "Using xresloader=$XRESLOADER"
foreach ($proto_dir in "proto_v2", "proto_v3") {
Write-Output "Generate sample data for $proto_dir, one per cmd";
$XLSX_FILE = Get-ChildItem -Name -Filter "*.xlsx" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
& java -client -jar "$XRESLOADER" -t lua -p protobuf -o "$proto_dir" -f "$proto_dir/kind.pb" --pretty 2 -c kind_const.lua ;
& java -client -jar "$XRESLOADER" -t lua -p protobuf -o "$proto_dir" -f "$proto_dir/kind.pb" --pretty 2 --lua-module ProtoEnums.Kind -c kind_const_module.lua ;
& java -client -jar "$XRESLOADER" -t bin -p protobuf -o "$proto_dir" -f "$proto_dir/kind.pb" -s "$XLSX_FILE" -m scheme_kind -a 1.0.0.0 ;
& java -client -jar "$XRESLOADER" -t lua -p protobuf -o "$proto_dir" -f "$proto_dir/kind.pb" --pretty 4 -s "$XLSX_FILE" -m scheme_kind -n '/(?i)\.bin$/\.lua/' --data-version 1.0.0.0 ;
& java -client -jar "$XRESLOADER" -t lua -p protobuf -o "$proto_dir" -f "$proto_dir/kind.pb" --lua-module ProtoData.Kind -s "$XLSX_FILE" -m scheme_kind -n '/(?i)\.bin$/_module\.lua/' --data-version 1.0.0.0 ;
Write-Output "Generate sample data for $proto_dir, batchmode using --stdin";
$TASK_LINES = @(
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -i kind.desc.lua --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t json -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -r kind.desc.json --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t json -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' -m scheme_kind -n '/(?i)\.bin$/\.json/' --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t xml -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' -m scheme_kind -n '/(?i)\.bin$/\.xml/' --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t msgpack -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' -m scheme_kind -n '/(?i)\.bin$/\.msgpack.bin/' --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t js -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -s '$XLSX_FILE' -m scheme_kind -n '/(?i)\.bin$/\.js/' --javascript-global sample.xresloader --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t js -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -m 'DataSource=$XLSX_FILE|kind|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=role_cfg -m OutputFile=role_cfg.n.js -m KeyRow=2 -m KeyCase=lower -m KeyWordSplit=_ -m 'KeyWordRegex=[A-Z_\$ \t\r\n]|[_\$ \t\r\n]|[a-zA-Z_\$]' --javascript-export nodejs --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t js -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -s '$XLSX_FILE' -m scheme_kind -n '/(?i)\.bin$/\.amd\.js/' --javascript-export amd --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=arr_in_arr_cfg.lua -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=arr_in_arr_cfg.bin -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t xml -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=arr_in_arr_cfg.xml -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=arr_in_arr_cfg.hidden.lua --ignore-field-tags server_only -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=arr_in_arr_cfg.hidden.bin --ignore-field-tags server_only -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' --validator-rules custom_validator.yaml -m scheme_upgrade --disable-excel-formular --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t json -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' --validator-rules custom_validator.yaml -m scheme_upgrade -n '/(?i)\.bin$/\.json/' --pretty 2 --disable-excel-formular --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -s '$XLSX_FILE' --validator-rules custom_validator.yaml -m scheme_upgrade -n '/(?i)\.bin$/\.lua/' --pretty 2 --disable-excel-formular --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -i kind_option.lua --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --lua-module ProtoOptions.Kind -i kind_option.mod.lua --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t js -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -i kind_option.js --javascript-export nodejs --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=event_cfg.bin -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=event_cfg.lua -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=event_cfg.hidden.bin --ignore-field-tags server_only -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=event_cfg.hidden.lua --ignore-field-tags server_only -m KeyRow=2 --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' -c KindConst.json --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=ArrInArrCfg.json -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|upgrade_10001|3,1' -m 'DataSource=$XLSX_FILE|upgrade_10002|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=role_upgrade_cfg -m OutputFile=RoleUpgradeCfg.json -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-csv -o '$proto_dir/csv' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|arr_in_arr|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=arr_in_arr_cfg -m OutputFile=ArrInArrCfgRec.csv -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec -m UeCfg-EnableDefaultLoader=false --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-csv -o '$proto_dir/csv' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|upgrade_10001|3,1' -m 'DataSource=$XLSX_FILE|upgrade_10002|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=role_upgrade_cfg -m OutputFile=RoleUpgradeCfgRec.csv -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=EventCfg.json -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec -m UeCfg-IncludeHeader=Engine/CompositeDataTable.h --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-csv -o '$proto_dir/csv' -f '$proto_dir/kind.pb' --validator-rules custom_validator.yaml -m 'DataSource=$XLSX_FILE|test_oneof|3,1' -m 'MacroSource=$XLSX_FILE|macro|2,1' -m ProtoName=event_cfg -m OutputFile=EventCfgRec.csv -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec -m UeCfg-IncludeHeader=Engine/CompositeDataTable.h --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=keep_empty_list_cfg.lua -m KeyRow=2 --list-keep-empty --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=KeepEmptyListCfg.json -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --list-keep-empty --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-csv -o '$proto_dir/csv' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=KeepEmptyListCfg.csv -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --list-keep-empty --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=keep_empty_list_cfg.bin -m KeyRow=2 --list-keep-empty --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' --pretty 2 -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=strip_list_tail_cfg.lua -m KeyRow=2 --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-json -o '$proto_dir/json' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=StripListTailCfg.json -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t ue-csv -o '$proto_dir/csv' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=StripListTailCfg.csv -m KeyRow=2 -m UeCfg-CodeOutput=|Public/ConfigRec|Private/ConfigRec --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
"-t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|keep_or_strip_empty_list|3,1' -m ProtoName=keep_or_strip_empty_list_cfg -m OutputFile=strip_list_tail_cfg.bin -m KeyRow=2 --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
" -t json -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m CallbackScript=cb_script.js -m 'DataSource=$XLSX_FILE|process_by_script1|2,1' -m 'DataSource=$XLSX_FILE|process_by_script2|2,1' -m ProtoName=process_by_script -m OutputFile=process_by_script.json -m KeyRow=1 --pretty 2 --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
" -t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m CallbackScript=cb_script.js -m 'DataSource=$XLSX_FILE|process_by_script1|2,1' -m 'DataSource=$XLSX_FILE|process_by_script2|2,1' -m ProtoName=process_by_script -m OutputFile=process_by_script.bin -m KeyRow=1 --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
" -t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m CallbackScript=cb_script.js -m 'DataSource=$XLSX_FILE|process_by_script1|2,1' -m 'DataSource=$XLSX_FILE|process_by_script2|2,1' -m ProtoName=process_by_script -m OutputFile=process_by_script.lua -m KeyRow=1 --pretty 2 --list-strip-empty-tail --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
" -t bin -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|nest_alias|3,1' -m ProtoName=outer_alias_message -m OutputFile=next_alias.bin -m KeyRow=2 --require-mapping-all --list-keep-empty --enable-alias-mapping --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'",
" -t lua -p protobuf -o '$proto_dir' -f '$proto_dir/kind.pb' -m 'DataSource=$XLSX_FILE|nest_alias|3,1' -m ProtoName=outer_alias_message -m OutputFile=next_alias.lua -m KeyRow=2 --pretty 2 --require-mapping-all --list-keep-empty --enable-alias-mapping --data-source-mapping-mode sha256 --data-source-mapping-file '$proto_dir/data_source_mapping.txt'"
)
Write-Output "Write-Output '$($TASK_LINES -join "`n")' | java `"-Dfile.encoding=UTF-8`" `"-Dlog4j.appender.console.encoding=UTF-8`" -client -jar `"$XRESLOADER`" --stdin --data-version 1.0.0.0"
$TASK_LINES -join "`n" | java "-Dfile.encoding=UTF-8" "-Dlog4j.appender.console.encoding=UTF-8" -client -jar "$XRESLOADER" --stdin --data-version 1.0.0.0
Write-Output "Exit code: $LastExitCode"
}