mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
Make matching of build types easier
This commit is contained in:
parent
96885fc8c8
commit
0bd7711eeb
3 changed files with 26 additions and 17 deletions
|
@ -400,7 +400,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
# We need to clean via the build tool in case the binary dirs are
|
# We need to clean via the build tool in case the binary dirs are
|
||||||
# different from the default ones
|
# different from the default ones
|
||||||
p = None
|
p = None
|
||||||
if thisbuild.get('maven', 'no') != 'no':
|
if thisbuild['type'] == 'maven':
|
||||||
print "Cleaning Maven project..."
|
print "Cleaning Maven project..."
|
||||||
cmd = [config['mvn3'], 'clean', '-Dandroid.sdk.path=' + config['sdk_path']]
|
cmd = [config['mvn3'], 'clean', '-Dandroid.sdk.path=' + config['sdk_path']]
|
||||||
|
|
||||||
|
@ -411,7 +411,8 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
maven_dir = root_dir
|
maven_dir = root_dir
|
||||||
|
|
||||||
p = FDroidPopen(cmd, cwd=maven_dir)
|
p = FDroidPopen(cmd, cwd=maven_dir)
|
||||||
elif thisbuild.get('gradle', 'no') != 'no':
|
|
||||||
|
elif thisbuild['type'] == 'gradle':
|
||||||
print "Cleaning Gradle project..."
|
print "Cleaning Gradle project..."
|
||||||
cmd = [config['gradle'], 'clean']
|
cmd = [config['gradle'], 'clean']
|
||||||
|
|
||||||
|
@ -422,10 +423,13 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
gradle_dir = root_dir
|
gradle_dir = root_dir
|
||||||
|
|
||||||
p = FDroidPopen(cmd, cwd=gradle_dir)
|
p = FDroidPopen(cmd, cwd=gradle_dir)
|
||||||
elif thisbuild.get('update', '.') != 'no' and thisbuild.get('kivy', 'no') == 'no':
|
|
||||||
|
elif thisbuild['type'] == 'kivy':
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif thisbuild['type'] == 'ant':
|
||||||
print "Cleaning Ant project..."
|
print "Cleaning Ant project..."
|
||||||
cmd = ['ant', 'clean']
|
p = FDroidPopen(['ant', 'clean'], cwd=root_dir)
|
||||||
p = FDroidPopen(cmd, cwd=root_dir)
|
|
||||||
|
|
||||||
if p is not None and p.returncode != 0:
|
if p is not None and p.returncode != 0:
|
||||||
raise BuildException("Error cleaning %s:%s" %
|
raise BuildException("Error cleaning %s:%s" %
|
||||||
|
@ -499,7 +503,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
p = None
|
p = None
|
||||||
# Build the release...
|
# Build the release...
|
||||||
if thisbuild.get('maven', 'no') != 'no':
|
if thisbuild['type'] == 'maven':
|
||||||
print "Building Maven project..."
|
print "Building Maven project..."
|
||||||
|
|
||||||
if '@' in thisbuild['maven']:
|
if '@' in thisbuild['maven']:
|
||||||
|
@ -526,7 +530,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
bindir = os.path.join(root_dir, 'target')
|
bindir = os.path.join(root_dir, 'target')
|
||||||
|
|
||||||
elif thisbuild.get('kivy', 'no') != 'no':
|
elif thisbuild['type'] == 'kivy':
|
||||||
print "Building Kivy project..."
|
print "Building Kivy project..."
|
||||||
|
|
||||||
spec = os.path.join(root_dir, 'buildozer.spec')
|
spec = os.path.join(root_dir, 'buildozer.spec')
|
||||||
|
@ -586,7 +590,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
cmd.append('release')
|
cmd.append('release')
|
||||||
p = FDroidPopen(cmd, cwd=distdir)
|
p = FDroidPopen(cmd, cwd=distdir)
|
||||||
|
|
||||||
elif thisbuild.get('gradle', 'no') != 'no':
|
elif thisbuild['type'] == 'gradle':
|
||||||
print "Building Gradle project..."
|
print "Building Gradle project..."
|
||||||
if '@' in thisbuild['gradle']:
|
if '@' in thisbuild['gradle']:
|
||||||
flavour = thisbuild['gradle'].split('@')[0]
|
flavour = thisbuild['gradle'].split('@')[0]
|
||||||
|
@ -642,7 +646,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if 'bindir' in thisbuild:
|
if 'bindir' in thisbuild:
|
||||||
bindir = os.path.join(build_dir, thisbuild['bindir'])
|
bindir = os.path.join(build_dir, thisbuild['bindir'])
|
||||||
|
|
||||||
if thisbuild.get('maven', 'no') != 'no':
|
if thisbuild['type'] == 'maven':
|
||||||
stdout_apk = '\n'.join([
|
stdout_apk = '\n'.join([
|
||||||
line for line in p.stdout.splitlines() if any(a in line for a in ('.apk','.ap_'))])
|
line for line in p.stdout.splitlines() if any(a in line for a in ('.apk','.ap_'))])
|
||||||
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
|
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
|
||||||
|
@ -657,10 +661,10 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
raise BuildException('Failed to find output')
|
raise BuildException('Failed to find output')
|
||||||
src = m.group(1)
|
src = m.group(1)
|
||||||
src = os.path.join(bindir, src) + '.apk'
|
src = os.path.join(bindir, src) + '.apk'
|
||||||
elif thisbuild.get('kivy', 'no') != 'no':
|
elif thisbuild['type'] == 'kivy':
|
||||||
src = 'python-for-android/dist/default/bin/{0}-{1}-release.apk'.format(
|
src = 'python-for-android/dist/default/bin/{0}-{1}-release.apk'.format(
|
||||||
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
|
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
|
||||||
elif thisbuild.get('gradle', 'no') != 'no':
|
elif thisbuild['type'] == 'gradle':
|
||||||
dd = build_dir
|
dd = build_dir
|
||||||
if 'subdir' in thisbuild:
|
if 'subdir' in thisbuild:
|
||||||
dd = os.path.join(dd, thisbuild['subdir'])
|
dd = os.path.join(dd, thisbuild['subdir'])
|
||||||
|
|
|
@ -918,10 +918,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
|
|
||||||
# Generate (or update) the ant build file, build.xml...
|
# Generate (or update) the ant build file, build.xml...
|
||||||
updatemode = build.get('update', 'auto')
|
updatemode = build.get('update', 'auto')
|
||||||
if (updatemode != 'no'
|
if (updatemode != 'no' and build['type'] == 'ant'):
|
||||||
and build.get('maven', 'no') == 'no'
|
|
||||||
and build.get('kivy', 'no') == 'no'
|
|
||||||
and build.get('gradle', 'no') == 'no'):
|
|
||||||
parms = [os.path.join(config['sdk_path'], 'tools', 'android'),
|
parms = [os.path.join(config['sdk_path'], 'tools', 'android'),
|
||||||
'update', 'project']
|
'update', 'project']
|
||||||
if 'target' in build and build['target']:
|
if 'target' in build and build['target']:
|
||||||
|
@ -992,7 +989,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
flavour = None
|
flavour = None
|
||||||
if build.get('gradle', 'no') != 'no':
|
if build['type'] == 'gradle':
|
||||||
flavour = build['gradle'].split('@')[0]
|
flavour = build['gradle'].split('@')[0]
|
||||||
if flavour in ['main', 'yes', '']:
|
if flavour in ['main', 'yes', '']:
|
||||||
flavour = None
|
flavour = None
|
||||||
|
@ -1406,7 +1403,7 @@ def FDroidPopen(commands, cwd=None):
|
||||||
"""
|
"""
|
||||||
Runs a command the FDroid way and returns return code and output
|
Runs a command the FDroid way and returns return code and output
|
||||||
|
|
||||||
:param commands, cwd: like subprocess.Popen
|
:param commands and cwd like in subprocess.Popen
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
|
|
|
@ -466,6 +466,11 @@ def parse_metadata(metafile):
|
||||||
thisinfo['comments'].append((key, comment))
|
thisinfo['comments'].append((key, comment))
|
||||||
del curcomments[:]
|
del curcomments[:]
|
||||||
|
|
||||||
|
def get_build_type(build):
|
||||||
|
for t in ['maven', 'gradle', 'kivy']:
|
||||||
|
if build.get(t, 'no') != 'no':
|
||||||
|
return t
|
||||||
|
return 'ant'
|
||||||
|
|
||||||
thisinfo = {}
|
thisinfo = {}
|
||||||
if metafile:
|
if metafile:
|
||||||
|
@ -620,6 +625,9 @@ def parse_metadata(metafile):
|
||||||
if not thisinfo['Description']:
|
if not thisinfo['Description']:
|
||||||
thisinfo['Description'].append('No description available')
|
thisinfo['Description'].append('No description available')
|
||||||
|
|
||||||
|
for build in thisinfo['builds']:
|
||||||
|
build['type'] = get_build_type(build)
|
||||||
|
|
||||||
return thisinfo
|
return thisinfo
|
||||||
|
|
||||||
# Write a metadata file.
|
# Write a metadata file.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue