From f62477f027a1eb7af2a52d474d478c03ec001439 Mon Sep 17 00:00:00 2001 From: "Michael A. Smith" Date: Mon, 11 May 2026 14:38:56 -0400 Subject: [PATCH] build: exclude build.php from the PHAR Replace the regex passed to Phar::buildFromDirectory with an explicit RecursiveCallbackFilterIterator so the exclusion list is plain PHP. Adds build.php to the excluded names; previously the build script shipped inside the distributed PHAR. Closes #14 Assisted-by: Claude Code --- build.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.php b/build.php index 27192d6..a146716 100755 --- a/build.php +++ b/build.php @@ -55,10 +55,14 @@ $phar->startBuffering(); echo "Adding source files...\n"; - $phar->buildFromDirectory( - __DIR__, - '/^(?!.*\/(?:build|tests|tools|\.git|\.github|\.claude|\.phpunit\.cache)).*$/' + $excludedNames = ['build', 'tests', 'tools', '.git', '.github', '.claude', '.phpunit.cache', 'build.php']; + $iterator = new RecursiveIteratorIterator( + new RecursiveCallbackFilterIterator( + new RecursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS), + static fn (SplFileInfo $file): bool => !in_array($file->getFilename(), $excludedNames, true) + ) ); + $phar->buildFromIterator($iterator, __DIR__); $stub = "#!/usr/bin/env php\n" . $phar->createDefaultStub('bin/oce-manage-users'); $phar->setStub($stub);