Refactor project constants handling in NccCompiler
This commit is contained in:
parent
272fc8524e
commit
c7b007c704
2 changed files with 9 additions and 3 deletions
|
@ -333,8 +333,7 @@
|
|||
|
||||
$metadata->addOptions($this->project_manager->getProjectConfiguration()->getBuild()->getOptions($build_configuration));
|
||||
$metadata->addOptions($this->project_manager->getProjectConfiguration()->getProject()->getOptions());
|
||||
$metadata->addConstants($this->project_manager->getRuntimeConstants($build_configuration));
|
||||
$metadata->addConstants($this->project_manager->getRuntimeConstants());
|
||||
$metadata->addConstants($this->project_manager->getConstants($build_configuration));
|
||||
$metadata->setUpdateSource($this->project_manager->getProjectConfiguration()->getProject()->getUpdateSource());
|
||||
$metadata->setMainExecutionPolicy($this->project_manager->getProjectConfiguration()->getBuild()->getMain());
|
||||
$metadata->setInstaller($this->project_manager->getProjectConfiguration()->getInstaller());
|
||||
|
@ -352,6 +351,13 @@
|
|||
$metadata->removeOption(BuildConfigurationOptions::STATIC_DEPENDENCIES->value);
|
||||
}
|
||||
|
||||
$compiled_constants = [];
|
||||
foreach($this->project_manager->getConstants() as $constant => $value)
|
||||
{
|
||||
$compiled_constants[$constant] = ConstantCompiler::compileConstants($this->project_manager->getProjectConfiguration(), $value);
|
||||
}
|
||||
|
||||
$metadata->addConstants($compiled_constants);
|
||||
|
||||
/** @noinspection UnusedFunctionResultInspection */
|
||||
$package_writer->setMetadata($metadata);
|
||||
|
|
|
@ -327,7 +327,7 @@
|
|||
* @param string $build_configuration
|
||||
* @return array
|
||||
*/
|
||||
public function getRuntimeConstants(string $build_configuration=BuildConfigurationValues::DEFAULT->value): array
|
||||
public function getConstants(string $build_configuration=BuildConfigurationValues::DEFAULT->value): array
|
||||
{
|
||||
$configuration = $this->project_configuration->getBuild()->getBuildConfiguration($build_configuration);
|
||||
return array_merge($configuration->getDefineConstants(), $this->project_configuration->getBuild()->getDefineConstants());
|
||||
|
|
Loading…
Add table
Reference in a new issue