From 6a7196530cff4dd8a4c32fd3785c2fc2922eb8ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:52:17 +0100 Subject: [PATCH 01/12] Bump phpunit/phpunit from 9.5.7 to 9.5.8 (#4345) Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.7 to 9.5.8. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.7...9.5.8) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/composer.lock b/composer.lock index 2f213b707..a499fa591 100644 --- a/composer.lock +++ b/composer.lock @@ -617,16 +617,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.11.0", + "version": "v4.12.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94" + "reference": "6608f01670c3cc5079e18c1dab1104e002579143" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94", - "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143", "shasum": "" }, "require": { @@ -667,22 +667,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.11.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" }, - "time": "2021-07-03T13:36:55+00:00" + "time": "2021-07-21T10:44:31+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -727,9 +727,9 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", @@ -1495,16 +1495,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.7", + "version": "9.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5" + "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb", + "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb", "shasum": "" }, "require": { @@ -1516,7 +1516,7 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", @@ -1582,7 +1582,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8" }, "funding": [ { @@ -1594,7 +1594,7 @@ "type": "github" } ], - "time": "2021-07-19T06:14:47+00:00" + "time": "2021-07-31T15:17:34+00:00" }, { "name": "sebastian/cli-parser", @@ -2449,6 +2449,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -2641,16 +2642,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -2679,7 +2680,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -2687,7 +2688,7 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", From 219ed81389d0c09a469e5375d2eddb827bc4f9e1 Mon Sep 17 00:00:00 2001 From: Leo Lee Date: Tue, 3 Aug 2021 02:48:36 +0800 Subject: [PATCH 02/12] Player: Fixed items on the crafting grid disappearing when the player disconnects (#4344) --- src/pocketmine/Player.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 225859aa8..30e450ceb 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3705,6 +3705,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->stopSleep(); if($this->spawned){ + $this->doCloseInventory(); + $ev = new PlayerQuitEvent($this, $message, $reason); $ev->call(); if($ev->getQuitMessage() != ""){ From 28bfe9fbb403bd74c87e9b58203eab1ed1b3d9ea Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 11 Aug 2021 20:14:03 +0100 Subject: [PATCH 03/12] emit_performance_warnings(): Log a warning when using a PHP debug build --- src/pocketmine/PocketMine.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index d1afc6845..f425d7267 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -127,6 +127,9 @@ namespace pocketmine { * @return void */ function emit_performance_warnings(\Logger $logger){ + if(PHP_DEBUG !== 0){ + $logger->warning("This PHP binary was compiled in debug mode. This has a major impact on performance."); + } if(extension_loaded("xdebug")){ $logger->warning("Xdebug extension is enabled. This has a major impact on performance."); } From 025dde19ce29103080ad4ccd7e5cb474b0f6211c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:51:34 +0100 Subject: [PATCH 04/12] Bump phpstan/phpstan-phpunit from 0.12.21 to 0.12.22 (#4367) Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.21 to 0.12.22. - [Release notes](https://github.com/phpstan/phpstan-phpunit/releases) - [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.21...0.12.22) --- updated-dependencies: - dependency-name: phpstan/phpstan-phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index a499fa591..e9c832b50 100644 --- a/composer.lock +++ b/composer.lock @@ -1073,21 +1073,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "0.12.21", + "version": "0.12.22", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "6aaff1196c4f808769774b49a94a60e5fdf18de7" + "reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6aaff1196c4f808769774b49a94a60e5fdf18de7", - "reference": "6aaff1196c4f808769774b49a94a60e5fdf18de7", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc", + "reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.86" + "phpstan/phpstan": "^0.12.92" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -1121,9 +1121,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.21" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.22" }, - "time": "2021-07-14T10:48:30+00:00" + "time": "2021-08-12T10:53:43+00:00" }, { "name": "phpstan/phpstan-strict-rules", From e561fa6222deebaa25ebb411421bab30f07118a0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Aug 2021 23:14:17 +0100 Subject: [PATCH 05/12] actions: update PHP versions --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26497dc07..fe0777591 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: image: [ubuntu-20.04] - php: [7.4.20, 8.0.7] + php: [7.4.22, 8.0.9] steps: - uses: actions/checkout@v2 #needed for build.sh @@ -37,10 +37,10 @@ jobs: fail-fast: false matrix: include: - - php: 8.0.7 + - php: 8.0.9 config: phpstan.neon.dist image: ubuntu-20.04 - - php: 7.4.20 + - php: 7.4.22 config: phpstan.php7.neon image: ubuntu-20.04 @@ -92,7 +92,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [7.4.20, 8.0.7] + php: [7.4.22, 8.0.9] steps: - uses: actions/checkout@v2 @@ -142,7 +142,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [7.4.20, 8.0.7] + php: [7.4.22, 8.0.9] steps: - uses: actions/checkout@v2 @@ -194,7 +194,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [7.4.20, 8.0.7] + php: [7.4.22, 8.0.9] steps: - uses: actions/checkout@v2 From 5a970541f964f4b45890e8e08a065ee5fdb7e875 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Aug 2021 23:15:47 +0100 Subject: [PATCH 06/12] actions: use newer pthreads version --- tests/gh-actions/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gh-actions/build.sh b/tests/gh-actions/build.sh index 62f1082cf..a8703e8d2 100755 --- a/tests/gh-actions/build.sh +++ b/tests/gh-actions/build.sh @@ -21,5 +21,5 @@ git clone https://github.com/php-build/php-build.git cd php-build ./install-dependencies.sh echo '"pthreads",,"https://github.com/pmmp/pthreads.git",,,"extension",' >> share/php-build/extension/definition -PHP_BUILD_INSTALL_EXTENSION='pthreads=@acc6e52b2144c61c434b62a3cb680d537e06828e yaml=2.2.1' PHP_BUILD_ZTS_ENABLE=on ./bin/php-build "$VERSION" "$INSTALL_DIR" || exit 1 +PHP_BUILD_INSTALL_EXTENSION='pthreads=@a6afc0434f91c1e9541444aef6ac7a1f16c595be yaml=2.2.1' PHP_BUILD_ZTS_ENABLE=on ./bin/php-build "$VERSION" "$INSTALL_DIR" || exit 1 rm "$INSTALL_DIR/etc/conf.d/xdebug.ini" || true From 7bd8d0902303105eef262a7af6a938524cb2d9dd Mon Sep 17 00:00:00 2001 From: Dylan T Date: Wed, 18 Aug 2021 14:02:52 +0100 Subject: [PATCH 07/12] GitHub Actions: automatically build and upload release artifacts, and auto-update update.pmmp.io (#4376) --- .github/workflows/draft-release.yml | 113 +++++++++++++++++++++++ .github/workflows/update-updater-api.yml | 45 +++++++++ build/generate-build-info-json.php | 43 +++++++++ build/make-release.php | 22 ++++- composer.json | 2 +- src/pocketmine/VersionInfo.php | 1 + tests/phpstan/configs/l8-baseline.neon | 2 +- 7 files changed, 221 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/draft-release.yml create mode 100644 .github/workflows/update-updater-api.yml create mode 100644 build/generate-build-info-json.php diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 000000000..d97fd81cf --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,113 @@ +name: Draft release + +on: + push: + tags: "*" + +jobs: + draft: + name: Create GitHub draft release + if: "startsWith(github.event.head_commit.message, 'Release ')" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Setup PHP + uses: shivammathur/setup-php@2.12.0 + with: + php-version: 8.0 + + - name: Restore Composer package cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: composer install --no-dev --prefer-dist --no-interaction --ignore-platform-reqs + + - name: Patch VersionInfo + run: | + BUILD_NUMBER=2000+$GITHUB_RUN_NUMBER #to stay above jenkins + echo "Build number: $BUILD_NUMBER" + sed -i "s/const BUILD_NUMBER = 0/const BUILD_NUMBER = ${BUILD_NUMBER}/" src/pocketmine/VersionInfo.php + + - name: Minify BedrockData JSON files + run: php src/pocketmine/resources/vanilla/.minify_json.php + + - name: Run preprocessor + run: | + PM_PREPROCESSOR_PATH="$GITHUB_WORKSPACE/build/preprocessor" + php "$PM_PREPROCESSOR_PATH/PreProcessor.php" --path=src --multisize || (echo "Preprocessor exited with code $?" && exit 1) + #dump the diff of preprocessor replacements to a patch in case it has bugs + git diff > preprocessor_diff.patch + VENDOR_PM="$GITHUB_WORKSPACE/vendor" + VENDOR_PM_BACKUP="$GITHUB_WORKSPACE/vendor-before-preprocess" + cp -r "$VENDOR_PM" "$VENDOR_PM_BACKUP" + for f in $(ls $VENDOR_PM/pocketmine); do + echo "Processing directory \"$f\"..." + php "$PM_PREPROCESSOR_PATH/PreProcessor.php" --path="$VENDOR_PM/pocketmine/$f" --multisize || (echo "Preprocessor exited with code $?" && exit 1) + echo "Checking for changes in \"$f\"..." + DIFF=$(git diff --no-index "$VENDOR_PM_BACKUP/pocketmine/$f" "$VENDOR_PM/pocketmine/$f" || true) + if [ "$DIFF" != "" ]; then + PATCH="$GITHUB_WORKSPACE/preprocessor_diff_$f.patch" + echo "$DIFF" > "$PATCH" + echo "Generated patch file \"$PATCH\"" + else + echo "No diff generated for \"$f\" (preprocessor made no changes)" + fi + done + + - name: Build PocketMine-MP.phar + run: composer make-server + + - name: Get PocketMine-MP release version + id: get-pm-version + run: | + echo ::set-output name=PM_VERSION::$(php -r 'require "vendor/autoload.php"; echo \pocketmine\BASE_VERSION;') + echo ::set-output name=MCPE_VERSION::$(php -r 'require "vendor/autoload.php"; echo \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK;') + echo ::set-output name=PM_VERSION_SHORT::$(php -r 'require "vendor/autoload.php"; $v = explode(".", \pocketmine\BASE_VERSION); array_pop($v); echo implode(".", $v);') + echo ::set-output name=PM_VERSION_MD::$(php -r 'require "vendor/autoload.php"; echo str_replace(".", "", \pocketmine\BASE_VERSION);') + + - name: Generate build info + run: php build/generate-build-info-json.php ${{ github.sha }} ${{ steps.get-pm-version.outputs.PM_VERSION }} ${{ github.repository }} > build_info.json + + - name: Upload release artifacts + uses: actions/upload-artifact@v2 + with: + name: release_artifacts + path: | + ${{ github.workspace }}/PocketMine-MP.phar + ${{ github.workspace }}/start.* + ${{ github.workspace }}/build_info.json + + - name: Create draft release + uses: ncipollo/release-action@v1.8.6 + with: + artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json + commit: ${{ github.sha }} + draft: true + name: PocketMine-MP ${{ steps.get-pm-version.outputs.PM_VERSION }} + tag: ${{ steps.get-pm-version.outputs.PM_VERSION }} + token: ${{ secrets.GITHUB_TOKEN }} + body: | + **For Minecraft: Bedrock Edition ${{ steps.get-pm-version.outputs.MCPE_VERSION }}** + + Please see the [changelogs](/changelogs/${{ steps.get-pm-version.outputs.PM_VERSION_SHORT }}.md#${{ steps.get-pm-version.outputs.PM_VERSION_MD }}) for details. + + - name: Upload preprocessor diffs + uses: actions/upload-artifact@v2 + if: always() + with: + name: preprocessor_diffs + path: ${{ github.workspace }}/preprocessor_diff*.patch + diff --git a/.github/workflows/update-updater-api.yml b/.github/workflows/update-updater-api.yml new file mode 100644 index 000000000..0d8fe3a8a --- /dev/null +++ b/.github/workflows/update-updater-api.yml @@ -0,0 +1,45 @@ +name: Update update.pmmp.io API info + +on: + release: + types: + - published + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Install jq + run: sudo apt update && sudo apt install jq -y + + - uses: actions/checkout@v2 + with: + repository: pmmp/update.pmmp.io + ssh-key: ${{ secrets.UPDATE_PMMP_IO_DEPLOY_KEY }} + + - name: Get actual tag name + id: tag-name + run: echo ::set-output name=TAG_NAME::$(echo "${{ github.ref }}" | sed 's{^refs/tags/{{') + + - name: Download new release information + run: curl -f -L ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ steps.tag-name.outputs.TAG_NAME }}/build_info.json -o new_build_info.json + + - name: Detect channel + id: channel + run: echo ::set-output name=CHANNEL::$(jq -r '.channel' new_build_info.json) + + - name: Copy release information + run: | + cp new_build_info.json channels/${{ steps.channel.outputs.CHANNEL }}.json + rm new_build_info.json + + - name: Commit changes + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git diff-index --quiet HEAD || git commit -m "New ${{ steps.channel.outputs.CHANNEL }} release: ${{ github.repository }} ${{ steps.tag-name.outputs.TAG_NAME }}" + + - name: Push changes + run: git push diff --git a/build/generate-build-info-json.php b/build/generate-build-info-json.php new file mode 100644 index 000000000..57828c372 --- /dev/null +++ b/build/generate-build-info-json.php @@ -0,0 +1,43 @@ + "); + exit(1); +} + +echo json_encode([ + "php_version" => sprintf("%d.%d", PHP_MAJOR_VERSION, PHP_MINOR_VERSION), + "base_version" => \pocketmine\BASE_VERSION, + "build" => \pocketmine\BUILD_NUMBER, + "is_dev" => \pocketmine\IS_DEVELOPMENT_BUILD, + "channel" => \pocketmine\BUILD_CHANNEL, + "git_commit" => $argv[1], + "mcpe_version" => \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK, + "date" => time(), //TODO: maybe we should embed this in VersionInfo? + "details_url" => "https://github.com/$argv[3]/releases/tag/$argv[2]", + "download_url" => "https://github.com/$argv[3]/releases/download/$argv[2]/PocketMine-MP.phar", + "source_url" => "https://github.com/$argv[3]/tree/$argv[2]", +], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; diff --git a/build/make-release.php b/build/make-release.php index 1f50c542e..361fa0c14 100644 --- a/build/make-release.php +++ b/build/make-release.php @@ -24,20 +24,23 @@ declare(strict_types=1); namespace pocketmine\build\make_release; use pocketmine\utils\VersionString; +use function count; use function dirname; use function fgets; use function file_get_contents; use function file_put_contents; +use function fwrite; use function preg_replace; use function sleep; use function sprintf; use function system; use const pocketmine\BASE_VERSION; +use const STDERR; use const STDIN; require_once dirname(__DIR__) . '/vendor/autoload.php'; -function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev) : void{ +function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev, string $channel) : void{ $versionInfo = file_get_contents($versionInfoPath); $versionInfo = preg_replace( $pattern = '/^const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m', @@ -49,6 +52,11 @@ function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev 'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false') . ';', $versionInfo ); + $versionInfo = preg_replace( + '/^const BUILD_CHANNEL = ".*";$/m', + 'const BUILD_CHANNEL = "' . $channel . '";', + $versionInfo + ); file_put_contents($versionInfoPath, $versionInfo); } @@ -57,8 +65,12 @@ function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev * @phpstan-param list $argv */ function main(array $argv) : void{ - if(isset($argv[1])){ - $currentVer = new VersionString($argv[1]); + if(count($argv) < 2){ + fwrite(STDERR, "Arguments: [release version]\n"); + exit(1); + } + if(isset($argv[2])){ + $currentVer = new VersionString($argv[2]); }else{ $currentVer = new VersionString(BASE_VERSION); } @@ -78,10 +90,10 @@ function main(array $argv) : void{ exit(1); } $versionInfoPath = dirname(__DIR__) . '/src/pocketmine/VersionInfo.php'; - replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false); + replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false, $argv[1]); system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"'); system('git tag ' . $currentVer->getBaseVersion()); - replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true); + replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, ""); system('git add "' . $versionInfoPath . '"'); system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"'); echo "pushing changes in 5 seconds\n"; diff --git a/composer.json b/composer.json index ae9ece803..6b1f9812b 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,7 @@ "scripts": { "make-devtools": "@php -dphar.readonly=0 tests/plugins/DevTools/src/DevTools/ConsoleScript.php --make tests/plugins/DevTools --out plugins/DevTools.phar", "make-server": [ - "@composer install --no-dev --classmap-authoritative", + "@composer install --no-dev --classmap-authoritative --ignore-platform-reqs", "@php -dphar.readonly=0 build/server-phar.php" ] } diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 64db47414..7b51d1917 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -36,3 +36,4 @@ const NAME = "PocketMine-MP"; const BASE_VERSION = "3.22.2"; const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; +const BUILD_CHANNEL = ""; diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index 2a32ddbf2..03641bb01 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -2,7 +2,7 @@ parameters: ignoreErrors: - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 1 + count: 2 path: ../../../build/make-release.php - From d670bc8bf8de0fb8eacbe5c29c9032cad5fe14b5 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 18 Aug 2021 14:14:54 +0100 Subject: [PATCH 08/12] Release 3.22.2 --- changelogs/3.22.md | 6 ++++++ src/pocketmine/VersionInfo.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelogs/3.22.md b/changelogs/3.22.md index 7d83b5a0d..9122076b2 100644 --- a/changelogs/3.22.md +++ b/changelogs/3.22.md @@ -18,3 +18,9 @@ Plugin developers should **only** update their required API to this version if y - Improved the documentation for `Player->getUniqueId()`. - Fixed a mistake in the documentation of `PlayerAuthInputFlags`. - Fixed incorrect encoding of `NpcDialoguePacket`. + +# 3.22.2 +- PHP 8.0 is now the primary supported version. PHP 7.4 is still supported for now, but it will be dropped in the coming weeks. It's recommended to start testing your servers on 8.0 now so you're ready. +- Fixed items in the crafting grid getting deleted on server-side disconnect or session timeout. +- A warning is now logged on startup if a debug build of PHP is used to run the server (because it has a significant performance impact). +- GitHub Actions is now used to build new releases, instead of Jenkins. You can see build logs [here](https://github.com/pmmp/PocketMine-MP/actions/workflows/draft-release.yml). diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 7b51d1917..1c6929b93 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -34,6 +34,6 @@ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.22.2"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; -const BUILD_CHANNEL = ""; +const BUILD_CHANNEL = "stable"; From 19c47fa71f02cca0fd120c1b71f7981b32c6daca Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 18 Aug 2021 14:14:58 +0100 Subject: [PATCH 09/12] 3.22.3 is next --- src/pocketmine/VersionInfo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 1c6929b93..2308f0669 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -33,7 +33,7 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.22.2"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.22.3"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; -const BUILD_CHANNEL = "stable"; +const BUILD_CHANNEL = ""; From cd3c96aad2e59922d6e7d8a45b2d30a679d4ebfb Mon Sep 17 00:00:00 2001 From: Dylan T Date: Thu, 19 Aug 2021 02:31:18 +0100 Subject: [PATCH 10/12] shivammathur/setup-php 2.12.0 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe0777591..585e6040e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -277,7 +277,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup PHP and tools - uses: shivammathur/setup-php@2.9.0 + uses: shivammathur/setup-php@2.12.0 with: php-version: 8.0 tools: php-cs-fixer From 142c8f067b5ce9758e4c22e4b4b5c9fe1d93c4a6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 19 Aug 2021 15:25:20 +0100 Subject: [PATCH 11/12] fix CS in php-cs-fixer config unfortunately i can't seem to make it fix itself --- .php-cs-fixer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index d2ea8dfa2..3b7f399af 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -41,13 +41,13 @@ return (new PhpCsFixer\Config) ], 'indentation_type' => true, 'native_function_invocation' => [ - 'scope' => 'namespaced' + 'scope' => 'namespaced' ], 'no_closing_tag' => true, 'no_empty_phpdoc' => true, 'no_extra_blank_lines' => true, 'no_superfluous_phpdoc_tags' => [ - 'allow_mixed' => true, + 'allow_mixed' => true, ], 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, From 1a395a51c914631b58fbbee30c7f829f866c3583 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 19 Aug 2021 15:26:45 +0100 Subject: [PATCH 12/12] Fixing function import inconsistencies since php-cs-fixer 3.0 migration --- .php-cs-fixer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 3b7f399af..373c8fc80 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -41,7 +41,8 @@ return (new PhpCsFixer\Config) ], 'indentation_type' => true, 'native_function_invocation' => [ - 'scope' => 'namespaced' + 'scope' => 'namespaced', + 'include' => ['@all'], ], 'no_closing_tag' => true, 'no_empty_phpdoc' => true,