【特性】新增 --output:tables, --output:include_tables, --output:exclude_tables 用于指定包含或者排除某些表
parent
6bc3552a1f
commit
c2fc86215c
|
|
@ -70,6 +70,12 @@ namespace Luban.Job.Cfg.Defs
|
|||
|
||||
public bool NeedL10nTextTranslate => ExportTextTable != null;
|
||||
|
||||
private HashSet<string> _overrideOutputTables;
|
||||
|
||||
private readonly HashSet<string> _outputIncludeTables = new();
|
||||
|
||||
private readonly HashSet<string> _outputExcludeTables = new();
|
||||
|
||||
public void InitL10n(string textValueFieldName)
|
||||
{
|
||||
ExportTextTable = new TextTable(this, textValueFieldName);
|
||||
|
|
@ -161,7 +167,10 @@ namespace Luban.Job.Cfg.Defs
|
|||
|
||||
public List<DefTable> GetExportTables()
|
||||
{
|
||||
return Types.Values.Where(t => t is DefTable ct && ct.NeedExport).Select(t => (DefTable)t).ToList();
|
||||
return Types.Values.Where(t => t is DefTable ct
|
||||
&& !_outputExcludeTables.Contains(t.FullName)
|
||||
&& (_outputIncludeTables.Contains(t.FullName) || (_overrideOutputTables == null ? ct.NeedExport : _overrideOutputTables.Contains(ct.FullName)))
|
||||
).Select(t => (DefTable)t).ToList();
|
||||
}
|
||||
|
||||
public List<DefTypeBase> GetExportTypes()
|
||||
|
|
@ -210,6 +219,11 @@ namespace Luban.Job.Cfg.Defs
|
|||
return _refGroups.TryGetValue(groupName, out var refGroup) ? refGroup : null;
|
||||
}
|
||||
|
||||
private IEnumerable<string> SplitTableList(string tables)
|
||||
{
|
||||
return tables.Split(',').Select(t => t.Trim());
|
||||
}
|
||||
|
||||
public void Load(Defines defines, IAgent agent, GenArgs args)
|
||||
{
|
||||
LoadCommon(defines, agent, args);
|
||||
|
|
@ -258,6 +272,41 @@ namespace Luban.Job.Cfg.Defs
|
|||
AddCfgTable(table);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(args.OutputTables))
|
||||
{
|
||||
foreach (var tableFullName in SplitTableList(args.OutputTables))
|
||||
{
|
||||
if (GetCfgTable(tableFullName) == null)
|
||||
{
|
||||
throw new Exception($"--output:tables 参数中 table:'{tableFullName}' 不存在");
|
||||
}
|
||||
_overrideOutputTables ??= new HashSet<string>();
|
||||
_overrideOutputTables.Add(tableFullName);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(args.OutputIncludeTables))
|
||||
{
|
||||
foreach (var tableFullName in SplitTableList(args.OutputIncludeTables))
|
||||
{
|
||||
if (GetCfgTable(tableFullName) == null)
|
||||
{
|
||||
throw new Exception($"--output:include_tables 参数中 table:'{tableFullName}' 不存在");
|
||||
}
|
||||
_outputIncludeTables.Add(tableFullName);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(args.OutputExcludeTables))
|
||||
{
|
||||
foreach (var tableFullName in SplitTableList(args.OutputExcludeTables))
|
||||
{
|
||||
if (GetCfgTable(tableFullName) == null)
|
||||
{
|
||||
throw new Exception($"--output:exclude_tables 参数中 table:'{tableFullName}' 不存在");
|
||||
}
|
||||
_outputExcludeTables.Add(tableFullName);
|
||||
}
|
||||
}
|
||||
|
||||
_cfgServices.AddRange(defines.Services);
|
||||
|
||||
foreach (var type in Types.Values)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@ namespace Luban.Job.Cfg
|
|||
[Option("input:convert_data_dir", Required = false, HelpText = "override input data dir with convert data dir")]
|
||||
public string InputConvertDataDir { get; set; }
|
||||
|
||||
[Option("output:tables", Required = false, HelpText = "override tables in export group with this list")]
|
||||
public string OutputTables { get; set; }
|
||||
|
||||
[Option("output:include_tables", Required = false, HelpText = "include tables")]
|
||||
public string OutputIncludeTables { get; set; }
|
||||
|
||||
[Option("output:exclude_tables", Required = false, HelpText = "exclude tables")]
|
||||
public string OutputExcludeTables { get; set; }
|
||||
|
||||
[Option("output:data:resource_list_file", Required = false, HelpText = "output resource list file")]
|
||||
public string OutputDataResourceListFile { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue