mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-07-14 21:10:09 +02:00
Make gradle and antcommands (previously antcommand) proper lists
This commit is contained in:
parent
ce25054648
commit
a195556378
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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'):
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user