Compare commits
No commits in common. "master" and "v1.0.1" have entirely different histories.
|
@ -1,29 +0,0 @@
|
||||||
|
|
||||||
name: Publish PHP Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Get tag name
|
|
||||||
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: zip and send
|
|
||||||
run: |
|
|
||||||
ls -la
|
|
||||||
apt-get update -y
|
|
||||||
apt-get install -y zip
|
|
||||||
cd ../
|
|
||||||
zip -r ${{ gitea.event.repository.name }}.zip ${{ gitea.event.repository.name }} -x '*.git*'
|
|
||||||
curl -v \
|
|
||||||
--user composer-pbl:${{ secrets.COMPOSER_PSWD }} \
|
|
||||||
--upload-file ${{ gitea.event.repository.name }}.zip \
|
|
||||||
https://git.bit5.ru/api/packages/bit/composer?version=${{ env.TAG }}
|
|
|
@ -1 +0,0 @@
|
||||||
tags
|
|
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -1,24 +0,0 @@
|
||||||
# Change Log
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
||||||
|
|
||||||
## [1.0.21] - 2025-03-13
|
|
||||||
### Fixed
|
|
||||||
- Added helper methods, fixed Linux
|
|
||||||
|
|
||||||
## [1.0.5] - 2022-08-09
|
|
||||||
### Fixed
|
|
||||||
- Unity task on windows not working
|
|
||||||
|
|
||||||
## [1.0.4] - 2022-06-01
|
|
||||||
### Fixed
|
|
||||||
- Fixed build project path
|
|
||||||
|
|
||||||
## [1.0.3] - 2022-05-31
|
|
||||||
### Added
|
|
||||||
- A changelog. Cuz why not? :D
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Task unity now uses proper folder from propery
|
|
|
@ -4,5 +4,8 @@
|
||||||
"homepage": "https://git.bit5.ru/composer/taskman_unity",
|
"homepage": "https://git.bit5.ru/composer/taskman_unity",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.4"
|
"php": ">=7.4"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": ["unity.inc.php"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
111
unity.inc.php
111
unity.inc.php
|
@ -5,35 +5,38 @@ use Exception;
|
||||||
task('unity', function()
|
task('unity', function()
|
||||||
{
|
{
|
||||||
$unity_path = guess_unity_app_dir();
|
$unity_path = guess_unity_app_dir();
|
||||||
$proj_path = normalize_path(get("UNITY_ASSETS_DIR") . '/../');
|
|
||||||
if(is_win())
|
if(is_win())
|
||||||
{
|
{
|
||||||
$unity_app_path = "'$unity_path/Editor/Unity.exe'";
|
$unity_app_path = "'$unity_path/Editor/Unity.exe'";
|
||||||
run_background_proc($unity_app_path, ['-projectPath', "$proj_path"]);
|
run_background_proc($unity_app_path, ['-projectPath', '.']);
|
||||||
}
|
|
||||||
else if(is_linux())
|
|
||||||
{
|
|
||||||
$unity_path = get('UNITY_APP_DIR');
|
|
||||||
$unity_app_path = "'$unity_path/Editor/Unity'";
|
|
||||||
run_background_proc($unity_app_path, ['-projectPath', "$proj_path"]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cmd = guess_unity_app_dir()."'Unity.app/Contents/MacOS/Unity' -projectPath '$proj_path' > /dev/null 2>&1&";
|
$cmd = guess_unity_app_dir()."'Unity.app/Contents/MacOS/Unity' -projectPath . > /dev/null 2>&1&";
|
||||||
system($cmd, $res);
|
system($cmd, $res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
task('unity_kill', function()
|
task('unity_kill', function()
|
||||||
{
|
{
|
||||||
unity_kill();
|
$proc_id = unity_find_proc_id();
|
||||||
|
if($proc_id)
|
||||||
|
{
|
||||||
|
echo "Found Unity process '$proc_id', killing it...\n";
|
||||||
|
system("kill -9 $proc_id");
|
||||||
|
sleep(5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "No Unity process found to kill\n";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function unity_exec($func, $build_target = "", $quit = true, $batchmode = true)
|
function unity_exec($func, $build_target = "", $quit = true, $batchmode = true)
|
||||||
{
|
{
|
||||||
global $GAME_ROOT;
|
global $GAME_ROOT;
|
||||||
|
|
||||||
$proj_path = normalize_path(get("UNITY_ASSETS_DIR") . '/../');
|
$proj_path = normalize_path("$GAME_ROOT/");
|
||||||
|
|
||||||
$log_file = "$GAME_ROOT/build/unity.log";
|
$log_file = "$GAME_ROOT/build/unity.log";
|
||||||
ensure_rm($log_file);
|
ensure_rm($log_file);
|
||||||
|
@ -63,56 +66,32 @@ function unity_exec($func, $build_target = "", $quit = true, $batchmode = true)
|
||||||
return array($log_file, $pid);
|
return array($log_file, $pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unity_batch_exec($func, $build_target = "")
|
function unity_batch_exec($func, $build_target = "", $notify = true)
|
||||||
{
|
{
|
||||||
global $GAME_ROOT;
|
global $GAME_ROOT;
|
||||||
|
|
||||||
unity_kill();
|
try
|
||||||
|
{
|
||||||
list($log_file, $pid) = unity_exec($func, $build_target, /*$quit = */ true, /*$batchmode = */ true);
|
list($log_file, $pid) = unity_exec($func, $build_target, /*$quit = */ true, /*$batchmode = */ true);
|
||||||
|
|
||||||
watch_running_process(
|
watch_running_process($pid, $log_file,
|
||||||
$pid,
|
|
||||||
$log_file,
|
|
||||||
array(
|
array(
|
||||||
'Exiting batchmode successfully',
|
'Exiting batchmode successfully'
|
||||||
'Batchmode quit successfully invoked - shutting down!'
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'Build Finished, Result: Failure',
|
|
||||||
'UnityException:',
|
'UnityException:',
|
||||||
'Aborting batchmode due to failure',
|
'Aborting batchmode due to failure',
|
||||||
'Launching bug reporter',
|
'Launching bug reporter',
|
||||||
'Unrecognized assets cannot be included in AssetBundles:'
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
-1,
|
|
||||||
//ignored errors:
|
|
||||||
array(
|
|
||||||
//NOTE: weird editor crash, sometimes happens on exit after batch task is actually done
|
|
||||||
// seems like it's never been fixed though issue tracker says otherwise (https://vk.cc/bYpyUS)
|
|
||||||
"Fatal Error! GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)"
|
|
||||||
),
|
|
||||||
|
|
||||||
//noted warnings: they don't abort execution but show up at the end of the log if command fails
|
|
||||||
array(
|
|
||||||
': error CS',
|
': error CS',
|
||||||
|
'Unrecognized assets cannot be included in AssetBundles:'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
catch(Exception $e)
|
||||||
task('unity_batch_exec', function(array $args)
|
|
||||||
{
|
{
|
||||||
if(count($args) != 2)
|
throw $e;
|
||||||
{
|
}
|
||||||
echo "Usage: gamectl unity_batch_exec <method name> <platform>\n";
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$func = $args[0];
|
|
||||||
$platform = $args[1];
|
|
||||||
unity_batch_exec($func, $platform);
|
|
||||||
});
|
|
||||||
|
|
||||||
function unity_run_proc($shared_cmd)
|
function unity_run_proc($shared_cmd)
|
||||||
{
|
{
|
||||||
|
@ -124,10 +103,6 @@ function unity_run_proc($shared_cmd)
|
||||||
$unity_app_path = $app_dir . "Editor/Unity.exe";
|
$unity_app_path = $app_dir . "Editor/Unity.exe";
|
||||||
$cmd = "powershell.exe (Start-Process '$unity_app_path'-ArgumentList '$shared_cmd' -passthru).Id";
|
$cmd = "powershell.exe (Start-Process '$unity_app_path'-ArgumentList '$shared_cmd' -passthru).Id";
|
||||||
}
|
}
|
||||||
else if(is_linux())
|
|
||||||
{
|
|
||||||
$cmd = "'$app_dir/Editor/Unity' $shared_cmd > /dev/null & echo $!";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cmd = "'$app_dir/Unity.app/Contents/MacOS/Unity' $shared_cmd > /dev/null & echo $!";
|
$cmd = "'$app_dir/Unity.app/Contents/MacOS/Unity' $shared_cmd > /dev/null & echo $!";
|
||||||
|
@ -139,19 +114,6 @@ function unity_run_proc($shared_cmd)
|
||||||
return trim($out[0]);
|
return trim($out[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unity_kill()
|
|
||||||
{
|
|
||||||
$proc_id = unity_find_proc_id();
|
|
||||||
if($proc_id)
|
|
||||||
{
|
|
||||||
echo "Found Unity process '$proc_id', killing it...\n";
|
|
||||||
system("kill -9 $proc_id");
|
|
||||||
sleep(5);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "No Unity process found to kill\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
function unity_find_proc_id()
|
function unity_find_proc_id()
|
||||||
{
|
{
|
||||||
global $GAME_ROOT;
|
global $GAME_ROOT;
|
||||||
|
@ -175,13 +137,12 @@ function guess_unity_app_dir()
|
||||||
$path = "/Applications/Unity/";
|
$path = "/Applications/Unity/";
|
||||||
if(is_win())
|
if(is_win())
|
||||||
$path = getenv("ProgramFiles")."/Unity/";
|
$path = getenv("ProgramFiles")."/Unity/";
|
||||||
else if(is_linux())
|
|
||||||
$path = getenv("HOME")."/Unity/";
|
|
||||||
|
|
||||||
$proj_version_file = $GAME_ROOT.'/unity/ProjectSettings/ProjectVersion.txt';
|
$proj_version_file = $GAME_ROOT.'/unity/ProjectSettings/ProjectVersion.txt';
|
||||||
if(is_file($proj_version_file))
|
if(is_file($proj_version_file))
|
||||||
{
|
{
|
||||||
list($_, $unity_version) = array_map('trim', explode(":", file($proj_version_file)[0]));
|
list($_, $unity_version) = array_map('trim', explode(":", file($proj_version_file)[0]));
|
||||||
|
if(is_dir("{$path}Hub/Editor/$unity_version/"))
|
||||||
$path .= "Hub/Editor/$unity_version/";
|
$path .= "Hub/Editor/$unity_version/";
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
|
@ -191,26 +152,12 @@ function get_unity_dir()
|
||||||
{
|
{
|
||||||
$app_dir = get('UNITY_APP_DIR');
|
$app_dir = get('UNITY_APP_DIR');
|
||||||
|
|
||||||
if(is_win() || is_linux())
|
if(is_win())
|
||||||
return "$app_dir/Editor/Data";
|
return "$app_dir/Editor/Data";
|
||||||
else
|
else
|
||||||
return "$app_dir/Unity.app/Contents/";
|
return "$app_dir/Unity.app/Contents/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function unity_build_cmd($shared_cmd)
|
|
||||||
{
|
|
||||||
$app_dir = get('UNITY_APP_DIR');
|
|
||||||
|
|
||||||
if(is_win())
|
|
||||||
$cmd = "\"$app_dir/Editor/Unity.exe\" $shared_cmd";
|
|
||||||
else if(is_linux())
|
|
||||||
$cmd = "\"$app_dir/Editor/Unity\" $shared_cmd";
|
|
||||||
else
|
|
||||||
$cmd = "$app_dir/Unity.app/Contents/MacOS/Unity $shared_cmd";
|
|
||||||
|
|
||||||
return $cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mono_mcs_bin()
|
function mono_mcs_bin()
|
||||||
{
|
{
|
||||||
if(!get("USE_UNITY_MONO"))
|
if(!get("USE_UNITY_MONO"))
|
||||||
|
@ -285,9 +232,9 @@ function build_mono($src_spec, $out_file, $ref_dlls = array(), $mcs_opts = "")
|
||||||
foreach($sources as $src)
|
foreach($sources as $src)
|
||||||
{
|
{
|
||||||
if(is_win())
|
if(is_win())
|
||||||
$sources_str .= '"'.normalize_path($src).'" ';
|
$sources_str .= '"'.normalize_path($src, !is_win()).'" ';
|
||||||
else
|
else
|
||||||
$sources_str .= '\''.normalize_path($src).'\' ';
|
$sources_str .= '\''.normalize_path($src, !is_win()).'\' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$deps = $sources;
|
$deps = $sources;
|
||||||
|
@ -333,7 +280,7 @@ function run_mono($exe_file)
|
||||||
if(is_win())
|
if(is_win())
|
||||||
{
|
{
|
||||||
$unity_dir = "$app_dir/Editor/Data";
|
$unity_dir = "$app_dir/Editor/Data";
|
||||||
$mono_bin = '"' . normalize_path("$unity_dir/Mono/bin/mono") . '"';
|
$mono_bin = '"' . normalize_path("$unity_dir/Mono/bin/mono", !is_win()) . '"';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -347,7 +294,7 @@ function run_mono($exe_file)
|
||||||
|
|
||||||
$exe_file = normalize_path($exe_file, !is_win());
|
$exe_file = normalize_path($exe_file, !is_win());
|
||||||
$mono_path = realpath(dirname($mono_bin) . '/../lib/mono/unity');
|
$mono_path = realpath(dirname($mono_bin) . '/../lib/mono/unity');
|
||||||
putenv("MONO_PATH=$mono_path");
|
putenv("MONO_PATH=$mono_path"); //To LOCATION_PATH?
|
||||||
$cmd = "$mono_bin $exe_file";
|
$cmd = "$mono_bin $exe_file";
|
||||||
shell($cmd);
|
shell($cmd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue