Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch adds an includes syntax for makefiles. It allows one makefile to include one or more external makefiles (either local or remote) and treat them as if their contents were part of the original makefile.
Basically the goal of the patch is to make this work:
includes[example] = "example.make"
includes[remote] = "http://www.example.com/remote.make"
Comment | File | Size | Author |
---|---|---|---|
#13 | 820992-13_includes.patch | 9.07 KB | alex_b |
#12 | 820992_includes_tests_v3.patch | 9.04 KB | yhahn |
#11 | 820992_includes_tests_v2.patch | 9 KB | yhahn |
#10 | 820992_includes_tests.patch | 9 KB | dmitrig01 |
#9 | 820992_includes_v2.patch | 7.52 KB | yhahn |
Comments
Comment #1
kepford CreditAttribution: kepford commentedGreat idea! +1
Comment #2
brentratliff CreditAttribution: brentratliff commentedDidn't try the patch yet, but great functionality. Would definitely use it.
Comment #3
dmitrig01 CreditAttribution: dmitrig01 commentedw00t! +1 subscribe!!!!!
Comment #4
Grayside CreditAttribution: Grayside commentedI used the following makefiles:
http://github.com/grayside/oa_fserver/raw/master/oa_fserver.make
Result:
Specifying the admin_menu to 3.x-alpha4 (just to be something different) seemed to work, although the EXAMPLE.make Tao could not be cloned from it's Git repository.
Comment #5
yhahn CreditAttribution: yhahn commentedI'm having no problem cloning Tao in the
EXAMPLE.make
makefile in several environments... check that you can do a git clone of it manually?On the error you're getting about a project being defined twice, this is expected behavior and I think we'll need to discuss separately if this is something we want to change. Projects that are added using the lazy
projects[] = foo
syntax can't be overridden cleanly by the including file unless we make some serious changes to the makefile validation code. Any other project syntax should work and allow overrides as part of the way info file parsing works, e.g.projects[foo][version] = 1.0
.Basically, this is a syntactical include and if the merging of makefiles wouldn't have been valid as a single file then they're not going to work split up across includes.
Comment #6
Grayside CreditAttribution: Grayside commentedThen the patch worked as expected ;)
Comment #7
dasjoYou could change the "defined twice" error to a warning where later definitions will overwrite the previous ones as this might be a common usecase
Comment #8
patricksettle CreditAttribution: patricksettle commentedGreat idea!
Would like it if the the includes (and patches) could be pulled in via version control. Besides the versioning control it would provide, it would also add a layer of security by allowing users to pull form private repositories.
Comment #9
yhahn CreditAttribution: yhahn commentedNew patch fixes problem where recursive makefile builds were not properly handling includes.
Comment #10
dmitrig01 CreditAttribution: dmitrig01 commentedNot testable :-( here is as far as i got
Comment #11
yhahn CreditAttribution: yhahn commentedGood catch. Updated to include relative to the including file, not the build base path.
Test now passes for me from both any directory and tests directory.
Comment #12
yhahn CreditAttribution: yhahn commentedSlight fix,
drush_make_valid_url()
should look for the include file as an absolute, not relative, URL.Comment #13
alex_b CreditAttribution: alex_b commentedWhen recursing through directories, $build_path would be passed on to drush_make_include_info_files() which is not enough to find the makefile to include; the full path to the makefile containing an include is necessary. The result is includes not being found if they are contained in a non top-level makefile.
This patch fixes the issue above and also adds an error message if an include file could not be found.
Comment #14
dmitrig01 CreditAttribution: dmitrig01 commentedoh, that's a really interesting problem -- good find. can we have a test for this?
Comment #15
dmitrig01 CreditAttribution: dmitrig01 commenteddecided it's not really necessary ;-).
Thanks for the code, I committed it.
Comment #17
greg.harveyWait, what? So drush make supports includes? And I was about to ask for that. COOL!! =D