drupal-core-development-project icon indicating copy to clipboard operation
drupal-core-development-project copied to clipboard

Feature/alternative include

Open bbrala opened this issue 3 years ago • 5 comments

An experiement if it is possible without patches but with a little trick in the web directory we use on our projects.

This adds:

  • index.php and update.php that includes core
  • symlink for sites/default/files since there is css there

It seems to work pretty fine but because i use a custom packages.json it is not completely as it would be when in the main repository.

Tested usinig: drupal-core-development-packages.json

{
    "packages": {
        "joachim-n/drupal-core-development-project": {
            "dev-master": {
                "name": "joachim-n/drupal-core-development-project",
                "version": "2.0.0",
                "source": {
                    "url": "[email protected]:bbrala/drupal-core-development-project",
                    "type": "git",
                    "reference": "7ca81136b274d056e3f5fb21c16d7213f1520bd5"
                }
            }
        }
    }
}

Command: composer create-project --repository=./drupal-core-development-packages.json joachim-n/drupal-core-development-project coredev5 -vvv

bbrala avatar Jan 19 '22 13:01 bbrala

Have you tried this with contrib modules installed?

It seems to me that an unpatched core index.php will make DrupalKernel think $app_root is within the core git clone, and so contrib modules won't get picked up.

joachim-n avatar Jan 20 '22 14:01 joachim-n

Hmm, you are right, i forgot some things. :)

bbrala avatar Jan 20 '22 14:01 bbrala

Yup, so basically, (and I should add something like this to the README and maybe the relevant core issues too) we have:

  • the project root, which is where the top-level composer.json is. That's what Composer knows about, since it runs from there.
  • the app root, also known as the Drupal root, which is where the entry-point index.php is. Drupal core makes assumptions about where that is, which we need to work around (and ideally fix).
  • the scaffold location, which is where the scaffolding plugin puts index.php. That's the same as the app root in this project template's setup

If the Drupal package is symlinked in, then nothing in that package is capable of knowing where the app root is. That information is only known to scaffolded files (because that's where they are) and Composer (because it has the scaffold location defined in composer.json).

joachim-n avatar Jan 21 '22 10:01 joachim-n

I was investigating a little more and something we also do in our projects is change the autoload.php in the directory above core to point at the other vendor directory outside the core directory from the git repository. This kinda means you still need a change in the core files.

Also, in my setup in this branch, drush gets confused in where to find its plugins. It detects the drupal-root perfectly as /repos/drupal/ but when goes to find plugins it still gets confused, i suspect because of the symlinked vendor directory.

Anyways, i'm starting to think i might not be able to do this without patched core files indeed. Perhaps the excersise i'm doing is wasted effort :)

bbrala avatar Jan 21 '22 10:01 bbrala

Thanks for investigating anyway, it's always interesting to have new ideas and approaches!

I'd like to get core fixed so we don't need to patch it -- there's a link to the issue in the README.

Also, if you have any light you can shed on #10 that would be super!

joachim-n avatar Jan 21 '22 10:01 joachim-n