diff --git a/src/StaticPHP/Package/PackageInstaller.php b/src/StaticPHP/Package/PackageInstaller.php index c4262d9a..9ceb2107 100644 --- a/src/StaticPHP/Package/PackageInstaller.php +++ b/src/StaticPHP/Package/PackageInstaller.php @@ -17,6 +17,7 @@ use StaticPHP\Util\DependencyResolver; use StaticPHP\Util\FileSystem; use StaticPHP\Util\GlobalEnvManager; use StaticPHP\Util\InteractiveTerm; +use StaticPHP\Util\LicenseDumper; use StaticPHP\Util\V2CompatLayer; use ZM\Logger\ConsoleColor; @@ -208,6 +209,11 @@ class PackageInstaller } } } + + $this->dumpLicenseFiles($this->packages); + if ($interactive) { + InteractiveTerm::success('Exported package licenses', true); + } } public function isBuildPackage(Package|string $package): bool @@ -460,6 +466,21 @@ class PackageInstaller return null; } + /** + * @param Package[] $packages + */ + private function dumpLicenseFiles(array $packages): void + { + $dumper = new LicenseDumper(); + foreach ($packages as $package) { + $artifact = $package->getArtifact(); + if ($artifact !== null) { + $dumper->addArtifacts([$artifact->getName()]); + } + } + $dumper->dump(BUILD_ROOT_PATH . '/license'); + } + /** * Validate that a package has required artifacts. */