1
0
Fork 0

Merge pull request #8847 from Jean85/add-composer-runtime-api

Add composer-runtime-api version constant
pull/8868/head
Jordi Boggiano 2020-04-30 21:30:13 +02:00 committed by GitHub
commit 3c2889672b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -55,6 +55,17 @@ class Composer
const RELEASE_DATE = '@release_date@';
const SOURCE_VERSION = '1.10-dev+source';
/**
* Version number of the internal composer-runtime-api package
*
* This is used to version features available to projects at runtime
* like the platform-check file, the Composer\InstalledVersions class
* and possibly others in the future.
*
* @var string
*/
const RUNTIME_API_VERSION = '1.0.0';
public static function getVersion()
{
// no replacement done, this must be a source checkout

View File

@ -12,6 +12,7 @@
namespace Composer\Repository;
use Composer\Composer;
use Composer\Package\CompletePackage;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
@ -74,6 +75,12 @@ class PlatformRepository extends ArrayRepository
$composerPluginApi->setDescription('The Composer Plugin API');
$this->addPackage($composerPluginApi);
$prettyVersion = Composer::RUNTIME_API_VERSION;
$version = $this->versionParser->normalize($prettyVersion);
$composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
$composerRuntimeApi->setDescription('The Composer Runtime API');
$this->addPackage($composerRuntimeApi);
try {
$prettyVersion = PHP_VERSION;
$version = $this->versionParser->normalize($prettyVersion);