-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] optimize files for distribution #24427
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
Conversation
@Tobion ah thanks for the reading material. So should I just close now then? |
12292c6
to
3ff1d58
Compare
@jpuck it's true that this has been asked for (and rejected) many times before, but it's OK to discuss about this again from time to time. Besides, if so many people and so many times ask for the same thing, maybe it's time to reconsider our past decision. Thanks! |
I full agree wit @iltar and I've alwas been in favor in adding this. |
Definitely agree with this as well, these tests files shouldn't be within the "distributed archive". Ideally I'd move them to |
The problem is primarily present when you use |
Having tests in each component is a requirement so there is no way to move tests outside of src, unless someone wants to take the responsibility and has the leadership to rewrite all our processes and releasing infrastructure. About DX, I think https://youtrack.jetbrains.com/issue/WI-37750 will do the job. 👎 on my side, with the same rationale as previously detailed. |
For |
That means all tests would have to be marked with |
@iltar yes. That looks accurate to me, anything in "Tests" folder is out of BC policy, so they are internal. |
But that won't fix it for:
|
It's still an IDE-domain problem. |
Excluding the tests from dist files would cover all scenarios though, no opt-outs for anything, no additional work for the developer |
Not all usages, as previously discussed in #17749. |
That was a slightly different topic, moving the files. The only thing I would like to see this issue resolve in, is no test files present when I add symfony as a dependency to my project. I have yet to see an argument that might convince me that this is a bad idea for the majority of people. Adjusting the IDE or config files for every single developer is a lot of work, where as the minuscule amount of developers that does want the test files, can get them via numerous ways. Why not hold a poll whether or not the community wants the test files included or excluded from the dist? |
Closing as explained. |
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (#29277) Added .gitattributes files to root and all components (#26472) Exclude non-essential files from Composer package (#25414) [HttpFoundation] optimize files for distribution (#24427) Add .gitattributes files (#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (#20057) Add lightweight and root only .gitattributes (#18004) Add .gitattributes to exclude tests from ZIPs (#17995) [RFC] Move tests out of the source and source out of the tests (#17749) Removal of development & testing files using .gitattributes (#16174) Please add .gitattributes files and fix line endings (#13521) making use of .gitattributes (#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24 Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
Currently every production installation will pull in all of the tests into the vendor directory. This is unnecessary file bloat on the server and network bandwidth. By adding a
.gitattributes
file with filenames listed to be excluded during export, this will speed up installations and facilitate better stewardship of server resources.This is my 1st PR, so I hope I understood the contributing guidelines and submitted to the correct repository and branch, so please kindly advise if otherwise. If acceptable in principle, then I'd be happy to duplicate the efforts in additional commits for the other components. I chose the HttpFoundation subtree because it came to my attention as it was used in a project when a lint failed on a php 5.6 server only because of php 7 language used in one of the tests.
Thanks!