From b37ce633fe7264098dfd64919e9bff5a293bd0f7 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Wed, 27 Apr 2011 10:03:43 +0100 Subject: [PATCH] Added maven support to build process --- README | 2 ++ build.py | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README b/README index dbd86a66..3059603f 100644 --- 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: diff --git a/build.py b/build.py index 4c594e7f..9a27a792 100755 --- 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... -- 2.30.2