diff --git a/CHANGELOG.md b/CHANGELOG.md index 91783f3..7cc062a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This update introduces minor bug fixes. ### Added - Added host resolving in network calls to improve the handling of invalid or unreachable URLs + - Added the ability to use 'all' as a build configuration when running `ncc build`, to build all build configurations + in the project. ### Changed - Update progress bar text to display basename only diff --git a/src/ncc/CLI/Commands/BuildCommand.php b/src/ncc/CLI/Commands/BuildCommand.php index f2bff4f..19ef8c4 100644 --- a/src/ncc/CLI/Commands/BuildCommand.php +++ b/src/ncc/CLI/Commands/BuildCommand.php @@ -89,19 +89,43 @@ return 1; } - // Build the project - try + $build_configuration = $args['config'] ?? $args['c'] ?? BuildConfigurationValues::DEFAULT; + + if($build_configuration === BuildConfigurationValues::ALL) { - $build_configuration = $args['config'] ?? $args['c'] ?? BuildConfigurationValues::DEFAULT; - $output = $project_manager->build($build_configuration, $options); + // Build all configurations + foreach($project_manager->getProjectConfiguration()->getBuild()->getBuildConfigurations() as $configuration_name) + { + Console::out(sprintf('Building configuration \'%s\'', $configuration_name)); + try + { + $output = $project_manager->build($configuration_name, $options); + } + catch (Exception $e) + { + Console::outException('Failed to build project', $e, 1); + return 1; + } + + Console::out($output); + } } - catch (Exception $e) + else { - Console::outException('Failed to build project', $e, 1); - return 1; + // Build the project + try + { + $output = $project_manager->build($build_configuration, $options); + } + catch (Exception $e) + { + Console::outException('Failed to build project', $e, 1); + return 1; + } + + Console::out($output); } - Console::out($output); return 0; }