mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-01 02:14:16 +07:00
Add blackfire support on windows
This commit is contained in:
@ -22,6 +22,19 @@ export async function addExtensionDarwin(
|
||||
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||
let install_command = '';
|
||||
switch (true) {
|
||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||
script +=
|
||||
'\nsh ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
(await utils.getMinorVersion(version)).replace('.', '');
|
||||
|
||||
if (ext_version) {
|
||||
script += ' ' + ext_version;
|
||||
}
|
||||
return;
|
||||
// match pre-release versions
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script +=
|
||||
@ -63,19 +76,6 @@ export async function addExtensionDarwin(
|
||||
' ' +
|
||||
version;
|
||||
return;
|
||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||
script +=
|
||||
'\nsh ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
(await utils.getMinorVersion(version)).replace('.', '');
|
||||
|
||||
if (ext_version) {
|
||||
script += ' ' + ext_version;
|
||||
}
|
||||
return;
|
||||
default:
|
||||
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||
break;
|
||||
@ -114,11 +114,9 @@ export async function addExtensionWindows(
|
||||
// match blackfire...blackfire-1.31.0
|
||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||
script +=
|
||||
'\nsh ' +
|
||||
'\n& ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
(await utils.getMinorVersion(version)).replace('.', '');
|
||||
|
||||
if (ext_version) {
|
||||
|
27
src/scripts/ext/blackfire.ps1
Normal file
27
src/scripts/ext/blackfire.ps1
Normal file
@ -0,0 +1,27 @@
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$phpversion,
|
||||
[Parameter(Position = 1, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$version = '1.31.0'
|
||||
)
|
||||
|
||||
Function Install-Blackfire() {
|
||||
$installed = Get-Php -Path $php_dir
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${version}/blackfire-php-windows_x64-php-${phpversion}${nts}.dll" -OutFile $ENV:RUNNER_TOOL_CACHE\blackfire.dll > $null 2>&1
|
||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\blackfire.dll" -Destination "$ext_dir\blackfire.dll"
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "Blackfire" "Installed and enabled"
|
||||
}
|
||||
|
||||
$tick = ([char]8730)
|
||||
$php_dir = 'C:\tools\php'
|
||||
$ext_dir = $php_dir + '\ext'
|
||||
|
||||
Install-Blackfire
|
||||
|
Reference in New Issue
Block a user