-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-2843: [PHP] Copy composer setup from Apache Thrift #3057
base: main
Are you sure you want to change the base?
Conversation
"require": { | ||
"beberlei/composer-monorepo-plugin": "0.16.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://issues.apache.org/jira/browse/AVRO-2752?focusedCommentId=17870165&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17870165
According to Siad this plugin does something important here! But AFAIU the idea is to use archive > exclude
below instead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My packagist-fu is almost non-existent, but Thrift also uses a monorepo-based setup, and in their case they don't seem to need that plugin. I'm more than happy to re-instate the plugin if it is actually needed. I'll try to take a look at those failing tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding here is that the monorepo plugin is designed to allow publishing multiple php packages from the same repository. The important part it's currently doing is using the monorepo.json file as a discovery-mechanism of sorts to locate the php source files.
Unless I'm missing something the autoload.psr-4
section of this new version will serve that need instead via PSR-4 autoloading and the archive.exclude
with the exclamation mark ensures only the php parts of this repository are included.
I think we could even delete the Edit: I can see it's already deletedmonorepo.json
file too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also currently hit install issues with the old version. I'm testing with a brand new empty project, with the following composer.json
:
{
"require": {
"apache/avro": "dev-main"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/apache/avro"
}
],
"config": {
"allow-plugins": {
"beberlei/composer-monorepo-plugin": true
}
}
}
composer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking apache/avro (dev-main 35b01df)
- Locking beberlei/composer-monorepo-plugin (v0.16.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 1 update, 0 removals
- Installing beberlei/composer-monorepo-plugin (v0.16.5): Extracting archive
- Upgrading apache/avro (dev-AVRO-2843-packagist 4c1ec59 => dev-main 35b01df): Extracting archive
Generating autoload files
Generating autoload files for monorepo sub-packages with dev-dependencies.
PHP Fatal error: Declaration of Monorepo\Composer\EventDispatcher::dispatch($eventName, ?Composer\EventDispatcher\Event $event = null) must be compatible with Composer\EventDispatcher\EventDispatcher::dispatch(?string $eventName, ?Composer\EventDispatcher\Event $event = null): int in /Users/aquaile/Development/avro-tests/vendor/beberlei/composer-monorepo-plugin/src/main/Monorepo/Composer/EventDispatcher.php on line 9
Fatal error: Declaration of Monorepo\Composer\EventDispatcher::dispatch($eventName, ?Composer\EventDispatcher\Event $event = null) must be compatible with Composer\EventDispatcher\EventDispatcher::dispatch(?string $eventName, ?Composer\EventDispatcher\Event $event = null): int in /Users/aquaile/Development/avro-tests/vendor/beberlei/composer-monorepo-plugin/src/main/Monorepo/Composer/EventDispatcher.php on line 9
Pointing to the new branch with this works:
{
"require": {
"apache/avro": "dev-AVRO-2843-packagist"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cv-library/avro"
}
]
}
4c1ec59
to
343d7ce
Compare
The linting action was failing because without the monorepo plugin |
343d7ce
to
9faa626
Compare
I made one additional change to
Most of the "risky" tests complain like this:
but that sees to me like it should be addressed on a separate PR to keep the scope limited. |
The risky warnings come from https://github.com/apache/avro/blob/main/lang/php/phpunit.xml#L22, which we could either set to false for now, or we could add the annotations it expects. Either way, this seems to be ready :) |
Although this PR does what it says on the tin (it copies the working setup from the Thrift repository) one thing @adamquaile spotted while working on this is that the The monorepo plugin would, one assumes, fix this problem, but if we wanted to re-instate that we would have to figure out what about the original setup was not working (and preventing eg. @adamquaile from installing from main). |
@jjatria It looks like the monorepo setup doesn't work as assumed. Just tested this:
After that, I can still see all the files in this repo by running:
So, I don't see a reason to keep the monorepo usage. |
Thanks for doing this @jjatria, been struggling with this issue for a while now. Any idea when it will be merged? |
@skystebnicki Not really. Other than my comment about the keywords to use for Avro in the composer.json file (currently set to "RPC"), I think this is ready to be merged, but the merging decision is up to the maintainers. Perhaps @martin-g has more insights? |
I have no experience with these matters and I totally depend on you here. |
9faa626
to
fa8b139
Compare
What is the purpose of the change
This PR copies the composer setup from https://github.com/apache/thrift which Apache successfully uses to publish the Thrift package to packagist.org (https://packagist.org/packages/apache/thrift). This is in an attempt to fix https://issues.apache.org/jira/browse/AVRO-2843
Verifying this change
This change does not add any tests, since it includes no code changes.
Documentation