mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
Make gradle and antcommands (previously antcommand) proper lists
This commit is contained in:
parent
ce25054648
commit
a195556378
5 changed files with 29 additions and 29 deletions
|
@ -1006,8 +1006,8 @@ builds happen correctly.
|
||||||
Space-separated list of Gradle tasks to be run before the assemble task
|
Space-separated list of Gradle tasks to be run before the assemble task
|
||||||
in a Gradle project build.
|
in a Gradle project build.
|
||||||
|
|
||||||
@item antcommand=xxx
|
@item antcommands=<target1>[,<target2>,...]
|
||||||
Specify an alternate Ant command (target) instead of the default
|
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.
|
'release'. It can't be given any flags, such as the path to a build.xml.
|
||||||
|
|
||||||
@item output=path/to/output.apk
|
@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':
|
elif thisbuild['type'] == 'gradle':
|
||||||
logging.info("Building Gradle project...")
|
logging.info("Building Gradle project...")
|
||||||
flavours = thisbuild['gradle'].split(',')
|
flavours = thisbuild['gradle']
|
||||||
|
|
||||||
if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
|
if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
|
||||||
flavours[0] = ''
|
flavours[0] = ''
|
||||||
|
@ -705,8 +705,8 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
elif thisbuild['type'] == 'ant':
|
elif thisbuild['type'] == 'ant':
|
||||||
logging.info("Building Ant project...")
|
logging.info("Building Ant project...")
|
||||||
cmd = ['ant']
|
cmd = ['ant']
|
||||||
if thisbuild['antcommand']:
|
if thisbuild['antcommands']:
|
||||||
cmd += [thisbuild['antcommand']]
|
cmd += thisbuild['antcommands']
|
||||||
else:
|
else:
|
||||||
cmd += ['release']
|
cmd += ['release']
|
||||||
p = FDroidPopen(cmd, cwd=root_dir)
|
p = FDroidPopen(cmd, cwd=root_dir)
|
||||||
|
|
|
@ -352,18 +352,17 @@ def fetch_autoname(app, tag):
|
||||||
except VCSException:
|
except VCSException:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
flavour = None
|
flavours = None
|
||||||
if len(app['builds']) > 0:
|
if len(app['builds']) > 0:
|
||||||
if app['builds'][-1]['subdir']:
|
if app['builds'][-1]['subdir']:
|
||||||
app_dir = os.path.join(app_dir, app['builds'][-1]['subdir'])
|
app_dir = os.path.join(app_dir, app['builds'][-1]['subdir'])
|
||||||
if app['builds'][-1]['gradle']:
|
if app['builds'][-1]['gradle']:
|
||||||
flavour = app['builds'][-1]['gradle']
|
flavours = app['builds'][-1]['gradle']
|
||||||
if flavour == 'yes':
|
if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
|
||||||
flavour = None
|
flavours = None
|
||||||
|
|
||||||
logging.debug("...fetch auto name from " + app_dir +
|
logging.debug("...fetch auto name from " + app_dir)
|
||||||
((" (flavour: %s)" % flavour) if flavour else ""))
|
new_name = common.fetch_real_name(app_dir, flavours)
|
||||||
new_name = common.fetch_real_name(app_dir, flavour)
|
|
||||||
commitmsg = None
|
commitmsg = None
|
||||||
if new_name:
|
if new_name:
|
||||||
logging.debug("...got autoname '" + new_name + "'")
|
logging.debug("...got autoname '" + new_name + "'")
|
||||||
|
@ -375,7 +374,7 @@ def fetch_autoname(app, tag):
|
||||||
logging.debug("...couldn't get autoname")
|
logging.debug("...couldn't get autoname")
|
||||||
|
|
||||||
if app['Current Version'].startswith('@string/'):
|
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:
|
if app['Current Version'] != cv:
|
||||||
app['Current Version'] = cv
|
app['Current Version'] = cv
|
||||||
if not commitmsg:
|
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
|
# 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 = \
|
possible_manifests = \
|
||||||
[os.path.join(app_dir, 'AndroidManifest.xml'),
|
[os.path.join(app_dir, 'AndroidManifest.xml'),
|
||||||
|
@ -833,7 +833,8 @@ def manifest_paths(app_dir, flavour):
|
||||||
os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
|
os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
|
||||||
os.path.join(app_dir, 'build.gradle')]
|
os.path.join(app_dir, 'build.gradle')]
|
||||||
|
|
||||||
if flavour:
|
if flavours:
|
||||||
|
for flavour in flavours:
|
||||||
possible_manifests.append(
|
possible_manifests.append(
|
||||||
os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
|
os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
|
||||||
|
|
||||||
|
@ -841,11 +842,11 @@ def manifest_paths(app_dir, flavour):
|
||||||
|
|
||||||
|
|
||||||
# Retrieve the package name. Returns the name, or None if not found.
|
# 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
|
app_search = re.compile(r'.*<application.*').search
|
||||||
name_search = re.compile(r'.*android:label="([^"]+)".*').search
|
name_search = re.compile(r'.*android:label="([^"]+)".*').search
|
||||||
app_found = False
|
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'):
|
if not has_extension(f, 'xml'):
|
||||||
continue
|
continue
|
||||||
logging.debug("fetch_real_name: Checking manifest at " + f)
|
logging.debug("fetch_real_name: Checking manifest at " + f)
|
||||||
|
@ -866,8 +867,8 @@ def fetch_real_name(app_dir, flavour):
|
||||||
|
|
||||||
|
|
||||||
# Retrieve the version name
|
# Retrieve the version name
|
||||||
def version_name(original, app_dir, flavour):
|
def version_name(original, app_dir, flavours):
|
||||||
for f in manifest_paths(app_dir, flavour):
|
for f in manifest_paths(app_dir, flavours):
|
||||||
if not has_extension(f, 'xml'):
|
if not has_extension(f, 'xml'):
|
||||||
continue
|
continue
|
||||||
string = retrieve_string(app_dir, original)
|
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.write(props)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
flavour = None
|
flavours = None
|
||||||
if build['type'] == 'gradle':
|
if build['type'] == 'gradle':
|
||||||
flavour = build['gradle']
|
flavours = build['gradle']
|
||||||
if flavour in ['main', 'yes', '']:
|
if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
|
||||||
flavour = None
|
flavours = None
|
||||||
|
|
||||||
version_regex = re.compile(r".*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*")
|
version_regex = re.compile(r".*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*")
|
||||||
gradlepluginver = None
|
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
|
# Insert version code and number into the manifest if necessary
|
||||||
if build['forceversion']:
|
if build['forceversion']:
|
||||||
logging.info("Changing the version name")
|
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):
|
if not os.path.isfile(path):
|
||||||
continue
|
continue
|
||||||
if has_extension(path, 'xml'):
|
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")
|
raise BuildException("Failed to amend build.gradle")
|
||||||
if build['forcevercode']:
|
if build['forcevercode']:
|
||||||
logging.info("Changing the version code")
|
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):
|
if not os.path.isfile(path):
|
||||||
continue
|
continue
|
||||||
if has_extension(path, 'xml'):
|
if has_extension(path, 'xml'):
|
||||||
|
|
|
@ -99,7 +99,7 @@ flag_defaults = OrderedDict([
|
||||||
('build', ''),
|
('build', ''),
|
||||||
('buildjni', []),
|
('buildjni', []),
|
||||||
('preassemble', []),
|
('preassemble', []),
|
||||||
('antcommand', None),
|
('antcommands', None),
|
||||||
('novcheck', False),
|
('novcheck', False),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ def metafieldtype(name):
|
||||||
|
|
||||||
def flagtype(name):
|
def flagtype(name):
|
||||||
if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
|
if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
|
||||||
'update', 'scanignore', 'scandelete']:
|
'update', 'scanignore', 'scandelete', 'gradle', 'antcommands']:
|
||||||
return 'list'
|
return 'list'
|
||||||
if name in ['init', 'prebuild', 'build']:
|
if name in ['init', 'prebuild', 'build']:
|
||||||
return 'script'
|
return 'script'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue