diff --git a/bhl.inc.php b/bhl.inc.php index f21d906..f1b31ed 100644 --- a/bhl.inc.php +++ b/bhl.inc.php @@ -12,10 +12,6 @@ task('bhl_clean_cache', function() bhl_clean_cache(); }); -task('bhl_make_upm_package', function() { - bhl_make_upm_package(); -}); - class BhlProj { public static ?BhlProj $active = null; @@ -343,61 +339,3 @@ function _bhl_split_by_namespaces(string $src) : array return $nss; } - -function bhl_upm_path() : string -{ - global $GAME_ROOT; - $pkg_dir = get("UNITY_ASSETS_DIR") . '/../Packages/bhl'; - return $pkg_dir; -} - -function bhl_clean_upm_package() -{ - ensure_rm(bhl_upm_path() . '/Runtime/code/'); -} - -function bhl_make_upm_package() -{ - global $GAME_ROOT; - - $pkg_dir = bhl_upm_path(); - ensure_mkdir($pkg_dir); - - $srcs = array(); - $lines = file(bhl_dir() . '/bhl.cs'); - $started = false; - foreach($lines as $line) - { - if(!$started && strpos($line, 'static readonly string[] VM_SRC = new string[] {') !== false) - { - $started = true; - continue; - } - else if($started && strpos($line, '};') !== false) - break; - else if($started) - { - $mask = trim($line); - $mask = str_replace('$"{BHL_ROOT}/', '', $mask); - $mask = str_replace('",', '', $mask); - $srcs = array_merge($srcs, glob(bhl_dir() . '/' . $mask)); - } - } - - $trgs = array(); - $changed = false; - foreach($srcs as $src) - { - $trg = $pkg_dir . '/Runtime/code/' . str_replace(bhl_dir(), '', $src); - if(!is_file($trg) || file_get_contents($src) != file_get_contents($trg)) - $changed = true; - $trgs[$src] = $trg; - } - - if($changed) - { - bhl_clean_upm_package(); - foreach($trgs as $src => $trg) - ensure_copy($src, $trg); - } -}