mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
@crazywhalecc how to use patch points to delete source dirs?
This commit is contained in:
parent
0247458853
commit
ce44e00bd4
@ -385,6 +385,9 @@ class Extension
|
|||||||
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
|
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Config::getExt($this->getName(), 'type') === 'addon') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
||||||
foreach ($this->dependencies as $dependency) {
|
foreach ($this->dependencies as $dependency) {
|
||||||
if (!$dependency instanceof Extension) {
|
if (!$dependency instanceof Extension) {
|
||||||
|
|||||||
@ -184,21 +184,21 @@ abstract class LibraryBase
|
|||||||
|
|
||||||
// extract first if not exists
|
// extract first if not exists
|
||||||
if (!is_dir($this->source_dir)) {
|
if (!is_dir($this->source_dir)) {
|
||||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-extract');
|
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
|
||||||
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
||||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
|
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->patched && $this->patchBeforeBuild()) {
|
if (!$this->patched && $this->patchBeforeBuild()) {
|
||||||
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
||||||
}
|
}
|
||||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build');
|
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-build');
|
||||||
$this->build();
|
$this->build();
|
||||||
$this->installLicense();
|
$this->installLicense();
|
||||||
if (getenv('CI')) {
|
if (getenv('CI')) {
|
||||||
FileSystem::removeDir($this->source_dir);
|
FileSystem::removeDir($this->source_dir);
|
||||||
}
|
}
|
||||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build');
|
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-build');
|
||||||
return LIB_STATUS_OK;
|
return LIB_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,8 +349,8 @@ abstract class LibraryBase
|
|||||||
*/
|
*/
|
||||||
protected function installLicense(): void
|
protected function installLicense(): void
|
||||||
{
|
{
|
||||||
FileSystem::createDir(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName());
|
|
||||||
$source = Config::getLib($this->getName(), 'source');
|
$source = Config::getLib($this->getName(), 'source');
|
||||||
|
FileSystem::createDir(BUILD_ROOT_PATH . "/source-licenses/{$source}");
|
||||||
$license_files = Config::getSource($source)['license'] ?? [];
|
$license_files = Config::getSource($source)['license'] ?? [];
|
||||||
if (is_assoc_array($license_files)) {
|
if (is_assoc_array($license_files)) {
|
||||||
$license_files = [$license_files];
|
$license_files = [$license_files];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user