Remove RakLib and SPL submodules, start using Composer

This commit is contained in:
Dylan K. Taylor 2017-11-14 19:37:58 +00:00
parent aa399a1109
commit 0d2b171c2c
7 changed files with 94 additions and 37 deletions

7
.gitmodules vendored
View File

@ -1,10 +1,3 @@
[submodule "src/raklib"]
path = src/raklib
url = https://github.com/pmmp/RakLib.git
branch = master
[submodule "src/spl"]
path = src/spl
url = https://github.com/pmmp/PocketMine-SPL.git
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/pmmp/PocketMine-Language.git

View File

@ -5,7 +5,7 @@
"homepage": "https://pmmp.io",
"license": "LGPL-3.0",
"require": {
"php": ">=7.2",
"php": ">=7.2.0RC3",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-hash": "*",
@ -20,14 +20,23 @@
"ext-spl": "*",
"ext-yaml": ">=2.0.0",
"ext-zip": "*",
"ext-zlib": ">=1.2.11"
"ext-zlib": ">=1.2.11",
"pmmp/raklib": "^0.9.0",
"pmmp/pocketmine-spl": "^0.0.2"
},
"autoload": {
"exclude-from-classmap": [
"src/spl/stubs"
],
"psr-0": {
"": ["src", "src/spl"]
"": ["src"]
}
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pmmp/RakLib"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/PocketMine-SPL"
}
]
}

77
composer.lock generated
View File

@ -4,18 +4,89 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "d4fecad9dce5314493052c870c8cf059",
"packages": [],
"content-hash": "55bdbaf13ac4ea71f0705f03f715172d",
"packages": [
{
"name": "pmmp/pocketmine-spl",
"version": "0.0.2",
"source": {
"type": "git",
"url": "https://github.com/pmmp/PocketMine-SPL.git",
"reference": "065b631d63e2c4ddb3141f63a07a9ecbab8357d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/PocketMine-SPL/zipball/065b631d63e2c4ddb3141f63a07a9ecbab8357d1",
"reference": "065b631d63e2c4ddb3141f63a07a9ecbab8357d1",
"shasum": ""
},
"type": "library",
"autoload": {
"exclude-from-classmap": [
"stubs"
],
"classmap": [
"./"
]
},
"license": [
"LGPL-3.0"
],
"description": "Standard library files required by PocketMine-MP and related projects",
"support": {
"source": "https://github.com/pmmp/PocketMine-SPL/tree/0.0.2"
},
"time": "2017-11-14T18:56:38+00:00"
},
{
"name": "pmmp/raklib",
"version": "0.9.0",
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "08470471eb16b4325fa02415fd12c5060eba9c34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/08470471eb16b4325fa02415fd12c5060eba9c34",
"reference": "08470471eb16b4325fa02415fd12c5060eba9c34",
"shasum": ""
},
"require": {
"ext-bcmath": "*",
"ext-pthreads": ">=3.1.7dev",
"ext-sockets": "*",
"php": ">=7.2.0RC3",
"pmmp/pocketmine-spl": "^0.0.2"
},
"type": "library",
"autoload": {
"classmap": [
"./"
]
},
"license": [
"GPL-3.0"
],
"description": "A RakNet server implementation written in PHP",
"support": {
"source": "https://github.com/pmmp/RakLib/tree/0.9.0",
"issues": "https://github.com/pmmp/RakLib/issues"
},
"time": "2017-11-14T19:03:14+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"php": 5,
"ext-pthreads": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.2",
"php": ">=7.2.0RC3",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-hash": "*",

View File

@ -129,30 +129,16 @@ namespace pocketmine {
define('pocketmine\PATH', dirname(__FILE__, 3) . DIRECTORY_SEPARATOR);
}
$requiredSplVer = "0.0.1";
if(!is_file(\pocketmine\PATH . "src/spl/version.php")){
echo "[CRITICAL] Cannot find PocketMine-SPL or incompatible version." . PHP_EOL;
echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL;
exit(1);
}elseif(version_compare($requiredSplVer, require(\pocketmine\PATH . "src/spl/version.php")) > 0){
echo "[CRITICAL] Incompatible PocketMine-SPL submodule version ($requiredSplVer is required)." . PHP_EOL;
echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL;
exit(1);
}
define('pocketmine\COMPOSER_AUTOLOADER_PATH', \pocketmine\PATH . 'vendor/autoload.php');
if(is_file(\pocketmine\PATH . "vendor/autoload.php")){
require_once(\pocketmine\PATH . "vendor/autoload.php");
if(is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
}else{
echo "[CRITICAL] Composer autoloader not found" . PHP_EOL;
echo "[CRITICAL] Please initialize composer dependencies before running." . PHP_EOL;
exit(1);
}
if(!class_exists("ClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
}
/*
* We now use the Composer autoloader, but this autoloader is still used by RakLib and for loading plugins.
*/

View File

@ -65,7 +65,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
public function __construct(Server $server){
$this->server = $server;
$this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp(), false);
$this->rakLib = new RakLibServer($this->server->getLogger(), \pocketmine\COMPOSER_AUTOLOADER_PATH, $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp(), false);
$this->interface = new ServerHandler($this->rakLib, $this);
}

@ -1 +0,0 @@
Subproject commit 5c7eb09c8f08abd3de2835db6bf4c06dbb2d6a70

@ -1 +0,0 @@
Subproject commit cf7738721e7342c018a91ad300108b2dd95c7224