mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 01:15:37 +08:00
Add getSourceRoot for artifacts
This commit is contained in:
@@ -212,6 +212,19 @@ abstract class Package
|
||||
throw new SPCInternalException("Source directory for package {$this->name} is not available because the source artifact is missing.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source build root directory.
|
||||
* It's only worked when 'source-root' is defined in artifact config.
|
||||
* Normally it's equal to source dir.
|
||||
*/
|
||||
public function getSourceRoot(): string
|
||||
{
|
||||
if (($artifact = $this->getArtifact()) && $artifact->hasSource()) {
|
||||
return $artifact->getSourceRoot();
|
||||
}
|
||||
throw new SPCInternalException("Source root for package {$this->name} is not available because the source artifact is missing.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the package has a binary available for current OS and architecture.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user