Skip to content

Commit a6c79e3

Browse files
committed
Add dump license files after installing
1 parent 19e11ca commit a6c79e3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/StaticPHP/Package/PackageInstaller.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use StaticPHP\Util\FileSystem;
1818
use StaticPHP\Util\GlobalEnvManager;
1919
use StaticPHP\Util\InteractiveTerm;
20+
use StaticPHP\Util\LicenseDumper;
2021
use StaticPHP\Util\V2CompatLayer;
2122
use ZM\Logger\ConsoleColor;
2223

@@ -208,6 +209,11 @@ public function run(bool $interactive = true, bool $disable_delay_msg = false):
208209
}
209210
}
210211
}
212+
213+
$this->dumpLicenseFiles($this->packages);
214+
if ($interactive) {
215+
InteractiveTerm::success('Exported package licenses', true);
216+
}
211217
}
212218

213219
public function isBuildPackage(Package|string $package): bool
@@ -460,6 +466,21 @@ public function getPhpExtensionPackage(string $package_or_ext_name): ?PhpExtensi
460466
return null;
461467
}
462468

469+
/**
470+
* @param Package[] $packages
471+
*/
472+
private function dumpLicenseFiles(array $packages): void
473+
{
474+
$dumper = new LicenseDumper();
475+
foreach ($packages as $package) {
476+
$artifact = $package->getArtifact();
477+
if ($artifact !== null) {
478+
$dumper->addArtifacts([$artifact->getName()]);
479+
}
480+
}
481+
$dumper->dump(BUILD_ROOT_PATH . '/license');
482+
}
483+
463484
/**
464485
* Validate that a package has required artifacts.
465486
*/

0 commit comments

Comments
 (0)