Added new constant '%DEFAULT_BUILD_CONFIGURATION%' which points to the project's default build configuration
This commit is contained in:
parent
bc86e5a65d
commit
f5433c6bf9
3 changed files with 57 additions and 1 deletions
|
@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
This update introduces minor bug fixes & improvements
|
||||
|
||||
### Added
|
||||
- Added new constant '%DEFAULT_BUILD_CONFIGURATION%' which points to the project's default build configuration
|
||||
|
||||
### Fixed
|
||||
- ncc will now correctly handle package execution where the main unit is not defined in the package instead of
|
||||
throwing an exception.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
use ncc\Enums\SpecialConstants\BuildConstants;
|
||||
use ncc\Enums\SpecialConstants\DateTimeConstants;
|
||||
use ncc\Enums\SpecialConstants\GeneralConstants;
|
||||
use ncc\Enums\SpecialConstants\InstallConstants;
|
||||
use ncc\Enums\SpecialConstants\AssemblyConstants;
|
||||
use ncc\Enums\SpecialConstants\RuntimeConstants;
|
||||
|
@ -47,10 +48,30 @@
|
|||
$input = self::compileBuildConstants($input);
|
||||
$input = self::compileDateTimeConstants($input, time());
|
||||
$input = self::compileRuntimeConstants($input);
|
||||
$input = self::compileGeneralConstants($input, $project_configuration);
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
public static function compileGeneralConstants(?string $input, ProjectConfiguration $project_configuration): ?string
|
||||
{
|
||||
if($input === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
[
|
||||
GeneralConstants::DEFAULT_BUILD_CONFIGURATION->value
|
||||
],
|
||||
[
|
||||
$project_configuration->getBuild()->getDefaultConfiguration()
|
||||
],
|
||||
|
||||
$input
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles assembly constants about the project (Usually used during compiling time)
|
||||
*
|
||||
|
@ -70,7 +91,7 @@
|
|||
AssemblyConstants::ASSEMBLY_NAME->value,
|
||||
AssemblyConstants::ASSEMBLY_PACKAGE->value,
|
||||
AssemblyConstants::ASSEMBLY_VERSION->value,
|
||||
AssemblyConstants::ASSEMBLY_UID->value
|
||||
AssemblyConstants::ASSEMBLY_UID->value,
|
||||
],
|
||||
[
|
||||
$assembly->getName(),
|
||||
|
|
32
src/ncc/Enums/SpecialConstants/GeneralConstants.php
Normal file
32
src/ncc/Enums/SpecialConstants/GeneralConstants.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) Nosial 2022-2024, all rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
|
||||
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace ncc\Enums\SpecialConstants;
|
||||
|
||||
enum GeneralConstants : string
|
||||
{
|
||||
|
||||
/**
|
||||
* The project's default build configuration
|
||||
*/
|
||||
case DEFAULT_BUILD_CONFIGURATION = '%DEFAULT_BUILD_CONFIGURATION%';
|
||||
}
|
Loading…
Add table
Reference in a new issue