-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Path repository inside its source #6085
Comments
This use case is only supported if you have the root src and composer.json within another directory, like:
Then you can require |
but it was working before ... typical use was a |
I also wanted to have a |
Except that it wasn't. The check was added because the scenario caused real world issues. The scenario isn't unavoidable, and therefore it was deemed better to disallow it than to risk accidentally deleting days or weeks of work. |
My workaround, which appears to be working, is to add this to the composer.json: {
"scripts": {
"post-install-cmd": [
"rm -rf vendor/my/package && ln -s ../../../ vendor/my/package"
],
"post-update-cmd": [
"rm -rf vendor/my/package && ln -s ../../../ vendor/my/package"
]
}
} |
I have a
The integration test's
and fails for the reason stated in this issue. Integration tests are a must, and they should be included in the package (or at least be able to be included), so directory structure like this
is less then ideal. @weotch Your workaround does not seem to be cross-platform, did you work around the workaround to make it cross-platform since then? This relates to vinkla/wordplate#196. |
I'm not really sure I understand your scenario well. You mention "integration tests", but that is what dev dependencies are for - ensuring optional packages are present during development and testing. If it's not about optional dependencies it would imply that you're running integration tests for an entire system within a single component of the system, which is architecturally wrong to begin with. |
@curry684 Could you please expand on what's wrong with testing a component from within the environment you are designing the component for? Imagine I develop a WordPress plugin. Here's my directory structure:
I can I have to bootstrap a brand new WordPress site using |
Here's my current workaround. This is
If you don't specify the package version in |
I am running into the same error message, but with the mirror strategy i can fix it by Could someone care to elaborate, why this isn't supported? EDIT: There is a comment in the source mentioning discussion/attempts in #5974 and #6174 |
You can also do that with symlinks as In the code however we're bound to using other mechanisms that are not guaranteed to be symlink safe, therefore we took the futureproof approach that it's better to disable a mechanism that might one day trash days of work for thousands of developers given that the situation is simply not unavoidable. |
@curry684 I think i found a different bug then, for me the exception is thrown under very weird circumstances, that are hard to explain. I will open a separate issue for this, because my directory setup is also the other way around. See #7255 Thinking about it now i think the symlinks are unsafe no matter where they are pointing, though. its probably never desired behaivior, that any source files are deleted when you clean your vendor directory. |
Reverts 6bf02cf and several other commits I thought using Docker would make it easier to run multiple versions of PHP. In reality it just made development slower and harder. Having to write a script for every app was tedious. Having to wait while every dependency installed was also. So it's back to Plan A. For my current development environment see: https://github.com/davejamesmiller/dev-ansible (Basically Ubuntu 18.04 + Apache 2.4 + PHP 7.2 & 7.1 FPM) Unfortunately that also means putting the test app in a separate repo, because Composer doesn't like it when the test project is in a directory below the package. composer/composer#6085 (In Docker I worked around this with a second mount point.)
Had an issue with an own installer, after updating composer itself and clearing the cache everything worked like expected. |
Reverts 6bf02cf681db48003701f317cc52d73e2c4bc47a and several other commits I thought using Docker would make it easier to run multiple versions of PHP. In reality it just made development slower and harder. Having to write a script for every app was tedious. Having to wait while every dependency installed was also. So it's back to Plan A. For my current development environment see: https://github.com/davejamesmiller/dev-ansible (Basically Ubuntu 18.04 + Apache 2.4 + PHP 7.2 & 7.1 FPM) Unfortunately that also means putting the test app in a separate repo, because Composer doesn't like it when the test project is in a directory below the package. composer/composer#6085 (In Docker I worked around this with a second mount point.)
I hit the same use-case. Since path repos are allowed to point to their own source dir as install target (#8254), I created the symlink in the For the initial example, it is:
And {
"repositories": [
{
"type": "path",
"url": "vendor/my-vendor/my-package",
"options": {
"symlink": true
}
}
],
"scripts": {
"symlink-package": [
"mkdir -p vendor/my-vendor && rm -f vendor/my-vendor/my-package && ln -s -f ../../../../ vendor/my-vendor/my-package"
],
"pre-install-cmd": "@symlink-package",
"pre-update-cmd": "@symlink-package"
}
} |
I am working on a project with the following structure
where in
src
I have a package that needs to be used by the two applications inapps/admin
andapps/public
.My
composer.json
ofapps/admin
, for example, looks like:This produces a error of the type
Package %s cannot install to "%s" inside its source at "%s"
in the classComposer\Downloader\PathDownloader
.I agree this definitely needs to happen when using
STRATEGY_MIRROR
, but I was wandering if what I am doing should actually work when usingSTRATEGY_SYMLINK
. In this case you would get an infinite recursive directory structure, since you are symlinking a parent path, but this should actually not create any problem.Would it make sende to move the above mentioned exception only for the
STRATEGY_MIRROR
case?The text was updated successfully, but these errors were encountered: