For the following components the symfony ~2.7
(and ~2.8
) version requirement declarations have never been updated and conflict with the ~3.2
and ^3.2
decalarations in drupal/core. See #2867960: Merge Component composer.json files to account for them during build for an attempt to prevent this once and for all.
Changing to ~2.7 || ~3.0
is the hot fix that would keep a composer merge happy. But are these components actually compatible with both symfony 2.7 and 3? Perhaps we can deduce a higher minimum version requirement (~2.8
?; ~3.0
?) by looking at the git logs. (Or by just looking at all the code for you symfony experts.)
- drupal/core-dependency-injection #2876671: Fix symfony/dependency-injection ~2.8 requirement in drupal/core-dependency-injection
- drupal/core-event-dispatcher #2876675: Allow symfony/event-dispatcher 4+ to be installed in Drupal 8
- drupal/core-http-foundation #2876703: Fix symfony/http-foundation ~2.7 requirement in drupal/core-http-foundation
- drupal/core-plugin #2876704: Fix symfony/validator ~2.7 requirement in drupal/core-plugin
- drupal/core-serialization #2876707: Fix symfony/yaml ~2.7 requirement in drupal/core-serialization
Comment | File | Size | Author |
---|---|---|---|
#65 | 2876669-65.patch | 12 KB | jibran |
Comments
Comment #2
Eric_A CreditAttribution: Eric_A commentedComment #3
Eric_A CreditAttribution: Eric_A commentedComment #4
Eric_A CreditAttribution: Eric_A commentedComment #5
Eric_A CreditAttribution: Eric_A commentedComment #6
dawehnerI believe we should not have an issue for every component but rather fix them all at once. Ideally we would then even have some kind of test, not sure how feasible it is.
Comment #7
Eric_A CreditAttribution: Eric_A commentedWell, there's #2867960: Merge Component composer.json files to account for them during build.
Comment #8
Mile23From IS: "For the following components the symfony ~2.7 (and ~2.8) requirements have never been updated and conflict with drupal/core symfony ~3.2 and ^3.2 requirements."
This is not correct. The components in core are mostly the same code between 8.3.x and 8.4.x. We don't have any data about whether they're incompatible or not.
Once we fix the dependencies so they're at least internally consistent in #2867960: Merge Component composer.json files to account for them during build, we can begin to test the actual requirements for these components.
I started work on a travis-ci tester that attempts to run the component tests in isolation from the rest of Drupal core. See it here: https://github.com/paul-m/drupal_component_tester
Comment #9
Eric_A CreditAttribution: Eric_A commented@Mile23, ~2.8 is by definition incompatible with ~3.2, according to https://getcomposer.org/doc/articles/versions.md#next-significant-releas...
Comment #10
Eric_A CreditAttribution: Eric_A commentedBut as discussed in #2867960-46: Merge Component composer.json files to account for them during build and #2867960-66: Merge Component composer.json files to account for them during build we can switch to >= with <= to circumvent this.
Comment #11
jibranRE: #6 @dawehner here we go.
Comment #12
jibranI'm incline to remove the meta from the title and close the child issues as duplicate.
We have quite few errors in composer.json.
Comment #13
Mile23This issue really should be postponed on #2867960: Merge Component composer.json files to account for them during build until we get the components into a working state.
Please continue conversing, however. :-)
Comment #14
jibranIMO, these issues don't affect each other at all. That fixes the build process this fixes the dependencies.
Comment #15
Mile23#2867960: Merge Component composer.json files to account for them during build sets reasonable versions and prevents regressions so everything works well enough to test.
We can't determine minimum or maximum versions for the component dependencies until we're able to test.
Comment #16
catchRe-titling for non-meta-nature of the issue now, agreed one is fine here.
We're not taking advantage of any Symfony 3 features afaik, but whether we'd actually want to support 2.* at all is a different question.
Comment #17
Eric_A CreditAttribution: Eric_A commentedThere are about 5 things to think about:
a) Broken dependency declarations between components and components, because of dependency naming mistakes in declarations. (Trivial to fix the dependency names.)
b) Doctrine version declarations in components that conflict with the drupal/core version declaration. (Trivial to fix.)
c) Symfony version declarations in components that conflict with the drupal/core version declarations. (Broken in 8.4 only. Trivial to hotfix if we just change it to a range for the components. Note that in the symfony 2.8 issue @alexpott has noted that we should not break BC if we don't have to.)
d) Getting the symfony version range exactly right for every single component, as wide as possible, no BC break if not needed.
e) Make sure we can't add conflicts ever again. (This will only pass testing if we do either a, b, c, or a, b, d.)
I created this issue with just item d in mind.
I agree with @jibran that this one can start without waiting for item e.
I agree with @Mile23 that a, b, c and e are way more pressing than d.
Comment #18
Eric_A CreditAttribution: Eric_A commentedComment #19
Eric_A CreditAttribution: Eric_A commentedComment #20
Eric_A CreditAttribution: Eric_A commentedComment #21
Mile23"Fix symfony version requirement declarations in embedded components"
What I'm getting at here is that we don't know if they're broken, so maybe we don't need to fix them. In #2867960: Merge Component composer.json files to account for them during build we make the 'hot fix' mentioned in the IS and #17 c step. In that issue, we give both 8.4.x and 8.3.x the same set of version constraints: >=2.8 <4.0.0 (or 2.7 in some cases). This allows the components to be functional, if perhaps not absolutely correct on the version constraints.
Once we have that, we can then do more work and figure out the real requirements of a given component. I'm not sure what other projects are good candidates to use these components, but I know the testbot could be a consumer which would give us rapid feedback: #2643110: Have drupalci_testbot require drupal/core-plugin in composer.json It will probably use drupal/core-plugin @stable.
We also have https://github.com/paul-m/drupal_component_tester which will get more attention depending on what next steps we have to undertake. :-)
And finally we need to figure out not only symfony component versions, but core component version dependency as well. For instance, drupal/core-annotation's composer.json in 8.4.x branch says this:
As we test things, we might find that these dependencies do not resolve. For instance, if you require drupal/core-annotation ~8.4 then drupal/core-plugin is disallowed because it requires symfony/something ~2.8 instead of ~3.
This sort of interdependency can be considered based on output from a testing script or whatever, or we can just say that all components always require their own branch version of other components in order to not go insane. :-)
Comment #22
Eric_A CreditAttribution: Eric_A commentedComposer will bark if a package requires
~2.8
and another~3.2
, because that cannot be resolved. See also #9.Comment #23
Mile23Right, but neither Composer nor tests will bark if the component actually needs ~2.8 but we set it to ~2.7 and other packages give us 2.8.* which makes all the tests pass. And it won't bark if we could allow ~2.7 and instead we require ~2.8. Or if the component could run with either ~2.8 or ~3.2 but we require ~3.2 and not ~2.8.
Comment #24
jibranHere is a re-roll of #11.
Comment #26
yogeshmpawarComment #27
yogeshmpawarUpdated patch because #24 failed to apply on 8.4.x branch.
Comment #30
Mile23Comment #31
Mile23#2876725: Fix trivial core component composer bugs before 8.4.0 is in now, so we can actually test the version constraints.
Updated my little travis test thing here: https://travis-ci.org/paul-m/drupal_component_tester
It shows us that we still have a symfony version error:
I intuit that this is a version constraint error in drupal/core-dependency-injection, but I could be wrong.
Also the test up to that point is a little bit of a false positive, because each component has requirements like "drupal/core-utility": "^8.2", which allows 8.4.0-dev to resolve drupal/core-utility 8.3.7 (the most recent stable).
We should figure out if we can require self.version for those.
Comment #32
Mile23Worked on drupal/core-dependency-injection here: #2876671-8: Fix symfony/dependency-injection ~2.8 requirement in drupal/core-dependency-injection
So very tedious. We need a way to do this automatically.
Comment #34
jibranComment #35
Mile23I updated my components tester.
You can see the code here: https://github.com/paul-m/drupal_component_tester
You can see the results here: https://travis-ci.org/paul-m/drupal_component_tester
You can clone the project and run it locally if you emulate the setup steps in the .travis.yml file.
It's tricky to test patched components in isolation while also testing their version constraints on other components. That is, for a real test of version constraints, you don't want to depend on an unpatched version of another component.
So my test currently avoids testing drupal/core-discovery, drupal/core-plugin, drupal/core-render, and drupal/core-utility, because they fail for reasons I don't understand. If someone can repro those fails and improve the patch, then please go for it.
Otherwise we might need to do this in multiple phases.
drupal/core-plugin already has an issue, because the test depends on a core module: #2661542: Isolate Drupal\Tests\Component\Plugin\DefaultFactoryTest from core test module
Here's the patch I came up with that allows the travis test to pass.
I did a shortcut of requiring @stable for some of the components. This might cause the Composer phase of the testbot to complain since #2867960: Merge Component composer.json files to account for them during build is in.
Let's find out together.
All the testing applies to 8.5.x. The patch applies to 8.6.x and we'll see if it breaks something, but probably not. This issue should really be 8.5.x, but I won't argue too hard.
Comment #36
Mile23Some more refined changes to the components' composer.json files.
The patch here matches the patch at https://github.com/paul-m/drupal_component_tester/blob/master/patch/fixe...
You can see that I ran into problems with testing on PHP 7.2 for the same reasons as #2927806: Use PHPUnit 6 for testing when PHP version >= 7.2 but trying a post-install script switch to PHPUnit 6 didn't help me for reasons I don't quite understand.
We get a pass for PHP 5.5-7.1 however.
Unless anyone has any better ways to test version constraints under PHP 7.2, this is the best I can offer with finite time.
Comment #37
MixologicTo just get the 7.2. tests to run properly, would adding a `composer require phpunit/phpunit:^6` after the composer install step to the travis.yml file for that one build definition help?
Comment #38
Mile23The composer install step in .travis.yml is for the testing tool, which doesn't even use PHPUnit.
The tool then uses exec() to call on composer to do an update: https://github.com/paul-m/drupal_component_tester/blob/master/tester.php...
Comment #39
Mile23Comment #40
Mile23OK, the travis test is happy with PHP 7.2 now. Ask me in slack or something if you want to know how. :-)
Here's the magic test run against Drupal 8.5.x: https://travis-ci.org/paul-m/drupal_component_tester/builds/335891599
And here it is for Drupal 8.6.x: https://travis-ci.org/paul-m/drupal_component_tester/builds/335900474
drupal/core-event-dispatcher has tests that subclass tests from symfony/event-dispatcher, which is not all that great: #2895487: [Symfony 4] ContainerAwareEventDispatcherTest depends on Symfony tests
But that dependency then creates the minimum constraint for drupal/core-event-dispatcher, because it has to run under PHPUnit 6, and Symfony's test doesn't, for versions of Symfony lower than 3.4. (Previous versions use
\PHPUnit_Framework_Testcase
. This changes in 3.3, but we still see the error this causes during the test run against 3.3.)If we break that dependency in #2895487: [Symfony 4] ContainerAwareEventDispatcherTest depends on Symfony tests it's very likely that we can specify an older minimum version. If anyone wants to keep an eye on that. :-)
So here's our latest greatest patch. Testing against different PHP versions and also for Drupal 8.5.x.
Comment #41
dawehner@mile23
Automating this bit is a serious form of art. This is quite nice!
So this is a patch against Drupal 8.6.x, shouldn't the dependency take that into account? Maybe I'm just confused ...
Comment #42
Mile23The version constraints for components should be wide. Ideally, wider than only the version of core where they live.
That way someone using them stands a better chance of being able to use them given their other composer.json requirements.
Determining the actual wide constraints (rather than guessing) is the point of the travis test.
So in the example of Annotation's dependency on Plugin, let's prove it using git log. :-)
That shows us that between 8.4.x and 8.5.x we had a ton of coding standards issues (which shouldn't matter here), but also #2867960: Merge Component composer.json files to account for them during build which changed the composer.json dependencies allowing the components to be used at all. So that's why we need ^8.5 for drupal/core-annotation. We could probably specify an older version, like ^8.1 or whatever, but we can't prove that it would work, unless someone has a time machine.
Doing
git log
for8.5.x..8.6.x
we see that the only thing that changed in drupal/core-plugin was a fix to the licensing field in composer.json, so we don't specifically need 8.6.x for any code changes it introduced. Because it didn't introduce any. :-)If we change something else in the Plugin component before the 8.6.0 release, we might need to change the requirements for drupal/core-annotation, but for now the patch above is a best faith effort. If we could truly turn this test into a CI step it would make it easier to catch that kind of change. #2867960: Merge Component composer.json files to account for them during build gives us a little bit of confidence, but it's not thorough.
I get that this is hard to review. :-) But the sooner we get it committed (especially to 8.5.x if possible) the better.
Comment #43
Mile23I neglected to stress that drupal/core-plugin itself can't be tested in this way because it depends on a module: #2661542: Isolate Drupal\Tests\Component\Plugin\DefaultFactoryTest from core test module
Comment #44
Mile23Comment #45
Mile23#2661542: Isolate Drupal\Tests\Component\Plugin\DefaultFactoryTest from core test module updated, could use a review. :-)
Comment #46
Mile23With #2661542: Isolate Drupal\Tests\Component\Plugin\DefaultFactoryTest from core test module in, I updated the component tester to run the plugin tests. Outlook is good: https://travis-ci.org/paul-m/drupal_component_tester/builds/345500113
Still using the patch from #40.
Comment #47
Mile23#2935193: Fix broken exceptions in Gettext component added a usage of vfsStream to a test, so now we have to update the patch here to reflect that.
Github: https://github.com/paul-m/drupal_component_tester/commit/669b6a66a3b0cbe...
Travis test run: https://travis-ci.org/paul-m/drupal_component_tester/builds/360767187
Comment #49
Mile23Restarted testbot after fix.
Comment #50
alexpottIf we're adding dev dependencies then we also need to add PHPUnit as a dev dependency. But the problem also is that there might side effects from core/tests/bootstrap.php that component tests rely on.
Comment #51
Mile23I neglected to remember that I had commented out the Utility tests and never gotten back to them. So I'm working on that.
So far only Utility has needed anything from core's test bootstrap file, and that's to load the Assertion component and say
Handle::register()
: https://github.com/paul-m/drupal_component_tester/blob/master/workspace/...Travis: https://travis-ci.org/paul-m/drupal_component_tester/builds/363372119
Comment #52
Mile23Forgot the new patch, which adds Assertion as a dev dependency of Utility.
Comment #53
dawehnerReading through it I'm wondering whether we could have a custom testsuite for our component tests, which uses a way more minimal bootstrap.php
Comment #54
Mile23Couple related issues.
Re making a testsuite: #2943856-11: [meta] Reorganize Components so they are testable in isolation and subsequent comments.
Comment #55
Mile23Reroll after #2849669: Fix \Drupal\Component\Utility\Unicode() because of the Symfony mbstring polyfill + Added PHPUnit after #50.
Current Travis build is mostly happy: https://travis-ci.org/paul-m/drupal_component_tester/builds/381191450
Except for the PHP 5.5 version which fails looking like this:
See it here (scroll all the way down): https://travis-ci.org/paul-m/drupal_component_tester/jobs/381191451
Note that's the dependency that we changed in #2849669: Fix \Drupal\Component\Utility\Unicode() because of the Symfony mbstring polyfill
Contemplating how to turn this into a drupalci.yml type build, which will be needlessly complex before #2943856: [meta] Reorganize Components so they are testable in isolation
Comment #57
Mile23Back to NR after testbot fix.
Comment #60
Mile23Updated the travis test to use core 8.8.x branch.
drupal/core-utilities now requires egulias/email-validator after #2755401: Upgrade EmailValidator to 2.x. That issue didn't put it in the component composer.json. This demonstrates that we need an isolated component dependency bounds test.
Comment #61
jibranNW after #3039611: Update core PHP dependencies for 8.8.x.
Comment #62
Mile23Bit of a reroll after #3053363: Remove support for PHP 5 in Drupal 8.8
Travis build here: https://travis-ci.org/paul-m/drupal_component_tester/builds/544370126
In other news, this test could be in core (instead of Travis-CI) if we had #3031379: Add a new test type to do real update testing
Comment #63
Mile23Comment #64
jibranDo we need to accommodate the new components in this patch?
Comment #65
jibranReroll.
Comment #69
andypostOne more related added #3179197: Drupal components depend on ^8.8 even in their Drupal 9 version
Comment #73
Mile23#3272110: Drupal 9 and 10's Drupal\Component composer.json files are totally out of date is in, so therefore component dependencies will be automagically modified to reflect those of core.