jhbuild r2166 - in trunk: . doc/C jhbuild/modtypes modulesets
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2166 - in trunk: . doc/C jhbuild/modtypes modulesets
- Date: Sun, 13 Jul 2008 15:57:48 +0000 (UTC)
Author: fpeters
Date: Sun Jul 13 15:57:48 2008
New Revision: 2166
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2166&view=rev
Log:
* jhbuild/modtypes/ant.py, modulesets/moduleset.dtd, doc/C/jhbuild.xml:
added support for the Ant build tool. (initial patch by David Schleef,
closes: #537037)
Added:
trunk/jhbuild/modtypes/ant.py
Modified:
trunk/ChangeLog
trunk/doc/C/jhbuild.xml
trunk/modulesets/moduleset.dtd
Modified: trunk/doc/C/jhbuild.xml
==============================================================================
--- trunk/doc/C/jhbuild.xml (original)
+++ trunk/doc/C/jhbuild.xml Sun Jul 13 15:57:48 2008
@@ -73,7 +73,7 @@
<ulink url="http://www.selenic.com/mercurial/">Mercurial</ulink>
repositories, as well as Tar archives hosted on web or FTP sites;
and using a variety of build systems, including Autotools, CMake,
- WAF, Python Distutils and Perl Makefiles.
+ WAF, Ant, Python Distutils and Perl Makefiles.
</para>
<para>JHBuild is not intended as a replacement for the
@@ -2153,6 +2153,43 @@
</section>
+ <section id="moduleset-syntax-defs-ant">
+ <title>Ant</title>
+
+ <para>The <sgmltag class="element">ant</sgmltag> element is used to
+ define a module which is built using Ant, the Java based build tool.</para>
+
+ <programlisting>
+<ant id="<replaceable>modulename</replaceable>">
+ <branch [ ... ] >
+ [...]
+ </branch>
+
+ <dependencies>
+ <dep package="<replaceable>modulename</replaceable>"/>
+ ...
+ </dependencies>
+ <after>
+ <dep package="<replaceable>modulename</replaceable>"/>
+ ...
+ </after>
+</ant>
+</programlisting>
+
+ <example id="example-ant-module">
+ <title>Example of a module built with ant</title>
+ <programlisting><![CDATA[
+<repository type="svn" name="wikimedia"
+ href="http://svn.wikimedia.org/svnroot/"/>
+
+<ant id="cortado">
+ <branch repo="wikimedia" module="mediawiki/trunk/cortado"
+ checkoutdir="cortado"/>
+</ant>]]></programlisting>
+ </example>
+
+ </section>
+
<section id="moduleset-syntax-defs-testmodule">
<title>testmodule</title>
Added: trunk/jhbuild/modtypes/ant.py
==============================================================================
--- (empty file)
+++ trunk/jhbuild/modtypes/ant.py Sun Jul 13 15:57:48 2008
@@ -0,0 +1,132 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2001-2006 James Henstridge
+# Copyright (C) 2008 David Schleef
+#
+# ant.py: ant module type definitions.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+__metaclass__ = type
+
+import os
+
+from jhbuild.errors import BuildStateError, CommandError
+from jhbuild.modtypes import \
+ Package, get_dependencies, get_branch, register_module_type
+from jhbuild.commands.sanitycheck import inpath
+
+__all__ = [ 'AntModule' ]
+
+class AntModule(Package):
+ """Base type for modules that are built with Ant."""
+ type = 'ant'
+
+ STATE_CHECKOUT = 'checkout'
+ STATE_FORCE_CHECKOUT = 'force_checkout'
+ STATE_BUILD = 'build'
+ STATE_INSTALL = 'install'
+
+ def __init__(self, name, branch,
+ dependencies=[], after=[],
+ supports_non_srcdir_builds=False):
+ Package.__init__(self, name, dependencies, after)
+ self.branch = branch
+ self.supports_non_srcdir_builds = supports_non_srcdir_builds
+
+ def get_srcdir(self, buildscript):
+ return self.branch.srcdir
+
+ def get_builddir(self, buildscript):
+ if buildscript.config.buildroot and self.supports_non_srcdir_builds:
+ d = buildscript.config.builddir_pattern % (
+ os.path.basename(self.get_srcdir(buildscript)))
+ return os.path.join(buildscript.config.buildroot, d)
+ else:
+ return self.get_srcdir(buildscript)
+
+ def get_revision(self):
+ return self.branch.branchname
+
+ def do_start(self, buildscript):
+ pass
+ do_start.next_state = STATE_CHECKOUT
+ do_start.error_states = []
+
+ def skip_checkout(self, buildscript, last_state):
+ # skip the checkout stage if the nonetwork flag is set
+ return buildscript.config.nonetwork
+
+ def do_checkout(self, buildscript):
+ self.checkout(buildscript)
+ do_checkout.next_state = STATE_BUILD
+ do_checkout.error_states = [STATE_FORCE_CHECKOUT]
+
+ def skip_force_checkout(self, buildscript, last_state):
+ return False
+
+ def do_force_checkout(self, buildscript):
+ buildscript.set_action(_('Checking out'), self)
+ self.branch.force_checkout(buildscript)
+ do_force_checkout.next_state = STATE_BUILD
+ do_force_checkout.error_states = [STATE_FORCE_CHECKOUT]
+
+ def skip_build(self, buildscript, last_state):
+ return buildscript.config.nobuild
+
+ def do_build(self, buildscript):
+ buildscript.set_action(_('Building'), self)
+ srcdir = self.get_srcdir(buildscript)
+ builddir = self.get_builddir(buildscript)
+ ant = os.environ.get('ANT', 'ant')
+ if not inpath(ant, os.environ['PATH'].split(os.pathsep)):
+ raise CommandError(_('Missing ant build tool'))
+ cmd = [ant]
+ #if srcdir != builddir:
+ # cmd.extend(['--build-base', builddir])
+ buildscript.execute(cmd, cwd=srcdir)
+ do_build.next_state = STATE_INSTALL
+ do_build.error_states = [STATE_FORCE_CHECKOUT]
+
+ def skip_install(self, buildscript, last_state):
+ return buildscript.config.nobuild
+
+ def do_install(self, buildscript):
+ # Quoting David Schleef:
+ # "It's not clear to me how to install a typical
+ # ant-based project, so I left that out."
+ # -- http://bugzilla.gnome.org/show_bug.cgi?id=537037
+ buildscript.set_action(_('Installing'), self)
+ buildscript.packagedb.add(self.name, self.get_revision() or '')
+ do_install.next_state = Package.STATE_DONE
+ do_install.error_states = []
+
+
+def parse_ant(node, config, uri, repositories, default_repo):
+ id = node.getAttribute('id')
+ supports_non_srcdir_builds = False
+
+ if node.hasAttribute('supports-non-srcdir-builds'):
+ supports_non_srcdir_builds = \
+ (node.getAttribute('supports-non-srcdir-builds') != 'no')
+ dependencies, after, suggests = get_dependencies(node)
+ branch = get_branch(node, repositories, default_repo)
+ if config.module_checkout_mode.get(id):
+ branch.checkout_mode = config.module_checkout_mode[id]
+
+ return AntModule(id, branch,
+ dependencies=dependencies, after=after,
+ supports_non_srcdir_builds=supports_non_srcdir_builds)
+
+register_module_type('ant', parse_ant)
Modified: trunk/modulesets/moduleset.dtd
==============================================================================
--- trunk/modulesets/moduleset.dtd (original)
+++ trunk/modulesets/moduleset.dtd Sun Jul 13 15:57:48 2008
@@ -92,6 +92,11 @@
id CDATA #REQUIRED
makeargs CDATA #IMPLIED>
+<!ELEMENT ant (branch?,dependencies?,after?)>
+<!ATTLIST ant
+ id CDATA #REQUIRED
+ makeargs CDATA #IMPLIED>
+
<!ELEMENT testmodule (branch?,dependencies?,after?,testedmodules?)>
<!ATTLIST testmodule
id CDATA #REQUIRED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]