Skip to content
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

Update recompose to work better with CWP #145

Merged

Conversation

maxime-rainville
Copy link
Contributor

@maxime-rainville maxime-rainville commented Dec 18, 2018

The purpose of the PR is to enable recompose to work with CWP recipes.

Summary of changes

  • Addition of a new --cwp-constraint flag. When this is provided it overrides --recipe-core-constraint. This means the primary constraint when installing dependency is driven by cwp/cwp-recipe-core instead of by silverstripe/recipe-core.
  • SilverStripe\Upgrader\Composer\Rules\Rebuild now accepts a list of packages targets. This takes the form of packages that will be locked to a specific version requirements.
  • SilverStripe\Upgrader\Composer\Rules\Rebuild has been made more flexible when substituting packages for recipes. The recipe-core and recipe-cms substitution are no longer hard coded in Rebuild. Instead the recipe substitution can be provided to the constructor, which allows us to add cwp rules.
  • Additional recipe substitution can be provided via .upgrade.yml. The project owner can either do it in their own .upgrade.yml file or module maintainer could add it to their legacy project. Note that this is bit awkward because this file needs to be added to the SS3 module for it to work, because recompose is called before the project is using SS4 modules.
  • Rebuild logic as been adjusted:
    • To use wildcards when adding non-targeted packages, making it more likely that we find a compatible version ;
    • To clear the composer.lock file after each require call, this makes it less likely that an implicit dependency will conflict with one of explicit dependency ;
    • To explicitly fix each dependency to a specific version after they've all been added.
  • ComposerExec::TEMP_SCHEMA_CONTENT now include an explicit conflict on silverstripe/recipe-core and silverstripe/recipe-cms 4.0/4.1, forcing Rebuild to default to the 1.0/1.1 alias.
  • Recompose will now print out composer failure message when the --verbose flag is set.

Parent issue

@maxime-rainville maxime-rainville changed the title WIP Update recompose to work better with CWP Update recompose to work better with CWP Jan 6, 2019
use SilverStripe\Upgrader\Util\ConfigFile;

/**
* Trait to encapsualte basic logic for retrieving upgrading config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

* @return bool
*/
protected function recipeCoreTargetIsInstalled(ComposerExec $composer, string $targetRecipeCore): bool
protected function targetsInstalled(ComposerExec $composer, array $targets): bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc needs to be updated.

{
$composer = new ComposerExec(__DIR__);
$rule = new Rebuild('1.1');
$rule = new Rebuild(["silverstripe/recipe-core" => "1.1"], $this->recipeEquivalences);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single quotes are preferred.

@@ -38,74 +48,98 @@ class RebuildTest extends TestCase
'other' => ['composer/semver'],
];

public function testSwitchToRecipeCore()
private $recipeEquivalences = [
"silverstripe/framework" => ["silverstripe/recipe-core"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single quotes are preferred.

@maxime-rainville maxime-rainville force-pushed the pulls/cwp-recipe-improvement branch from bd0f213 to bf4e81e Compare January 16, 2019 02:13
@maxime-rainville maxime-rainville merged commit 766df2a into silverstripe:master Jan 16, 2019
@maxime-rainville maxime-rainville deleted the pulls/cwp-recipe-improvement branch January 16, 2019 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants