This patch creates a project_defaults array for specifying attributes common to all projects. For instance, the subdir attribute:

    ; Specify common subdir of "contrib"
    project_defaults[subdir] = "contrib"
    ; Override default value
    projects[devel][subdir] = "development"
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patcon’s picture

This is worlds beyond better than the alternative in #1109002: Setting the default subdir. Thanks @jhedstrom!

msonnabaum’s picture

Make has needed this for a long time, well done.

Patch looks good. Something looks off about the terminology, but I don't feel too strongly about it. I might have done this instead:

 defaults[project][subdir] = "contrib"

That looks cleaner to me and will let us have defaults for other non-projects.

patcon’s picture

Title: Create defaults array in .make files for specifying attributes common to all projects » Create project_defaults array in .make files for specifying attributes common to all projects
Status: Closed (fixed) » Needs review
defaults[projects][subdir] = "contrib"

++

jhedstrom’s picture

Great idea Mark. This patch switches to the more general defaults array, and also applies those prior to running validate so that these can still be used when packaging for d.o. w/o changes needed in drupalorg_drush.

jhedstrom’s picture

Opened #1653298: Allow new top-level attribute 'defaults' so these defaults could be used for packaging on d.o.

jhedstrom’s picture

Title: Create project_defaults array in .make files for specifying attributes common to all projects » Create defaults array in .make files for specifying attributes common to all projects
Status: Needs review » Fixed

Committed #4 in 02bf690 with slightly more verbose docs.

jonhattan’s picture

Category: feature » bug
Status: Fixed » Active

This makefile booms:

core = "7.x"
api = 2
defaults[projects][subdir] = contrib
projects[] = ctools

Defaults must be applied after projects[] is expanded.

jhedstrom’s picture

Status: Active » Fixed

That's quite the bug. I committed a fix in 1095329. Simply moving where defaults are applied cleared this up.

DamienMcKenna’s picture

The following downloads core to a directory named "contrib" rather than the current directory:

; in the top of the .make file
api = 2
core = 7.x
projects[drupal][version] = 7.14
defaults[projects][subdir] = contrib

And the command that I used:

$ drush make mymakefile.make . -y

Do you want me to open a new issue for this?

DamienMcKenna’s picture

FYI this is what I had to use to work around the bug mentioned in #9:

projects[drupal][subdir] = ''
jhedstrom’s picture

Category: bug » feature

@DamienMcKenna a new issue would be great--I think the fix is to disallow subdir on the core project, but I may be overlooking something.

Also, setting status back to feature request.

DamienMcKenna’s picture

Status: Fixed » Closed (fixed)

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

jyee’s picture

Title: Create project_defaults array in .make files for specifying attributes common to all projects » Create defaults array in .make files for specifying attributes common to all projects
Status: Needs review » Closed (fixed)

FWIW, the issue that affected core also applies to themes. So you end up with things like themes/contrib/themename instead of just themes/themename. Fix in #10 works to resolve the issue.

patcon’s picture

I feel this behavior for themes would be correct, right? These's are a type of project project that you tend to have contrib and custom directories for. When you're building an install profile, you've got your contrib themes and custom themes, and you use a gitignore like so:

*/contrib/
libraries
jhedstrom’s picture

Agree with #15 that using a contrib subdirectory for themes is okay, and even preferable. For those that want a subdir for modules, but not for themes, the syntax in #10 will work.