chiark / gitweb /
Make gradle and antcommands (previously antcommand) proper lists
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 13 Sep 2014 11:01:08 +0000 (13:01 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 13 Sep 2014 11:01:08 +0000 (13:01 +0200)
docs/fdroid.texi
fdroidserver/build.py
fdroidserver/checkupdates.py
fdroidserver/common.py
fdroidserver/metadata.py

index c85fad9c00029451eb28c56515478dee5eb9c7c2..232f0a01422d7f9e0b7fe8af6cec482882bae78f 100644 (file)
@@ -1006,8 +1006,8 @@ builds happen correctly.
 Space-separated list of Gradle tasks to be run before the assemble task
 in a Gradle project build.
 
-@item antcommand=xxx
-Specify an alternate Ant command (target) instead of the default
+@item antcommands=<target1>[,<target2>,...]
+Specify an alternate set of Ant commands (target) instead of the default
 'release'. It can't be given any flags, such as the path to a build.xml.
 
 @item output=path/to/output.apk
index b38250e4b5fd4f123b93ef24e26fe6e35ce1421f..836835de7e2bfaa8bc563553a986f1ae9cd20b5b 100644 (file)
@@ -680,7 +680,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
 
     elif thisbuild['type'] == 'gradle':
         logging.info("Building Gradle project...")
-        flavours = thisbuild['gradle'].split(',')
+        flavours = thisbuild['gradle']
 
         if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
             flavours[0] = ''
@@ -705,8 +705,8 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
     elif thisbuild['type'] == 'ant':
         logging.info("Building Ant project...")
         cmd = ['ant']
-        if thisbuild['antcommand']:
-            cmd += [thisbuild['antcommand']]
+        if thisbuild['antcommands']:
+            cmd += thisbuild['antcommands']
         else:
             cmd += ['release']
         p = FDroidPopen(cmd, cwd=root_dir)
index 4c1b57287e8b81b5e49ab0f4d0bb45b4e91c6811..9bfd1151320dc16a80e5e59141388938c58b5ed4 100644 (file)
@@ -352,18 +352,17 @@ def fetch_autoname(app, tag):
     except VCSException:
         return None
 
-    flavour = None
+    flavours = None
     if len(app['builds']) > 0:
         if app['builds'][-1]['subdir']:
             app_dir = os.path.join(app_dir, app['builds'][-1]['subdir'])
         if app['builds'][-1]['gradle']:
-            flavour = app['builds'][-1]['gradle']
-    if flavour == 'yes':
-        flavour = None
+            flavours = app['builds'][-1]['gradle']
+    if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
+        flavours = None
 
-    logging.debug("...fetch auto name from " + app_dir +
-                  ((" (flavour: %s)" % flavour) if flavour else ""))
-    new_name = common.fetch_real_name(app_dir, flavour)
+    logging.debug("...fetch auto name from " + app_dir)
+    new_name = common.fetch_real_name(app_dir, flavours)
     commitmsg = None
     if new_name:
         logging.debug("...got autoname '" + new_name + "'")
@@ -375,7 +374,7 @@ def fetch_autoname(app, tag):
         logging.debug("...couldn't get autoname")
 
     if app['Current Version'].startswith('@string/'):
-        cv = common.version_name(app['Current Version'], app_dir, flavour)
+        cv = common.version_name(app['Current Version'], app_dir, flavours)
         if app['Current Version'] != cv:
             app['Current Version'] = cv
             if not commitmsg:
index e884568a81df5fb491c04b977fef6e59258af5b3..6e6dfbc0d1879900d04e8c61becde629d7c292d5 100644 (file)
@@ -825,7 +825,7 @@ def retrieve_string(app_dir, string, xmlfiles=None):
 
 
 # Return list of existing files that will be used to find the highest vercode
-def manifest_paths(app_dir, flavour):
+def manifest_paths(app_dir, flavours):
 
     possible_manifests = \
         [os.path.join(app_dir, 'AndroidManifest.xml'),
@@ -833,19 +833,20 @@ def manifest_paths(app_dir, flavour):
          os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
          os.path.join(app_dir, 'build.gradle')]
 
-    if flavour:
-        possible_manifests.append(
-            os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
+    if flavours:
+        for flavour in flavours:
+            possible_manifests.append(
+                os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
 
     return [path for path in possible_manifests if os.path.isfile(path)]
 
 
 # Retrieve the package name. Returns the name, or None if not found.
-def fetch_real_name(app_dir, flavour):
+def fetch_real_name(app_dir, flavours):
     app_search = re.compile(r'.*<application.*').search
     name_search = re.compile(r'.*android:label="([^"]+)".*').search
     app_found = False
-    for f in manifest_paths(app_dir, flavour):
+    for f in manifest_paths(app_dir, flavours):
         if not has_extension(f, 'xml'):
             continue
         logging.debug("fetch_real_name: Checking manifest at " + f)
@@ -866,8 +867,8 @@ def fetch_real_name(app_dir, flavour):
 
 
 # Retrieve the version name
-def version_name(original, app_dir, flavour):
-    for f in manifest_paths(app_dir, flavour):
+def version_name(original, app_dir, flavours):
+    for f in manifest_paths(app_dir, flavours):
         if not has_extension(f, 'xml'):
             continue
         string = retrieve_string(app_dir, original)
@@ -1209,11 +1210,11 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
         f.write(props)
         f.close()
 
-    flavour = None
+    flavours = None
     if build['type'] == 'gradle':
-        flavour = build['gradle']
-        if flavour in ['main', 'yes', '']:
-            flavour = None
+        flavours = build['gradle']
+        if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
+            flavours = None
 
         version_regex = re.compile(r".*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*")
         gradlepluginver = None
@@ -1256,7 +1257,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
     # Insert version code and number into the manifest if necessary
     if build['forceversion']:
         logging.info("Changing the version name")
-        for path in manifest_paths(root_dir, flavour):
+        for path in manifest_paths(root_dir, flavours):
             if not os.path.isfile(path):
                 continue
             if has_extension(path, 'xml'):
@@ -1275,7 +1276,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
                     raise BuildException("Failed to amend build.gradle")
     if build['forcevercode']:
         logging.info("Changing the version code")
-        for path in manifest_paths(root_dir, flavour):
+        for path in manifest_paths(root_dir, flavours):
             if not os.path.isfile(path):
                 continue
             if has_extension(path, 'xml'):
index 77ee09c8d55b4ced72ab8d664c740e7347337fe3..0b0106d09f62eea91b1a11ba2488e7d8be8ec145 100644 (file)
@@ -99,7 +99,7 @@ flag_defaults = OrderedDict([
     ('build', ''),
     ('buildjni', []),
     ('preassemble', []),
-    ('antcommand', None),
+    ('antcommands', None),
     ('novcheck', False),
     ])
 
@@ -528,7 +528,7 @@ def metafieldtype(name):
 
 def flagtype(name):
     if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
-                'update', 'scanignore', 'scandelete']:
+                'update', 'scanignore', 'scandelete', 'gradle', 'antcommands']:
         return 'list'
     if name in ['init', 'prebuild', 'build']:
         return 'script'