mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Use pre-compiled PCOV binary for PHP7.4 on windows
This commit is contained in:
parent
06929bdf4c
commit
ba5306eea9
@ -56,6 +56,7 @@ describe('Utils tests', () => {
|
||||
expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
|
||||
expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
|
||||
expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux);
|
||||
expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32);
|
||||
expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
|
||||
expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
|
20
lib/utils.js
20
lib/utils.js
@ -79,24 +79,26 @@ function readScript(filename, version, os_version) {
|
||||
'scripts/pcov.sh'
|
||||
]);
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8');
|
||||
case '7.3':
|
||||
default:
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
}
|
||||
break;
|
||||
case 'linux':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
yield readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
case '7.3':
|
||||
default:
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'win32':
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
yield readFiles74(['ext/php_pcov.dll']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||
}
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
});
|
||||
}
|
||||
exports.readScript = readScript;
|
||||
@ -179,7 +181,7 @@ function log(message, os_version, log_type) {
|
||||
exports.log = log;
|
||||
function getExtensionPrefix(extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let zend = ['xdebug', 'opcache'];
|
||||
let zend = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
||||
switch (zend.indexOf(extension)) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "1.3.7",
|
||||
"version": "1.3.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "1.3.7",
|
||||
"version": "1.3.8",
|
||||
"private": false,
|
||||
"description": "Setup php action",
|
||||
"main": "lib/setup-php.js",
|
||||
|
BIN
src/ext/php_pcov.dll
Normal file
BIN
src/ext/php_pcov.dll
Normal file
Binary file not shown.
@ -26,16 +26,18 @@ if($installed -ne $version) {
|
||||
}
|
||||
|
||||
echo "Housekeeping in PHP.ini, enabling openssl"
|
||||
$ext_dir = "C:\tools\php\ext"
|
||||
Add-Content C:\tools\php\php.ini "date.timezone = 'UTC'"
|
||||
Set-PhpIniKey extension_dir C:\tools\php\ext
|
||||
Set-PhpIniKey extension_dir $ext_dir
|
||||
|
||||
if($version -lt '7.4') {
|
||||
Enable-PhpExtension openssl
|
||||
} else {
|
||||
Add-Content C:\tools\php\php.ini "extension=php_openssl.dll"
|
||||
Copy-Item "php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
|
||||
}
|
||||
|
||||
echo "Installing Composer"
|
||||
Install-Composer -Scope System -Path C:\tools\php
|
||||
$ext_dir = Get-PhpIniKey extension_dir
|
||||
php -v
|
||||
composer -V
|
36
src/utils.ts
36
src/utils.ts
@ -70,33 +70,22 @@ export async function readScript(
|
||||
path.join(__dirname, '../src/scripts/7.4.sh'),
|
||||
'utf8'
|
||||
);
|
||||
case '7.3':
|
||||
default:
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'linux':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
await readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
case '7.3':
|
||||
default:
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'win32':
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
await readFiles74(['ext/php_pcov.dll']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return await log(
|
||||
'Platform ' + os_version + ' is not supported',
|
||||
@ -104,6 +93,11 @@ export async function readScript(
|
||||
'error'
|
||||
);
|
||||
}
|
||||
|
||||
return fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/' + filename),
|
||||
'utf8'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +183,7 @@ export async function log(
|
||||
}
|
||||
|
||||
export async function getExtensionPrefix(extension: string): Promise<string> {
|
||||
let zend: Array<string> = ['xdebug', 'opcache'];
|
||||
let zend: Array<string> = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
||||
switch (zend.indexOf(extension)) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
Loading…
Reference in New Issue
Block a user