From 334a83ab51ec5fc2f5a164d695ef6bd84602883c Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 28 Jun 2024 15:42:26 +0200 Subject: [PATCH 1/4] Set the `BuildTaskSkippedException` code to 2 Fixes https://github.com/hydephp/develop/issues/1745 --- .../Framework/Features/BuildTasks/BuildTaskSkippedException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php b/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php index cc4cff9b406..55443d7c83a 100644 --- a/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php +++ b/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php @@ -8,7 +8,7 @@ class BuildTaskSkippedException extends RuntimeException { - public function __construct(string $message = 'Task was skipped', int $code = 0) + public function __construct(string $message = 'Task was skipped', int $code = 2) { parent::__construct($message, $code); } From 70291fbc822d5ff00415567dd53dc896e1356e5e Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 28 Jun 2024 15:42:59 +0200 Subject: [PATCH 2/4] Set the `BuildTaskSkippedException` code to 3 See https://github.com/hydephp/develop/issues/1745#issuecomment-2196424475 --- .../Framework/Features/BuildTasks/BuildTaskSkippedException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php b/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php index 55443d7c83a..e10e8d60f31 100644 --- a/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php +++ b/packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.php @@ -8,7 +8,7 @@ class BuildTaskSkippedException extends RuntimeException { - public function __construct(string $message = 'Task was skipped', int $code = 2) + public function __construct(string $message = 'Task was skipped', int $code = 3) { parent::__construct($message, $code); } From d90dcc7723ea81e5545f573fc2a8108ebae81f78 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 28 Jun 2024 15:45:01 +0200 Subject: [PATCH 3/4] Test skipped tasks have exit code 3 --- .../tests/Feature/Commands/BuildSitemapCommandTest.php | 2 +- .../framework/tests/Unit/BuildTaskSkippedExceptionTest.php | 2 +- packages/framework/tests/Unit/BuildTaskUnitTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php b/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php index ee13bc9bf03..ab66436b8a4 100644 --- a/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php +++ b/packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php @@ -40,7 +40,7 @@ public function testSitemapIsNotGeneratedWhenConditionsAreNotMet() ->expectsOutputToContain('Generating sitemap...') ->expectsOutputToContain('Skipped') ->expectsOutput(' > Cannot generate sitemap without a valid base URL') - ->assertExitCode(0); + ->assertExitCode(3); $this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml')); } diff --git a/packages/framework/tests/Unit/BuildTaskSkippedExceptionTest.php b/packages/framework/tests/Unit/BuildTaskSkippedExceptionTest.php index 3d3e91aa581..8d48ab00f16 100644 --- a/packages/framework/tests/Unit/BuildTaskSkippedExceptionTest.php +++ b/packages/framework/tests/Unit/BuildTaskSkippedExceptionTest.php @@ -39,7 +39,7 @@ public function testDefaultExceptionCode() { $exception = new BuildTaskSkippedException(); - $this->assertSame(0, $exception->getCode()); + $this->assertSame(3, $exception->getCode()); } public function testCustomExceptionCode() diff --git a/packages/framework/tests/Unit/BuildTaskUnitTest.php b/packages/framework/tests/Unit/BuildTaskUnitTest.php index fa5494f7407..48c49b8bbda 100644 --- a/packages/framework/tests/Unit/BuildTaskUnitTest.php +++ b/packages/framework/tests/Unit/BuildTaskUnitTest.php @@ -192,7 +192,7 @@ public function testTaskSkipping() })->run(); }); - $this->assertSame(0, $task->property('exitCode')); + $this->assertSame(3, $task->property('exitCode')); $this->assertSame('Skipped', trim($task->buffer[1])); $this->assertSame(' > Task was skipped', $task->buffer[2]); } @@ -205,7 +205,7 @@ public function testTaskSkippingWithCustomMessage() })->run(); }); - $this->assertSame(0, $task->property('exitCode')); + $this->assertSame(3, $task->property('exitCode')); $this->assertSame('Skipped', trim($task->buffer[1])); $this->assertSame(' > Custom reason', $task->buffer[2]); } From 7a3ad7fffeaac0caa3b72a738de9e2722b2ab9fe Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 28 Jun 2024 15:56:14 +0200 Subject: [PATCH 4/4] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c152c7a480a..0b412158291 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -29,6 +29,7 @@ This serves two purposes: - Minor: `Includes::path()` and `Includes::get()` methods now normalizes paths to be basenames to match the behaviour of the other include methods in https://github.com/hydephp/develop/pull/1738. This means that nested directories are no longer supported, as you should use a data collection for that. - Minor: The `processing_time_ms` attribute in the `sitemap.xml` file has now been removed in https://github.com/hydephp/develop/pull/1744 - Improved the sitemap data generation to be smarter and more dynamic in https://github.com/hydephp/develop/pull/1744 +- Skipped build tasks will now exit with an exit code of 3 instead of 0 in https://github.com/hydephp/develop/pull/1749 - The `hasFeature` method on the Hyde facade and HydeKernel now only accepts a Feature enum value instead of a string for its parameter. - Changed how the documentation search is generated, to be an `InMemoryPage` instead of a post-build task. - Media asset files are now copied using the new build task instead of the deprecated `BuildService::transferMediaAssets()` method.