diff --git a/build.xml b/build.xml
index 5eedef0ba70..28b60e1edf9 100644
--- a/build.xml
+++ b/build.xml
@@ -131,7 +131,9 @@
-
+
+
+
diff --git a/build/scripts/phar-manifest.php b/build/scripts/phar-manifest.php
index a794e6ba515..fda9b69b4a8 100755
--- a/build/scripts/phar-manifest.php
+++ b/build/scripts/phar-manifest.php
@@ -1,27 +1,59 @@
#!/usr/bin/env php
&1');
-
-if (\strpos($tag, '-') === false && \strpos($tag, 'No names found') === false) {
- print $tag;
-} else {
- $branch = @\exec('git rev-parse --abbrev-ref HEAD');
- $hash = @\exec('git log -1 --format="%H"');
- print $branch . '@' . $hash;
+ exit(1);
}
-print "\n";
+$dependencies = dependencies();
+$version = version();
+
+manifest($argv[1], $version, $dependencies);
+
+function manifest(string $outputFilename, string $version, array $dependencies): void
+{
+ $buffer = 'phpunit/phpunit: ' . $version . "\n";
-$lock = \json_decode(\file_get_contents(__DIR__ . '/../../composer.lock'));
+ foreach ($dependencies as $dependency) {
+ $buffer .= $dependency['name'] . ': ' . $dependency['version'];
-foreach ($lock->packages as $package) {
- print $package->name . ': ' . $package->version;
+ if (!preg_match('/^[v= ]*(([0-9]+)(\\.([0-9]+)(\\.([0-9]+)(-([0-9]+))?(-?([a-zA-Z-+][a-zA-Z0-9.\\-:]*)?)?)?)?)$/', $dependency['version'])) {
+ $buffer .= '@' . $dependency['source']['reference'];
+ }
- if (!\preg_match('/^[v= ]*(([0-9]+)(\\.([0-9]+)(\\.([0-9]+)(-([0-9]+))?(-?([a-zA-Z-+][a-zA-Z0-9\\.\\-:]*)?)?)?)?)$/', $package->version)) {
- print '@' . $package->source->reference;
+ $buffer .= "\n";
}
- print "\n";
+ file_put_contents($outputFilename, $buffer);
+}
+
+function dependencies(): array
+{
+ return json_decode(
+ file_get_contents(
+ __DIR__ . '/../../composer.lock'
+ ),
+ true
+ )['packages'];
+}
+
+function version(): string
+{
+ $tag = @exec('git describe --tags 2>&1');
+
+ if (strpos($tag, '-') === false && strpos($tag, 'No names found') === false) {
+ return $tag;
+ }
+
+ $branch = @exec('git rev-parse --abbrev-ref HEAD');
+ $hash = @exec('git log -1 --format="%H"');
+
+ return $branch . '@' . $hash;
}