Browse Source

Allow specifying HHVM as a dependency

Nils Adermann 11 years ago
parent
commit
4c8e8ca702
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/Composer/Repository/PlatformRepository.php

+ 14 - 0
src/Composer/Repository/PlatformRepository.php

@@ -144,5 +144,19 @@ class PlatformRepository extends ArrayRepository
             $lib->setDescription('The '.$name.' PHP library');
             parent::addPackage($lib);
         }
+
+        if (defined('HHVM_VERSION')) {
+            try {
+                $prettyVersion = HHVM_VERSION;
+                $version = $versionParser->normalize($prettyVersion);
+            } catch (\UnexpectedValueException $e) {
+                $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
+                $version = $versionParser->normalize($prettyVersion);
+            }
+
+            $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
+            $hhvm->setDescription('The HHVM Runtime (64bit)');
+            parent::addPackage($hhvm);
+        }
     }
 }