Skip to content

Instantly share code, notes, and snippets.

@geerlingguy geerlingguy/build.xml
Last active Apr 11, 2017

Embed
What would you like to do?
build.xml file to support Config Split in BLT.
<project name="custom" default="build">
<!-- Override setup:update task for config import. -->
<target name="setup:update" description="Update current database to reflect the state of the Drupal file system.">
<!-- enable_property and uninstall_property must be set at this time. -->
<phingcall target="setup:toggle-modules"/>
<!-- Execute db updates. -->
<drush command="updb" assume="yes" alias="${drush.alias}">
<option name="entity-updates"></option>
</drush>
<!-- Addition: Import config split. -->
<drush command="cache-clear" assume="yes" alias="${drush.alias}">
<param>drush</param>
</drush>
<if>
<or>
<equals arg1="${environment}" arg2="local" />
<equals arg1="${environment}" arg2="ci" />
</or>
<then>
<drush command="config-split-import" assume="yes" alias="${drush.alias}">
<option name="split">${environment}</option>
</drush>
</then>
<!-- Cloud environments require vcs parameter. -->
<else>
<drush command="config-split-import" assume="yes" alias="${drush.alias}">
<param>vcs</param>
<option name="split">${environment}</option>
</drush>
</else>
</if>
<!-- Rebuild caches. -->
<drush command="cr" alias="${drush.alias}"/>
</target>
<!-- Override setup:drupal:install for CI installation with 'config-dir'. -->
<target name="setup:drupal:install"
description="Installs a specific Drupal site."
depends="setup:drupal:settings, setup:drush:settings, setup:hash-salt">
<if>
<istrue value="${drush.verbose}"/>
<then>
<echo level="verbose">Printing drush status...</echo>
<drush command="status"/>
</then>
</if>
<echo>Installing Drupal...</echo>
<drush command="site-install">
<option name="site-name">"${project.human_name}"</option>
<option name="site-mail">"${drupal.account.mail}"</option>
<option name="account-name">"${drupal.account.name}"</option>
<option name="account-pass">"${drupal.account.password}"</option>
<option name="account-mail">"${drupal.account.mail}"</option>
<!-- Addition: Add config-dir option so Drush overwrites config. -->
<option name="config-dir">../config/default</option>
<param>"${project.profile.name}"</param>
<param>"install_configure_form.update_status_module='array(FALSE,FALSE)'"</param>
</drush>
<phingcall target="setup:update"/>
<!-- Set sites directory file permissions. -->
<echo level="verbose">Making ${docroot}/sites/default writable...</echo>
<chmod mode="0755" failonerror="false">
<fileset dir="${docroot}/sites/default">
<type type="dir" />
<exclude name="files/**" />
</fileset>
</chmod>
<chmod mode="0644" failonerror="false">
<fileset dir="${docroot}/sites/default">
<type type="file" />
<exclude name="files/**" />
</fileset>
</chmod>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.