# We need to clean via the build tool in case the binary dirs are
# different from the default ones
p = None
- if thisbuild.get('maven', 'no') != 'no':
+ if thisbuild['type'] == 'maven':
print "Cleaning Maven project..."
cmd = [config['mvn3'], 'clean', '-Dandroid.sdk.path=' + config['sdk_path']]
maven_dir = root_dir
p = FDroidPopen(cmd, cwd=maven_dir)
- elif thisbuild.get('gradle', 'no') != 'no':
+
+ elif thisbuild['type'] == 'gradle':
print "Cleaning Gradle project..."
cmd = [config['gradle'], 'clean']
gradle_dir = root_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..."
- cmd = ['ant', 'clean']
- p = FDroidPopen(cmd, cwd=root_dir)
+ p = FDroidPopen(['ant', 'clean'], cwd=root_dir)
if p is not None and p.returncode != 0:
raise BuildException("Error cleaning %s:%s" %
p = None
# Build the release...
- if thisbuild.get('maven', 'no') != 'no':
+ if thisbuild['type'] == 'maven':
print "Building Maven project..."
if '@' in thisbuild['maven']:
bindir = os.path.join(root_dir, 'target')
- elif thisbuild.get('kivy', 'no') != 'no':
+ elif thisbuild['type'] == 'kivy':
print "Building Kivy project..."
spec = os.path.join(root_dir, 'buildozer.spec')
cmd.append('release')
p = FDroidPopen(cmd, cwd=distdir)
- elif thisbuild.get('gradle', 'no') != 'no':
+ elif thisbuild['type'] == 'gradle':
print "Building Gradle project..."
if '@' in thisbuild['gradle']:
flavour = thisbuild['gradle'].split('@')[0]
if 'bindir' in thisbuild:
bindir = os.path.join(build_dir, thisbuild['bindir'])
- if thisbuild.get('maven', 'no') != 'no':
+ if thisbuild['type'] == 'maven':
stdout_apk = '\n'.join([
line for line in p.stdout.splitlines() if any(a in line for a in ('.apk','.ap_'))])
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
raise BuildException('Failed to find output')
src = m.group(1)
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(
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
- elif thisbuild.get('gradle', 'no') != 'no':
+ elif thisbuild['type'] == 'gradle':
dd = build_dir
if 'subdir' in thisbuild:
dd = os.path.join(dd, thisbuild['subdir'])
# Generate (or update) the ant build file, build.xml...
updatemode = build.get('update', 'auto')
- if (updatemode != 'no'
- and build.get('maven', 'no') == 'no'
- and build.get('kivy', 'no') == 'no'
- and build.get('gradle', 'no') == 'no'):
+ if (updatemode != 'no' and build['type'] == 'ant'):
parms = [os.path.join(config['sdk_path'], 'tools', 'android'),
'update', 'project']
if 'target' in build and build['target']:
f.close()
flavour = None
- if build.get('gradle', 'no') != 'no':
+ if build['type'] == 'gradle':
flavour = build['gradle'].split('@')[0]
if flavour in ['main', 'yes', '']:
flavour = None
"""
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: