Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

322 lines (265 sloc) 11.435 kB
<?xml version="1.0"?>
<project name="DrupalDistroBuilder"
description="Build a custom Drupal distribution."
basedir="."
default="main"
>
<!--
Drupal Distribution Builder
Copyright (c) 2009, Matt Butcher, some rights reserved.
THIS PARTICULAR FILE IS CONSIDERED TO BE PUBLIC DOMAIN. No license whatsoever is asserted over build.xml. The source code in src/* is licensed under the LGPL 2.1.
-->
<!--
Include properties.
Having this first allows all properties to be overridden.
-->
<property file="drupal.properties"/>
<!-- Global properties -->
<property name="destdir" value="."/>
<property name="srcdir" value="./src"/>
<property name="destdir" value="."/>
<property name="builddir" value="./src/tmp/build"/>
<property name="currcomponent" value="autoload"/>
<property name="tmpdir" value="./src/tmp"/>
<property name="installdir" value="${destdir}/drupal"/>
<!-- Include path -->
<property name="phing.includes" value="${srcdir}"/>
<!-- Default version. -->
<property name="drupal.core.version" value="6.x"/>
<!-- Path to extra commands -->
<includepath classpath="${phing.includes}"/>
<!-- Tasks for working directly with Drupal. -->
<taskdef classname="lib.Task.DrupalDownloadTask" name="getdrupal"/>
<taskdef classname="lib.Task.DrupalComponentDownloadTask" name="getcomponent"/>
<taskdef classname="lib.Task.DrupalExistingComponentTask" name="existingmodules"/>
<taskdef classname="lib.Task.HttpDownloadTask" name="download"/>
<taskdef classname="lib.Task.DrupalComponentInfoTask" name="showcomponent"/>
<!-- Files that must be included in the release -->
<fileset id="licensefiles" dir=".">
<include name="README"/>
<include name="INSTALL"/>
</fileset>
<!-- Files to be treated as source code -->
<fileset id="sourcecode" dir="">
<include name="**/*" />
</fileset>
<!--
==========================
TARGETS
==========================
-->
<target name="test">
<!-- download url="http://localhost:8888/drupal-6.2.tar.gz" tofile="${tmpdir}/foo.tgz"/ -->
<existingmodules recursive="false"
dir="${builddir}/drupal/sites/all/modules"
onlyupgrades="yes"
pinlist="${drupal.pin.modules}"/>
<echo>Existing modules: ${drupal.modules.existing}</echo>
<echo>Available updates: ${drupal.modules.available.updates}</echo>
</target>
<target name="help">
<echo>
This tool can be used to manage building, deploying, and maintaining
Drupal distributions.
Common usages:
Build a custom distribution including all of the modules defined in
the drupal.properties file:
$ phing
The above will create a date/time-stamped tarball of the latest version of
Drupal along with all of the modules you have specified.
$ phing explain
The above will display information about what target directories are defined
and what modules will be installed. However, it does not perform any
modifications to files.
$ phing -Dinstalldir=./foo install
This does the same as the above, except that instead of building a tarball,
it places the entire Drupal distribution in the directory passed as
-Dinstalldir (in this case, ./foo). If the directory is visible to the
webserver, you should be able to immediately run install.php from your web
browser.
It is easier to set 'installdir' in drupal.properties, and then do this:
$ phing install
Then, installdir will be used to determine where to place files.
You can also install individual modules into 'installdir' with this command:
$ phing mod -Download=querypath
This will install the querypath module. You can install multiple modules using the same format as you would use in drupal.properties:
$ phing mod -Download=querypath,amplify,quiz
The above will install querypath, amplify, and quiz. Note that you must not leave whitespace between module names, as the shell will interpret those as separate arguments.
$ phing upgrade
This will perform all necessary module updates. It does this by inspecting
the installation's sites/all/modules directory and then checking Drupal.org's
servers to see what updates are available. Any necessary updates will be
downloaded and installed.
Don't want a particular module to be updated? Add it to the pin list in
drupal.properties.
By default, modules in sites/default/modules are not automatically updated
because by convention only custom modules go there. To alter this behavior,
you can modify the build.xml file for updateModules.
$ phing clean
Remove all downloaded files and build directories. (This does NOT delete
the files in the installdir, so it is safe to run after phing install)
$ phing -l
List all available targets along with a short help message.
</echo>
</target>
<target name="explain">
<echo>
=============================================================
Drupal version: ${drupal.core.version}
Modules to Add: ${drupal.modules}
Themes to Add: ${drupal.themes}
Core Modules to Remove: ${drupal.exclude.modules}
Core Themes to Remove: ${drupal.exclude.themes}
Temporary directory for downloads: ${tmpdir}
Build directory: ${builddir}
Installation dir (for 'install' task): ${installdir}
=============================================================
To set installdir, use the -Dinstalldir=/path argument:
$ phing -Dinstalldir=./foo install
You can test this with the following command:
$ phing -Dinstalldir=./foo explain
=============================================================
</echo>
</target>
<!-- Main Target:
This fetches Drupal, your modules, and your themes. Then it prunes unwanted
modules and themes from core. Then it packages up a shiny new custom Drupal
tarball and cleans up after itself.
-->
<target name="main" description="main target"
depends="getDrupal,getModules,getThemes,pruneCore,repackage,clean">
</target>
<!-- Update target:
This tries to update Drupal and all of the modules.
-->
<target name="update" description="Update a given installation. Override the downloaddestination property to tell this what path to update."
depends="updateModules">
</target>
<target name="install" description="Put a fresh installation in ${installdir}."
depends="getDrupal,getModules,getThemes,pruneCore,installAll"/>
<!-- Fetch the latest version of Drupal. -->
<target name="getDrupal" description="Get Drupal from Drupal.org">
<echo>Now retrieving ${drupal.core.version}.</echo>
<getdrupal dir="${tmpdir}" majorversion="${drupal.core.version}"/>
<echo>Fetched ${drupal.version} from ${drupal.url}</echo>
<mkdir dir="${tmpdir}/unpack"/>
<untar file="${tmpdir}/drupal-${drupal.version}.tgz" todir="${tmpdir}/unpack"/>
<copy todir="${builddir}">
<mapper type="regexp" from="^drupal-[\.0-9a-z\-]+\/(.*)" to="drupal/\1"/>
<fileset dir="${tmpdir}/unpack/">
<include name="**"/>
</fileset>
</copy>
</target>
<!-- Updated all modules except for those in the pinlist. -->
<target name="updateDrupal">
<property name="downloaddestination"
value="${builddir}/drupal/sites/all/modules"
override="yes"/>
<!--
This should probably getDrupal and then mv the contents to the named path.
-->
<echo>Doing nothing: ${downloaddestination}</echo>
</target>
<!-- Fetch the latest version of a package (module or theme). -->
<target name="downloadPackage">
<getcomponent component="${currcomponent}" dir="${tmpdir}" drupalVersion="${drupal.core.version}"/>
<echo>${component.name}-${component.version}</echo>
<untar file="${tmpdir}/${currcomponent}-dl.tgz" todir="${tmpdir}/unpack"/>
<copy todir="${downloaddestination}">
<fileset dir="${tmpdir}/unpack">
<include name="${component.name}/**"/>
</fileset>
</copy>
</target>
<target name="showPackage">
<showcomponent component="${currcomponent}" drupalVersion="${drupal.core.version}"/>
<echo>${component.name}-${component.version}</echo>
</target>
<target name="mod">
<!-- for -Download -->
<property name="ownload" value="" override="yes"/>
<property name="downloaddestination" value="${installdir}/sites/all/modules"
override="yes"/>
<foreach list="${ownload}" param="currcomponent" target="downloadPackage"/>
</target>
<target name="info">
<!-- for -Download -->
<property name="ownload" value="" override="yes"/>
<foreach list="${ownload}" param="currcomponent" target="showPackage"/>
</target>
<!-- Fetch all desired modules. -->
<target name="getModules">
<property name="downloaddestination"
value="${builddir}/drupal/sites/all/modules"
override="yes"/>
<mkdir dir="${builddir}/drupal/sites/all/modules"/>
<foreach list="${drupal.modules}" param="currcomponent"
target="downloadPackage"/>
</target>
<!-- Updated all modules except for those in the pinlist. -->
<target name="updateModules">
<property name="downloaddestination"
value="${builddir}/drupal/sites/all/modules"
override="yes"/>
<existingmodules recursive="false"
dir="${downloaddestination}"
pinlist="${drupal.pin.modules}"/>
<echo>Existing modules: ${drupal.modules.existing}</echo>
<foreach list="${drupal.modules.available.updates}" param="currcomponent"
target="downloadPackage"/>
</target>
<!-- Fetch all desired themes. -->
<target name="getThemes" depends="getDrupal">
<property name="downloaddestination"
value="${builddir}/drupal/sites/all/themes"
override="yes"/>
<mkdir dir="${builddir}/drupal/sites/all/themes"/>
<foreach list="${drupal.themes}" param="currcomponent" target="downloadPackage"/>
</target>
<target name="deletePackage">
<echo>Deleting ${ickypackage} from ${deletetype}.</echo>
<delete includeemptydirs="true">
<fileset dir="${builddir}/drupal/${deletetype}">
<include name="${ickypackage}/**"/>
<include name="**/${ickypackage}/**"/>
</fileset>
</delete>
</target>
<!-- Remove modules/themes that we don't want. -->
<target name="pruneCore">
<property name="deletetype" value="themes"/>
<foreach list="${drupal.exclude.themes}" param="ickypackage"
target="deletePackage"/>
<property name="deletetype" value="modules" override="yes"/>
<foreach list="${drupal.exclude.modules}" param="ickypackage"
target="deletePackage"/>
</target>
<!-- Package the entire thing into a tarball. -->
<target name="repackage" depends="getDrupal">
<tstamp/>
<tar destfile="${destdir}/drupal-${drupal.version}-${DSTAMP}-${TSTAMP}.tgz"
compression="gzip">
<fileset dir="${builddir}">
<include name="drupal/**"/>
</fileset>
</tar>
</target>
<target name="installAll" depends="getDrupal">
<copy todir="${installdir}">
<fileset dir="${builddir}/drupal">
<include name="**"/>
</fileset>
</copy>
</target>
<!-- Remove all of the build data. -->
<target name="clean" description="Clean out temporary data.">
<delete includeemptydirs="true">
<fileset dir="${tmpdir}">
<include name="*.tgz"/>
<include name="unpack/**"/>
<include name="build/**"/>
</fileset>
</delete>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.