Skip to content

[FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config #21375

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

Merged
merged 1 commit into from
Feb 28, 2017

Conversation

Deamon
Copy link
Contributor

@Deamon Deamon commented Jan 22, 2017

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes/no
Fixed tickets -
License MIT
Doc PR

This MR is part of the #21284 todo list

@chalasr
Copy link
Member

chalasr commented Jan 23, 2017

Thanks for working on this @Deamon. Tests were broken before this PR, they have been fixed meantime, could you rebase against master so we could see if builds are green?

Also I suggest to wait that at least one of the opened PRs on this subject is merged before moving the remaining passes of the todo list, the goal has been validated by maintainers but the approach might still be challenged, it would be too bad to rework several PRs in this case.

@Deamon Deamon force-pushed the move-config-cache-pass branch from 64a0100 to 2056aaa Compare January 23, 2017 11:51
@Deamon
Copy link
Contributor Author

Deamon commented Jan 23, 2017

@chalasr, it's a pleasure :)
And as you suggested, I'll wait to continue other changes. I understand that the approach still in discussion.

I pushed again but it fails, I might need to update a constraint in a composer.json file somewhere maybe this one : src/Symfony/Component/DependencyInjection/composer.json line 33 and maybe a conflict in the same file ?

@chalasr
Copy link
Member

chalasr commented Jan 23, 2017

@Deamon It fails because of:

Fatal error: Trait 'Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait' not found in /home/travis/build/symfony/symfony/src/Symfony/Component/Config/DependencyInjection/ConfigCachePass.php

This trait is part of the DI component since 3.2, so what is needed is to add "symfony/dependency-injection": "~3.2" as dev requirement in the Config composer.json, sort as the trait exists even with low deps.

maybe a conflict in the same file

Since it must be ok to use the DI component along with the Config one without using the compiler pass introduced here, this one should not involve any conflict AFAIK.

use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass;
use Symfony\Component\Config\DependencyInjection\Compiler\ConfigCachePass;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Symfony\Component\Config\DependencyInjection\ConfigCachePass, right?

Copy link
Contributor Author

@Deamon Deamon Jan 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed,
thanks for the review!

@chalasr
Copy link
Member

chalasr commented Feb 16, 2017

@daemon The existing PRs regarding the same ticket have been merged, we are now sure about the right approach: add a constructor to the moved compiler pass (the new one) taking the service id in which collected services are injected as argument defaulting to the service id used in the framework (here $factoryServiceId = 'config_cache_factory') and the collected tag(s) as other arguments defaulting to their name in the framework (here $resourceCheckerTag = 'config_cache.resource_checker'), see merged PRs for inspiration.

Would you mind rebasing this and make the change?

@Deamon
Copy link
Contributor Author

Deamon commented Feb 17, 2017

@chalasr I'll do that ASAP

@Deamon Deamon force-pushed the move-config-cache-pass branch 3 times, most recently from 728ad3e to 4ce7db9 Compare February 26, 2017 19:10
@Deamon
Copy link
Contributor Author

Deamon commented Feb 26, 2017

@chalasr, PR rebased and updated with a constructor inspired from other PR and your suggestions.

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -17,7 +17,8 @@
],
"require": {
"php": ">=5.5.9",
"symfony/filesystem": "~2.8|~3.0"
"symfony/filesystem": "~2.8|~3.0",
"symfony/dependency-injection": "~3.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that's not a hard dependency as the Config component itself does not require the DependencyInjection component to be installed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, only a dev requirement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this in require because we use the "PriorityTaggedServiceTrait" from DependencyInjection here.

I add it to make tests passes on PHP7.1 (travis job).

If it needs to be in require-dev even with this, I change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip tests when the trait is not available. And we should probably add a conflict rule for versions of the DependencyInjection component before 3.2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh are you sure for the conflict? People can use DI but not the pass

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but it will then lead to errors when you decide to use the pass and didn't update the DI version before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I wasn't sure that it's more important than broad compatibility. Fixed it for existing passes in #21779.

We can skip tests when the trait is not available

Adding the conflict avoids the need for skipping tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I'll push in a minute the require in dev and the conflict section

@xabbuh
Copy link
Member

xabbuh commented Feb 27, 2017

👍

Status: Reviewed


public function process(ContainerBuilder $container)
{
$resourceCheckers = $this->findAndSortTaggedServices('config_cache.resource_checker', $container);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'config_cache.resource_checker' should be $this->resourceCheckerTag

return;
}

$container->getDefinition('config_cache_factory')->replaceArgument(0, $resourceCheckers);
Copy link
Member

@chalasr chalasr Feb 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'config_cache_factory' should be $this->factoryServiceId

use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass;
use Symfony\Component\Config\DependencyInjection\Compiler\ConfigCachePass;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Symfony\Component\Config\DependencyInjection\ConfigCachePass

* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Tests\DependencyInjection\Compiler;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Symfony\Component\Config\Tests\DependencyInjection;

fabpot added a commit that referenced this pull request Feb 27, 2017
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Form][Serializer] Add missing conflicts for DI

| Q             | A
| ------------- | ---
| Branch?       | master
| Tests pass?   | yes
| Fixed tickets | #21375 (comment)
| License       | MIT

They make use of `PriorityTaggedServiceTrait` which is available since 3.2 only

Commits
-------

ddae4ef [Form][Serializer] Add missing conflicts for DI
@Deamon Deamon force-pushed the move-config-cache-pass branch 2 times, most recently from 9dc062b to 1c3afb7 Compare February 27, 2017 21:09
@Deamon
Copy link
Contributor Author

Deamon commented Feb 27, 2017

@chalasr everything has been corrected.
Travis do not pass for HHVM apparently due to timeout, is there a way to restart the failing test ?

@Deamon Deamon force-pushed the move-config-cache-pass branch from 1c3afb7 to bce445f Compare February 28, 2017 07:43
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Build failure is unrelated

@fabpot
Copy link
Member

fabpot commented Feb 28, 2017

Thank you @Deamon.

@fabpot fabpot merged commit bce445f into symfony:master Feb 28, 2017
fabpot added a commit that referenced this pull request Feb 28, 2017
…ameworkBundle to Config (Deamon)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config

| Q             | A
| ------------- | ---
| Branch?       | master<!--see comment below-->
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes/no
| Fixed tickets | - <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | <!--highly recommended for new features-->

This MR is part of the #21284 todo list
<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

Commits
-------

bce445f Move ConfigCachePass from FrameworkBundle to Config
@fabpot fabpot mentioned this pull request May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants