Fix php74 upx bug (#450)

* fix php74 cannot compile with no-strip or with-upx-pack (including lint some code)

* use captainhook installer instead of plugin composer

* use captainhook installer instead of plugin composer

* add [no build test] flag

* update actions/cache version [no build test]

* test update actions/cache version

* test update actions/cache version

* test update actions/cache version
This commit is contained in:
Jerry Ma
2024-05-16 10:51:31 +08:00
committed by GitHub
parent 1632c25223
commit 3e84becf77
17 changed files with 1349 additions and 646 deletions

View File

@@ -47,6 +47,13 @@ function arch2gnu(string $arch): string
};
}
/**
* Match pattern function
* Example: match_pattern('*.txt', 'test.txt') will return true.
*
* @param string $pattern Pattern string
* @param string $subject Subject string
*/
function match_pattern(string $pattern, string $subject): bool
{
$pattern = str_replace(['\*', '\\\\.*'], ['.*', '\*'], preg_quote($pattern, '/'));
@@ -54,6 +61,12 @@ function match_pattern(string $pattern, string $subject): bool
return preg_match($pattern, $subject) === 1;
}
/**
* Quote a string with a quote character
*
* @param string $str String to quote
* @param string $quote Quote character, default: `"`
*/
function quote(string $str, string $quote = '"'): string
{
return $quote . $str . $quote;
@@ -61,7 +74,6 @@ function quote(string $str, string $quote = '"'): string
/**
* Get Family name of current OS
*
* @throws WrongUsageException
*/
function osfamily2dir(): string
@@ -76,6 +88,41 @@ function osfamily2dir(): string
};
}
function shell(?bool $debug = null): UnixShell
{
/* @noinspection PhpUnhandledExceptionInspection */
return new UnixShell($debug);
}
function cmd(?bool $debug = null): WindowsCmd
{
/* @noinspection PhpUnhandledExceptionInspection */
return new WindowsCmd($debug);
}
/**
* Get current builder.
*
* @throws WrongUsageException
*/
function builder(): BuilderBase
{
return BuilderProvider::getBuilder();
}
/**
* Get current patch point.
*
* @throws WrongUsageException
*/
function patch_point(): string
{
return BuilderProvider::getBuilder()->getPatchPoint();
}
// ------- function f_* part -------
// f_ means standard function wrapper
/**
* Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown
*
@@ -126,33 +173,3 @@ function f_putenv(string $env): bool
logger()->debug('Setting env: ' . $env);
return putenv($env);
}
function shell(?bool $debug = null): UnixShell
{
return new UnixShell($debug);
}
function cmd(?bool $debug = null): WindowsCmd
{
return new WindowsCmd($debug);
}
/**
* Get current builder.
*
* @throws WrongUsageException
*/
function builder(): BuilderBase
{
return BuilderProvider::getBuilder();
}
/**
* Get current patch point.
*
* @throws WrongUsageException
*/
function patch_point(): string
{
return BuilderProvider::getBuilder()->getPatchPoint();
}