Add custom Windows micro logo support (#358)

* add custom windows micro logo option `--with-micro-logo`

* bump version 2.1.2
This commit is contained in:
Jerry Ma
2024-02-29 15:35:02 +08:00
committed by GitHub
parent 842e0add29
commit b46655ecfe
3 changed files with 22 additions and 2 deletions

View File

@@ -39,6 +39,10 @@ class BuildCliCommand extends BuildCommand
$this->addOption('without-micro-ext-test', null, null, 'Disable phpmicro with extension test code');
$this->addOption('with-upx-pack', null, null, 'Compress / pack binary using UPX tool (linux/windows only)');
if (PHP_OS_FAMILY === 'Windows') {
$this->addOption('with-micro-logo', null, InputOption::VALUE_REQUIRED, 'Use custom .ico for micro.sfx');
}
}
public function handle(): int
@@ -63,6 +67,14 @@ class BuildCliCommand extends BuildCommand
if ($rule === BUILD_TARGET_ALL) {
logger()->warning('--build-all option makes `--no-strip` always true, be aware!');
}
if (($rule & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO && $this->getOption('with-micro-logo')) {
$logo = $this->getOption('with-micro-logo');
if (!file_exists($logo)) {
logger()->error('Logo file ' . $logo . ' not exist !');
return static::FAILURE;
}
}
// Check upx
$suffix = PHP_OS_FAMILY === 'Windows' ? '.exe' : '';
if ($this->getOption('with-upx-pack')) {