Add getSourceRoot for artifacts

This commit is contained in:
crazywhalecc
2026-02-03 10:59:16 +08:00
parent 6688819605
commit a2409d9c0f
5 changed files with 33 additions and 7 deletions

View File

@@ -268,6 +268,19 @@ class Artifact
return FileSystem::convertPath(SOURCE_PATH . '/' . $path);
}
/**
* 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 (isset($this->config['metadata']['source-root'])) {
return $this->getSourceDir() . '/' . ltrim($this->config['metadata']['source-root'], '/');
}
return $this->getSourceDir();
}
/**
* Get binary extraction directory and mode.
*