chiark / gitweb /
Added maven support to build process
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 27 Apr 2011 09:03:43 +0000 (10:03 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 27 Apr 2011 09:03:43 +0000 (10:03 +0100)
README
build.py

diff --git a/README b/README
index dbd86a66fadaf6bc0fb9979d4b955548218ecd45..3059603fab6534dedb51bee455bb0f885507ed42 100644 (file)
--- a/README
+++ b/README
@@ -25,6 +25,7 @@ To be able to auto-build packages, you're going to need:
 *The Android NDK
 *Ant
 *Ant Contrib Tasks (Debian package ant-contrib)
+*Maven (Debian package maven2)
 *JavaCC (Debian package javacc)
 *VCS clients: svn, git, hg, bzr
 *A keystore for holding release keys. (Safe, secure and well backed up!)
@@ -194,6 +195,7 @@ configuration to the build. These are:
                    need to enable this.
  fixapos=yes       Like fixtrans, but deals with an even older issue relating
                    to 'unescaped apostrophes' in translation strings.
+ maven=yes         Build with maven instead of ant
 
 Another example, using extra parameters:
 
index 4c594e7fb42ce4e5f01b3baeb0c40a3f9f635839..9a27a792936432671c6a122eb2f747404337f17c 100755 (executable)
--- a/build.py
+++ b/build.py
@@ -194,7 +194,8 @@ for app in apps:
                             sys.exit(1)
 
                 # Generate (or update) the ant build file, build.xml...
-                if thisbuild.get('update', 'yes') == 'yes':
+                if (thisbuild.get('update', 'yes') == 'yes' and
+                       not thisbuild.has_key('maven')):
                     parms = [os.path.join(sdk_path, 'tools', 'android'),
                              'update', 'project', '-p', '.']
                     parms.append('--subprojects')
@@ -419,12 +420,17 @@ for app in apps:
                         print output
 
                 # Build the release...
-                if thisbuild.has_key('antcommand'):
-                    antcommand = thisbuild['antcommand']
+                if thisbuild.has_key('maven'):
+                    p = subprocess.Popen(['mvn', 'clean', 'install',
+                        '-Dandroid.sdk.path=' + sdk_path],
+                        cwd=root_dir, stdout=subprocess.PIPE)
                 else:
-                    antcommand = 'release'
-                p = subprocess.Popen(['ant', antcommand], cwd=root_dir, 
-                        stdout=subprocess.PIPE)
+                    if thisbuild.has_key('antcommand'):
+                        antcommand = thisbuild['antcommand']
+                    else:
+                        antcommand = 'release'
+                    p = subprocess.Popen(['ant', antcommand], cwd=root_dir, 
+                            stdout=subprocess.PIPE)
                 output = p.communicate()[0]
                 if p.returncode != 0:
                     print output
@@ -443,10 +449,15 @@ for app in apps:
                     # Special case (again!) for funambol...
                     src = ("funambol-android-sync-client-" +
                             thisbuild['version'] + "-unsigned.apk")
+                elif thisbuild.has_key('maven'):
+                    src = re.match(r".*^\[INFO\] Installing /.*/([^/]*)\.apk",
+                            output, re.S|re.M).group(1)
+                    src = os.path.join(bindir, src) + '.apk'
+#[INFO] Installing /home/ciaran/fdroidserver/tmp/mainline/application/target/callerid-1.0-SNAPSHOT.apk
                 else:
                     src = re.match(r".*^.*Creating (\S+) for release.*$.*", output,
                         re.S|re.M).group(1)
-                src = os.path.join(bindir, src)
+                    src = os.path.join(bindir, src)
 
                 # By way of a sanity check, make sure the version and version
                 # code in our new apk match what we expect...