shutil.rmtree('builder')
os.mkdir('builder')
- p = subprocess.Popen('vagrant --version', shell=True,
+ p = subprocess.Popen(['vagrant', '--version'],
stdout=subprocess.PIPE)
vver = p.communicate()[0]
if vver.startswith('Vagrant version 1.2'):
if thisbuild['srclibs']:
for lib in thisbuild['srclibs']:
srclibpaths.append(
- common.getsrclib(lib, 'build/srclib', srclibpaths,
- basepath=True, prepare=False))
+ common.getsrclib(lib, 'build/srclib', basepath=True, prepare=False))
# If one was used for the main source, add that too.
basesrclib = vcs.getsrclib()
def adapt_gradle(build_dir):
+ filename = 'build.gradle'
for root, dirs, files in os.walk(build_dir):
- if 'build.gradle' in files:
- path = os.path.join(root, 'build.gradle')
- logging.debug("Adapting build.gradle at %s" % path)
+ for filename in files:
+ if not filename.endswith('.gradle'):
+ continue
+ path = os.path.join(root, filename)
+ if not os.path.isfile(path):
+ continue
+ logging.debug("Adapting %s at %s" % (filename, path))
FDroidPopen(['sed', '-i',
- r's@buildToolsVersion\([ =]*\)["\'][0-9\.]*["\']@buildToolsVersion\1"'
+ r's@buildToolsVersion\([ =]\+\).*@buildToolsVersion\1"'
+ config['build_tools'] + '"@g', path])
sys.exit(3)
# Set up environment vars that depend on each build
- for n in ['ANDROID_NDK', 'NDK']:
+ for n in ['ANDROID_NDK', 'NDK', 'ANDROID_NDK_HOME']:
common.env[n] = thisbuild['ndk_path']
+ common.reset_env_path()
+ # Set up the current NDK to the PATH
+ common.add_to_env_path(thisbuild['ndk_path'])
+
# Prepare the source code...
root_dir, srclibpaths = common.prepare_source(vcs, app, thisbuild,
build_dir, srclib_dir,
if flavours == ['yes']:
flavours = []
- flavours_cmd = ''.join(flavours)
- if flavours_cmd:
- flavours_cmd = capitalize_intact(flavours_cmd)
+ flavours_cmd = ''.join([capitalize_intact(f) for f in flavours])
gradletasks += ['assemble' + flavours_cmd + 'Release']
adapt_gradle(libpath)
cmd = [config['gradle']]
- cmd += ['clean' + capitalize_intact(task) for task in gradletasks]
+ for task in gradletasks:
+ parts = task.split(':')
+ parts[-1] = 'clean' + capitalize_intact(parts[-1])
+ cmd += [':'.join(parts)]
+
+ cmd += ['clean']
p = FDroidPopen(cmd, cwd=root_dir)
if 'gradle' in dirs:
shutil.rmtree(os.path.join(root, 'gradle'))
- if not options.skipscan:
+ if options.skipscan:
+ if thisbuild['scandelete']:
+ raise BuildException("Refusing to skip source scan since scandelete is present")
+ else:
# Scan before building...
logging.info("Scanning source for common problems...")
count = common.scan_source(build_dir, root_dir, thisbuild)
if count > 0:
if force:
- logging.warn('Scanner found %d problems:' % count)
+ logging.warn('Scanner found %d problems' % count)
else:
raise BuildException("Can't build due to %d errors while scanning" % count)
cmd += ' ./distribute.sh'
cmd += ' -m ' + "'" + ' '.join(modules) + "'"
cmd += ' -d fdroid'
- p = FDroidPopen(cmd, cwd='python-for-android', shell=True)
+ p = subprocess.Popen(cmd, cwd='python-for-android', shell=True)
if p.returncode != 0:
raise BuildException("Distribute build failed")
# Set up vcs interface and make sure we have the latest code...
logging.debug("Getting {0} vcs interface for {1}"
.format(app['Repo Type'], app['Repo']))
- vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir, build)
+ vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
first = False
tmp_dir, repo_dir, vcs, options.test,
options.server, options.force,
options.onserver):
+
+ if app.get('Binaries', None):
+ # This is an app where we build from source, and
+ # verify the apk contents against a developer's
+ # binary. We get that binary now, and save it
+ # alongside our built one in the 'unsigend'
+ # directory.
+ url = app['Binaries']
+ url = url.replace('%v', thisbuild['version'])
+ url = url.replace('%c', str(thisbuild['vercode']))
+ logging.info("...retrieving " + url)
+ of = "{0}_{1}.apk.binary".format(app['id'], thisbuild['vercode'])
+ of = os.path.join(output_dir, of)
+ common.download_file(url, local_filename=of)
+
build_succeeded.append(app)
wikilog = "Build succeeded"
except BuildException as be: