Problem/Motivation

I've added a composer.json file to a theme:
http://cgit.drupalcode.org/sailor/tree/composer.json
however, the dependencies in that file are ignored by Drupal Packagist.

$ composer info drupal/sailor
name     : drupal/sailor
descrip. : 
keywords : 
versions : * 1.0.0-rc2
type     : drupal-theme
license  : GPL-2.0+
source   : [git] https://git.drupal.org/project/sailor 8.x-1.0-rc2
dist     : [zip] https://ftp.drupal.org/files/projects/sailor-8.x-1.0-rc2.zip 8.x-1.0-rc2
names    : drupal/sailor

support
source : http://cgit.drupalcode.org/sailor

requires
drupal/core ~8.0

Proposed resolution

Merge a theme's `composer.json` file with what is generated (just like modules).

Remaining tasks

  1. Write Patch

User interface changes

None.

API changes

Theme's composer.json will be respected.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidwbarratt created an issue. See original summary.

davidwbarratt’s picture

Project: packages.drupal.org » Project Dependency

We are not parsing theme's dependencies:

function project_dependency_info_batch_process_release(array $release) {
  watchdog('project_dependency', 'Processing %uri release with repo %repo, label %tag', array('%uri' => $release['uri'], '%repo' => $release['repo'], '%tag' => $release['tag']), WATCHDOG_INFO, l(t('view release'), 'node/' . $release['nid']));
  $release_wrapper = entity_metadata_wrapper('node', $release['nid']);
  $project_type = $release_wrapper->field_release_project->type->value();
  if (!in_array($project_type, array('project_core', 'project_module'))) {
    return FALSE;
  }

We should parse theme's dependencies and put them into the database. It's either that, or Drupal.org Composer should ignore the dependency database and parse the dependencies directly.

davidwbarratt’s picture

Status: Active » Needs review
FileSize
959 bytes

I'm not sure what kind of errors this will throw, but maybe the tests will throw them for us. :)

davidwbarratt’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
trobey’s picture

Ever since I started maintaining Project Dependency a number of years ago I have been told that themes should be ignored for dependencies. Of course things are quite different now with Composer being used. I have no problem with including themes but I also do not know if there will be unintended consequences. I will try to get to this in the next day or so.

davidwbarratt’s picture

Yeah I mean it's still going to be ignored by Drupal, but it will be used by Drupal Packagist and Composer.

  • trobey committed 06adf02 on 7.x-2.x authored by davidwbarratt
    Issue #2922785 by davidwbarratt: Themes cannot define dependencies in...
trobey’s picture

Status: Needs review » Fixed

I tested this out. Before the patch

> drush pdpv sailor 8.x-1.0-rc2
Processing dependencies for sailor: 8.x-1.0-rc2
Skipped sailor: 8.x-1.0-rc2

After the patch

> drush pdpv sailor 8.x-1.0-rc2
Processing dependencies for sailor: 8.x-1.0-rc2
Array
(
    [sailor] => Array
        (
        )

)

The releases are processed when they are released so only releases after this change is deployed to Drupal.org will be picked up without manual fixes. I will try to contact someone early next week to get this deployed.

davidwbarratt’s picture

Has this been deployed?

trobey’s picture

Thanks for the reminder. I just pinged drumm but I may need to ping him again in the morning.

Mixologic’s picture

We probably need a follow up issue in project_composer, because it, too, is not likely processing themes.

drumm’s picture

Deployed, and dependencies are being calculated for all 1,461 themes with releases.

I skimmed project_composer and didn't spot anything specific which prevented themes from working well.

davidwbarratt’s picture

YAY! Thank you so much! Dreams do come true!

drumm’s picture

Parsing the dependencies is about half done, so that should complete in the next hour. For Composer, we’ll at least need to run the scripts which regenerate json for Drupal.org's Composer endpoint.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.