SamsonGame/gamectl.d/config.php

43 lines
1.1 KiB
PHP
Raw Normal View History

2021-12-29 20:50:11 +03:00
<?php
/**
* @deps autogen
*/
function task_pack_configs()
{
global $GAME_ROOT;
$t = microtime(true);
$all_files = scan_files_rec(array(config_base_dir()), array('js', 'bhl'));
echo "SCAN: " . round(microtime(true) - $t,2) . " sec.\n";
$packed_file = config_get_bundle_ext_path();
$global_changed = need_to_regen($packed_file, config_get_global_deps());
if(need_to_regen($packed_file, $all_files) || $global_changed)
{
//NOTE: on major changes clean bhl caches
//if(taskman_prop('CONF_PACK_BHL'))
//{
// if($global_changed)
// bhl_clean();
//}
$conf_files = config_filter_files($all_files);
sort($conf_files);
$cache_entries = config_fetch_ex($conf_files, $global_changed, $verbose = true);
$t = microtime(true);
$packed_data = config_pack_bundle($cache_entries, taskman_prop('USE_LZ4_CONFIGS'), taskman_prop('USE_CONFIGS_REFS'));
echo "PACK: " . round(microtime(true) - $t,2) . " sec.\n";
ensure_write($packed_file, $packed_data);
//if(taskman_prop('CONF_PACK_BHL'))
// bhl_run(is_dev());
}
config_sync_build_dir_with_prod();
}