浏览代码

Allow specifying HHVM as a dependency

Nils Adermann 11 年之前
父节点
当前提交
4c8e8ca702
共有 1 个文件被更改,包括 14 次插入0 次删除
  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);
+        }
     }
 }