-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Symlink packages after
composer update
This is a fundamental rewrite of the Composer integration. Now, instead of adding the loaded paths to Composer's search path (by creating path repositories for them), we replace the packages downloaded by Composer that can be found in the loaded paths by symlinks to the local paths. Doing so requires us to hook into the autoload dumper, which now has to respect the rules in the local path, not those obtained from Packagist. All of this should hopefully fix several issues, most importantly: - Composer's lock file will be written before Studio does its magic, therefore not causing any conflicts with other developers' setups. - Different version constraints on symlinked packages won't cause problems anymore. Any required packages that are found in loaded paths will be loaded, no matter the branch or version they are on. Open questions: - How should packages be handled that have not yet been added to Packagist? (Proposed solution: Create path repositories for the loaded paths, but *append* them instead of *prepending*, so that they will only be used as fallback, if Packagist does not yield any results.) - Should we validate the constraints from composer.json before creating symlinks? With this setup, everything might be working locally, but not when downloading the package from Packagist (as another version may be downloaded instead). Refs #52, #58, #65, #72.
- Loading branch information
1 parent
4c8784d
commit d4e19eb
Showing
1 changed file
with
111 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d4e19eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can not work with wildcard path.
d4e19eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[InvalidArgumentException]
Package foo/bar-9999999-dev seems not been installed properly
d4e19eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errored when
composer update
, but succeed if I runcomposer update --no-autoloader && composer dump-autoload
Maybe
symlinkStudioPackages
andloadStudioPackagesForDump
are not concerted?d4e19eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for me: the plugin isn't able to symlink the package I want to use. It fails whether required version in the main
composer.json
matches the git branch of the package I want to symlink or not, even when overriding it in the package'scomposer.json
file with"version": "dev-some-branch-name"
as I had to do with version 0.12 of the plugin.Using the
--no-autoloader
option makes the plugin work as expected in all these cases.d4e19eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franzliedke
Did you try the Installer Events? I am not familiar with the Composer plugin development, after some black-box logging tests, I guess the following may be work:
post-dependencies-solving
: symlink Studio-managed packagespre-dependencies-solving
: restore Studio-managed paths (symlinks) to the origin packages, to let Composer install/update work correctlyI think we just need to replace (symlink) Studio-managed packages during dependencies solving, then the Composer process can be:
composer.lock
file