php-ds / ext-ds

An extension providing efficient data structures for PHP 7
https://medium.com/p/9dda7af674cd
MIT License
2.11k stars 95 forks source link

PECL package is missing composer files #116

Closed petk closed 6 years ago

petk commented 6 years ago

When installing this extension using PECL, the composer.json and composer.lock files are missing in the tgz archive file and testing can't be done.

Should the test be also possible to install when using the PECL installation way?

Thank you checking this out.

rtheunissen commented 6 years ago

The PECL archive is a distribution package, which should only be concerned with the files required to install and use the library. Testing is a development concern, so cloning the repository is more appropriate for that.

petk commented 6 years ago

Ok, I see. When making Linux packages for repositories, usually the release archive gets downloaded in many cases from the PECL site directly and those packaging scripts also include steps to run tests, to ensure that everything will runs smoothly on that distribution (in ideal case scenario of course).

I guess the download of the tgz archive from the GitHub releases page is good also for this case then... Thanks...

rtheunissen commented 6 years ago

Those are actually just the Windows .dll's.

~I'll include the composer files in the distribution. I'm okay with this because we're not actually shipping the tests themselves, only the script to pull them in.~

rtheunissen commented 6 years ago

Actually...

Usually you'd have .phpt tests for extensions but I decided to write the ds ones in PHPUnit, which means we need to do a composer install to run them.

When 2.0 is ready, simple method stubs will take the place of the polyfill, and these would need to be composer installed. So what the user can do is install the extension using the distribution (without the composer files), then run composer require php-ds/php-ds in their application, which will install the stubs (for IDE meta) and the tests (unless --no-dev). They can then run the tests in vendor/php-ds.

Would that be a reasonable workaround? The script to run the tests can include composer require php-ds/php-ds as well, assuming composer is installed.

I think there's enough of a workaround here to avoid adding the composer files to the package, it's just a matter of figuring out the nicest way to do it.

I'll leave this open in the meantime until we get perfectly clear on how this should work. 👍

rtheunissen commented 6 years ago

All tests will be ported to phpt in 2.0, so composer won't be needed at all.