Splitting one huge output autobind file to many files presumed to be stored under non VCS directory
Publish PHP Package / docker (push) Successful in 7s
Details
Publish PHP Package / docker (push) Successful in 7s
Details
This commit is contained in:
parent
169cd07aaf
commit
eb85f63437
|
@ -29,7 +29,7 @@ function codegen(
|
|||
$tpl_cache_dir,
|
||||
\mtgMetaInfo $meta,
|
||||
array $options = array()
|
||||
)
|
||||
) : array
|
||||
{
|
||||
validate_meta($meta);
|
||||
|
||||
|
@ -57,14 +57,30 @@ function codegen(
|
|||
|
||||
$twig->addGlobal('plugins', $options['plugins']);
|
||||
|
||||
$str = $twig->render('codegen_autobind.twig', $options);
|
||||
$sliced_units = slice_units($meta->getUnits(), 20);
|
||||
$options['sliced_units'] = $sliced_units;
|
||||
|
||||
$output = array();
|
||||
|
||||
$output['types.cs'] = $twig->render('codegen_types.twig', $options);
|
||||
$output['decl_units.cs'] = $twig->render('codegen_decl_units.twig', $options);
|
||||
|
||||
foreach($sliced_units as $slice_idx => $slice_units)
|
||||
{
|
||||
$slice_options = $options;
|
||||
$slice_options['slice_idx'] = $slice_idx;
|
||||
$slice_options['slice_units'] = $slice_units;
|
||||
$output['register_'.$slice_idx.'.cs'] = $twig->render('codegen_register_slice.twig', $slice_options);
|
||||
}
|
||||
|
||||
$output['register.cs'] = $twig->render('codegen_register.twig', $options);
|
||||
|
||||
print_warnings();
|
||||
|
||||
return $str;
|
||||
return $output;
|
||||
}
|
||||
|
||||
function get_twig(array $inc_path = [])
|
||||
function get_twig(array $inc_path = []) : \Twig\Environment
|
||||
{
|
||||
array_unshift($inc_path, __DIR__ . "/../tpl/");
|
||||
$loader = new \Twig\Loader\FilesystemLoader($inc_path);
|
||||
|
|
|
@ -917,21 +917,6 @@ public partial class Script_{{u.object.name}} {
|
|||
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro call_reg_units(sliced_units) ~%}
|
||||
{%- for idx,units in sliced_units -%}
|
||||
Register_{{idx}}(types);
|
||||
{%~ endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro decl_reg_units(sliced_units) ~%}
|
||||
{%- for idx,units in sliced_units -%}
|
||||
public static void Register_{{idx}}(Types types)
|
||||
{
|
||||
{{ _self.reg_units(units) }}
|
||||
}
|
||||
{%~ endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro reg_units(units) ~%}
|
||||
|
||||
{%- for u in units -%}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#pragma warning disable CS0162
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using bhl;
|
||||
#if !BHL_FRONT
|
||||
{%- for imp in imports ~%}
|
||||
using {{imp}};
|
||||
{%- endfor ~%}
|
||||
#endif
|
||||
using Types = bhl.Types;
|
||||
|
||||
{% import "bhl_bind_macro.twig" as macro %}
|
||||
|
||||
namespace {{namespace}} {
|
||||
|
||||
#if !BHL_FRONT
|
||||
|
||||
{{ macro.decl_units(meta.units) }}
|
||||
|
||||
{{ plugins_codegen_decls() }}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ using bhl;
|
|||
using {{imp}};
|
||||
{%- endfor ~%}
|
||||
#endif
|
||||
using Types = bhl.Types;
|
||||
|
||||
{{custom_code}}
|
||||
|
||||
|
@ -16,23 +17,7 @@ using {{imp}};
|
|||
|
||||
namespace {{namespace}} {
|
||||
|
||||
{%- for u in meta.units ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') or u.object is instanceof('\\mtgMetaInterface') ~%}
|
||||
static public class Types_{{u.object.name|norm_name}} {
|
||||
static public IType Value;
|
||||
}
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
|
||||
#if !BHL_FRONT
|
||||
|
||||
{{ macro.decl_units(meta.units) }}
|
||||
|
||||
{{ plugins_codegen_decls() }}
|
||||
|
||||
#endif
|
||||
|
||||
static public class {{register_class}} {
|
||||
static public partial class {{register_class}} {
|
||||
|
||||
{%- for mk,mv in get_modules(meta) ~%}
|
||||
static public Module Module{{mv}};
|
||||
|
@ -55,7 +40,9 @@ public static void RegisterBegin(Types types)
|
|||
types.RegisterModule(Module{{mv}});
|
||||
{%- endfor ~%}
|
||||
|
||||
{{ macro.call_reg_units(slice_units(meta.units, 20)) }}
|
||||
{%- for idx,units in sliced_units -%}
|
||||
Register_{{idx}}(types);
|
||||
{%~ endfor -%}
|
||||
}
|
||||
|
||||
public static void RegisterEnd(Types types)
|
||||
|
@ -63,8 +50,6 @@ public static void RegisterEnd(Types types)
|
|||
{{ macro.setup_global_types(meta.units) }}
|
||||
}
|
||||
|
||||
{{ macro.decl_reg_units(slice_units(meta.units, 20)) }}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#pragma warning disable CS0162
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using bhl;
|
||||
#if !BHL_FRONT
|
||||
{%- for imp in imports ~%}
|
||||
using {{imp}};
|
||||
{%- endfor ~%}
|
||||
#endif
|
||||
using Types = bhl.Types;
|
||||
|
||||
{% import "bhl_bind_macro.twig" as macro %}
|
||||
|
||||
namespace {{namespace}} {
|
||||
|
||||
static public partial class {{register_class}} {
|
||||
|
||||
public static void Register_{{slice_idx}}(Types types)
|
||||
{
|
||||
{{ macro.reg_units(slice_units) }}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#pragma warning disable CS0162
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using bhl;
|
||||
#if !BHL_FRONT
|
||||
{%- for imp in imports ~%}
|
||||
using {{imp}};
|
||||
{%- endfor ~%}
|
||||
#endif
|
||||
using Types = bhl.Types;
|
||||
|
||||
namespace {{namespace}} {
|
||||
|
||||
{%- for u in meta.units ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaStruct') or u.object is instanceof('\\mtgMetaInterface') ~%}
|
||||
static public class Types_{{u.object.name|norm_name}} {
|
||||
static public IType Value;
|
||||
}
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
|
||||
}
|
Loading…
Reference in New Issue