Skip to content

Commit ce44e00

Browse files
committed
@crazywhalecc how to use patch points to delete source dirs?
1 parent 0247458 commit ce44e00

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/SPC/builder/Extension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ public function buildShared(array $visited = []): void
385385
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
386386
return;
387387
}
388+
if (Config::getExt($this->getName(), 'type') === 'addon') {
389+
return;
390+
}
388391
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
389392
foreach ($this->dependencies as $dependency) {
390393
if (!$dependency instanceof Extension) {

src/SPC/builder/LibraryBase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,21 @@ public function tryBuild(bool $force_build = false): int
184184

185185
// extract first if not exists
186186
if (!is_dir($this->source_dir)) {
187-
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-extract');
187+
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
188188
SourceManager::initSource(libs: [static::NAME], source_only: true);
189-
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
189+
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
190190
}
191191

192192
if (!$this->patched && $this->patchBeforeBuild()) {
193193
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
194194
}
195-
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build');
195+
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-build');
196196
$this->build();
197197
$this->installLicense();
198198
if (getenv('CI')) {
199199
FileSystem::removeDir($this->source_dir);
200200
}
201-
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build');
201+
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-build');
202202
return LIB_STATUS_OK;
203203
}
204204

@@ -349,8 +349,8 @@ protected function getSnakeCaseName(): string
349349
*/
350350
protected function installLicense(): void
351351
{
352-
FileSystem::createDir(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName());
353352
$source = Config::getLib($this->getName(), 'source');
353+
FileSystem::createDir(BUILD_ROOT_PATH . "/source-licenses/{$source}");
354354
$license_files = Config::getSource($source)['license'] ?? [];
355355
if (is_assoc_array($license_files)) {
356356
$license_files = [$license_files];

0 commit comments

Comments
 (0)