-
Notifications
You must be signed in to change notification settings - Fork 1k
Refactor Bootstrap Process #3872
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
Added scenarios: - `Install a package that overrides a command bundled in source` - `Install a package that overrides a bundled PHAR command` Both scenarios are tagged with `@bootstrap`. See #3850
Added scenarios: - `Override command bundled with current source` - `Override command bundled with PHAR` Both scenarios are tagged with `@bootstrap`. See #3850
Added scenarios: - `Override command bundled with downloaded PHAR` - `Install a package that overrides a command from a downloaded PHAR` Both scenarios are tagged with `@bootstrap`. See #3850
…endencies. Added scenarios: - `Basic Composer stack` - `Composer stack with override requirement after WP-CLI` - `Composer stack with override requirement before WP-CLI` (fails with current commit, as this is the issue to solve) All three scenarios are tagged with `@bootstrap`. See #3850
Added scenarios: - `Override command bundled with Composer stack` - `Install a package that overrides a command from a Composer stack` Both scenarios are tagged with `@bootstrap`. See #3850
The order of execution of the bootstrapping process has been heavily refactored to contain everything in separate, isolated steps as far as currently possible. There's a major issue remaining, that will need further discussion: the autoloader for the framework itself (needed for any commands to register without errors) and the autoloader for the bundled commands (that are required through Composer) would need to be split and moved independently, but reside within the same Composer autoloader setup. See #3850
…k" autoloader and a "commands" autoloader. Requires the package `wp-cli/autoload-splitter` that is yet to be created as a repository. There's still an issue with the YAML loading, because it is not class-based. See #3850
|
|
||
| } | ||
|
|
||
| WP_CLI::add_command( 'cli', 'CLI_Command' ); |
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.
Is it necessary to move this code? If not, can you revert the changeset so that it's possible to easily follow the file history?
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.
I was looking for a command that would not be split out, to use for the tests. So, the tests do test all of the different ways to override this command.
For this to work, however, the command itself needs to be autoloaded on-demand, not immediately loaded upon bootstrap.
This change allows the `Spyc` through an autoloader, as soon as the related pull request to the `mustangostang/spyc` package has been merged: mustangostang/spyc#66
These tests cannot work as long as there is no released PHAR version to download that includes the bootstrap changes from this branch.
|
@schlessera Can you merge master? |
- `"wp-cli/autoload-splitter": "dev-master"` - `"mustangostang/spyc": "dev-master#1cea7c15324025cd7b62c8d47c10e1e94f634c1e"`
composer.json
Outdated
| "psr-0": { "WP_CLI": "php" } | ||
| "psr-0": { "WP_CLI": "php" }, | ||
| "psr-4": { "": "php/commands/src" }, | ||
| "classmap": [ "php/export" ] |
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.
This classmap shouldn't be necessary anymore...
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.
I'm currently trying to figure out the autoloading in general here. There's still an issue with the Spyc class, my proposed change did not really help at all.
features/command.feature
Outdated
| """ | ||
| And STDERR should be empty | ||
|
|
||
| @bootstrap |
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.
What if we were to create a feature/bootstrap.feature file? I think breaking things apart is typically easier than using a bunch of tag annotations.
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.
Yes, I agree that is preferable. Now that most of the package have been taken out, it can more easily be contained.
…the one that comes with Composer.
Once this is merged to `master` branch, `dev-3850-refactor-loading-order` needs to be changed into `dev-master`.
The normal fork we were pulling in via a branch needs to be set in the `"repositories"` section and is only applied on the root package for security reasons. To avoid WP-CLI breaking for people that pull it in via Composer, we replace the fork with a properly released package under a different name. See #4017
With the new hooks introduced in wp-cli/wp-cli@7fcee0e , we can now only load the commands if the parent they depend on has already been added. This is needed because of the added flexibility provided by the bootstrap refactoring. See wp-cli/wp-cli#3872
|
@danielbachhuber This should now be ready to be merged. As we had already discussed, there's still two tests that are marked as
|
masumkhan5479
left a comment
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.
ftg
With the new hooks introduced in wp-cli/wp-cli@7fcee0e , we can now only load the commands if the parent they depend on has already been added. This is needed because of the added flexibility provided by the bootstrap refactoring. See wp-cli/wp-cli#3872
See #3850