Skip to content

Commit

Permalink
Merge pull request #598 from ergebnis/fix/autoload
Browse files Browse the repository at this point in the history
Fix: Explicitly include `src/` directory when compiling PHAR
  • Loading branch information
localheinz authored Sep 5, 2024
2 parents 0019770 + c561045 commit 68326d5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.github/ export-ignore
/.phive/ export-ignore
/bin/ export-ignore
/phar/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,13 @@ jobs:
name: "phpunit-slow-test-detector-phar"
path: "${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }}"

- name: "Remove autoloader for composer"
run: "composer install --ansi --no-autoloader --no-interaction"
- name: "Remove autoload configuration for composer"
run: "php bin/remove-autoload-configuration.php"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@1.9.2"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run phar tests with phpunit/phpunit:7.5.0"
if: "matrix.phpunit-version == '7.5.0'"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`2.15.0...main`][2.15.0...main].

### Fixed

- Explicitly included `src/` directory when building PHAR ([#598]), by [@localheinz]

## [`2.15.0`][2.15.0]

For a full diff see [`2.14.0...2.15.0`][2.14.0...2.15.0].
Expand Down Expand Up @@ -337,6 +341,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
[#533]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/533
[#534]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/534
[#559]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/559
[#598]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/598

[@HypeMC]: https://github.com/HypeMC
[@localheinz]: https://github.com/localheinz
Expand Down
26 changes: 26 additions & 0 deletions bin/remove-autoload-configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

/**
* Copyright (c) 2021-2024 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/phpunit-slow-test-detector
*/

$composerJsonFile = __DIR__ . '/../composer.json';

$composerJson = \json_decode(
\file_get_contents($composerJsonFile),
false
);

$composerJson->autoload = new stdClass();

\file_put_contents($composerJsonFile, \json_encode(
$composerJson,
\JSON_PRETTY_PRINT | \JSON_PRESERVE_ZERO_FRACTION | \JSON_UNESCAPED_SLASHES
));
3 changes: 3 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"KevinGH\\Box\\Compactor\\Php"
],
"compression": "GZ",
"directories": [
"src/"
],
"files": [
"manifest.xml"
],
Expand Down

0 comments on commit 68326d5

Please sign in to comment.