mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-31 10:47:27 +07:00
Improve extension support
Add support for xdebug2 coverage
This commit is contained in:
47
dist/index.js
vendored
47
dist/index.js
vendored
@ -1256,14 +1256,11 @@ exports.CSVArray = CSVArray;
|
||||
* @param extension
|
||||
*/
|
||||
async function getExtensionPrefix(extension) {
|
||||
const zend = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
||||
switch (zend.indexOf(extension)) {
|
||||
case 0:
|
||||
case 1:
|
||||
return 'zend_extension';
|
||||
case -1:
|
||||
switch (true) {
|
||||
default:
|
||||
return 'extension';
|
||||
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
||||
return 'zend_extension';
|
||||
}
|
||||
}
|
||||
exports.getExtensionPrefix = getExtensionPrefix;
|
||||
@ -2141,18 +2138,11 @@ exports.addCoverage = exports.disableCoverage = exports.addCoveragePCOV = export
|
||||
const utils = __importStar(__webpack_require__(163));
|
||||
const extensions = __importStar(__webpack_require__(911));
|
||||
const config = __importStar(__webpack_require__(641));
|
||||
/**
|
||||
* Function to setup Xdebug
|
||||
*
|
||||
* @param version
|
||||
* @param os_version
|
||||
* @param pipe
|
||||
*/
|
||||
async function addCoverageXdebug(version, os_version, pipe) {
|
||||
const xdebug = (await extensions.addExtension('xdebug', version, os_version, true)) + pipe;
|
||||
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
|
||||
const log = await utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version);
|
||||
return xdebug + '\n' + ini + '\n' + log;
|
||||
async function addCoverageXdebug(extension, version, os_version, pipe) {
|
||||
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
|
||||
pipe;
|
||||
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
||||
return xdebug + '\n' + log;
|
||||
}
|
||||
exports.addCoverageXdebug = addCoverageXdebug;
|
||||
/**
|
||||
@ -2233,7 +2223,10 @@ async function addCoverage(coverage_driver, version, os_version) {
|
||||
case 'pcov':
|
||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||
case 'xdebug':
|
||||
return script + (await addCoverageXdebug(version, os_version, pipe));
|
||||
case 'xdebug3':
|
||||
return (script + (await addCoverageXdebug('xdebug', version, os_version, pipe)));
|
||||
case 'xdebug2':
|
||||
return (script + (await addCoverageXdebug('xdebug2', version, os_version, pipe)));
|
||||
case 'none':
|
||||
return script + (await disableCoverage(version, os_version, pipe));
|
||||
default:
|
||||
@ -2284,7 +2277,7 @@ async function addINIValuesUnix(ini_values_csv) {
|
||||
script +=
|
||||
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
||||
});
|
||||
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
||||
return ('echo "' + ini_values.join('\n') + '" >> ${pecl_file:-$ini_file}' + script);
|
||||
}
|
||||
exports.addINIValuesUnix = addINIValuesUnix;
|
||||
/**
|
||||
@ -2721,18 +2714,12 @@ async function addExtensionDarwin(extension_csv, version) {
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
||||
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
||||
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||
// match 7.1pcov to 8.0pcov
|
||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + extension_name;
|
||||
break;
|
||||
// match 5.6redis
|
||||
case /5\.6redis/.test(version_extension):
|
||||
command = command_prefix + 'redis-2.2.8';
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
@ -2786,7 +2773,7 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match 7.2xdebug
|
||||
case /7\.2xdebug/.test(version_extension):
|
||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||
script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||
break;
|
||||
// match 7.0mysql..8.0mysql
|
||||
@ -2866,7 +2853,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
version;
|
||||
return;
|
||||
// match 7.2xdebug
|
||||
case /^7\.2xdebug$/.test(version_extension):
|
||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
||||
return;
|
||||
// match sqlite
|
||||
|
Reference in New Issue
Block a user