-
-
Notifications
You must be signed in to change notification settings - Fork 75
Scoped folder name of package not what expected? #683
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
Comments
This is most likely the problem: IIRC the finder is configured to not follow symlinks (not certain of it though) |
Indeed that was the issue, thanks for your help. |
Could this behavior be improved somehow? It is true that when php-scoper gets the real path of the files collected by the Finder (here), any symlink points to the real path of each file and that is what php-scoper uses to determine the Nevertheless, php-scoper disregards the original keys the Finder uses to collect all the files. Those keys are relative to the working directory and could be effectively used as array keys here, instead of the real paths. I wonder if this behavior could be optionally introduced with an additional parameter (either in the command line or the configuration file itself). |
Symlinks support was never added because I didn't want to bother with it, not because there is no value in it. You are right that in theory PHP-Scoper should not care that it's a symlink: if you have a directory with a symlink in there, it could treat as if it was not a symlink and just do its job. The only difference would be to be careful to keep the file path rather than its link:
If that is the case I don't see why it would need an additional parameter (unless you think it can cause problems). So it's definitely a feature that one can contribute to :) |
First of all, thank you so much for your super prompt reply, which is truly appreciated. Regardless of whether a local library is symlinked or mirrored in the vendor directory, a Finder component always returns an array the keys of which are the path relative to the current composer configuration.
For all those libraries, a Finder returns an array with the following keys:
When it comes to real paths, though, you have the following keys:
And that is what php-scoper uses as keys in the
while, if you used the original keys from the finder, you would have gotten the more logical keys:
I say "more logical" because that is exactly the same result you would get when all libraries are distributed and copied inside the vendor folder, after the development of the symlinked library is complete. Hence, my idea of leaving it to developers whether to use the original keys from Finders as an alternative to the real path of the files. In terms of contributing to this change, I will be more than happy to help if you like, as this may require very few changes to the current implementation. |
So maybe it is only a matter of getting the link path rather than the real path for symlinks?
I would be more than happy to receive help there :) In terms of changes I think it's best to come up with a working draft, adapting the rest can be figured out afterwards |
I was suggesting to use the Finder keys as an optional, alternative possibility so that the new implementation is backward-compatible with the current one (just in case someone is already relying on the current logic). I will submit a PR shortly. |
Bug report
Hi there,
In a project I'm working on, we have 2 packages with the same vendor name, example "my-company". When scoping the packages, they're both scoped, however the folder structure of one of them is completely broken.
In the configuration below: the package with name "first-package" is correctly scoped under
dependencies/first-package
- the 2nd package however, for some reason, it's using the entire project structure and becomesdependencies/project-name-here/vendor/my-company/second-package
but what I'd need it to be isdependencies/second-package
.Any idea what's causing this?
Note: the 1st package is symlinked locally. The 2nd isn't.
scoper.inc.php
Output
$ bin/php-scoper add-prefix --config .scoper.inc.php --output-dir dependencies/ > output
The text was updated successfully, but these errors were encountered: