feat(manifest): implement BuildManifestDumper for generating build manifest

This commit is contained in:
crazywhalecc
2026-07-13 16:59:19 +08:00
parent 422323a41d
commit 4d00e338af
7 changed files with 333 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ use StaticPHP\Exception\EnvironmentException;
use StaticPHP\Exception\WrongUsageException;
use StaticPHP\Registry\PackageLoader;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Util\BuildManifestDumper;
use StaticPHP\Util\BuildRootTracker;
use StaticPHP\Util\DependencyResolver;
use StaticPHP\Util\DirDiff;
@@ -282,6 +283,11 @@ class PackageInstaller
// pipeline above (they were merged into $this->packages in resolvePackages()). This only
// throws if a tool genuinely failed to become available (e.g. no artifact for this platform).
$this->ensureRequiredTools();
// Pure install operations must not overwrite the manifest of an existing build.
if ($this->build_packages !== []) {
new BuildManifestDumper()->dump($this->packages, $this->build_packages, $this->install_packages, $this);
}
}
public function isBuildPackage(Package|string $package): bool

View File

@@ -117,6 +117,19 @@ class TargetPackage extends LibraryPackage
return null;
}
/**
* Get target-specific structured data for the build manifest.
*
* Target implementations may override this method to expose build facts that
* cannot be represented by the generic resolved package list.
*
* @return array<string, mixed>
*/
public function getBuildManifestData(PackageInstaller $installer): array
{
return [];
}
/**
* Gets all build options for the target package.
*