build --test now always builds, even if output already exists (issue #333)

This commit is contained in:
Ciaran Gultnieks 2013-10-24 09:42:51 +01:00
parent c64bf8e479
commit 0ab39934b2

View file

@ -653,18 +653,30 @@ def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir,
""" """
Build a particular version of an application, if it needs building. Build a particular version of an application, if it needs building.
Returns True if the build was done, False if it wasn't necessary. :param output_dir: The directory where the build output will go. Usually
this is the 'unsigned' directory.
:param repo_dir: The repo directory - used for checking if the build is
necessary.
:paaram also_check_dir: An additional location for checking if the build
is necessary (usually the archive repo)
:param test: True if building in test mode, in which case the build will
always happen, even if the output already exists. In test mode, the
output directory should be a temporary location, not any of the real
ones.
:returns: True if the build was done, False if it wasn't necessary.
""" """
dest_apk = common.getapkname(app,thisbuild) dest_apk = common.getapkname(app, thisbuild)
dest = os.path.join(output_dir, dest_apk) dest = os.path.join(output_dir, dest_apk)
dest_repo = os.path.join(repo_dir, dest_apk) dest_repo = os.path.join(repo_dir, dest_apk)
if os.path.exists(dest) or (not test and os.path.exists(dest_repo)): if not test:
if os.path.exists(dest) or os.path.exists(dest_repo):
return False return False
if also_check_dir and not test: if also_check_dir:
dest_also = os.path.join(also_check_dir, dest_apk) dest_also = os.path.join(also_check_dir, dest_apk)
if os.path.exists(dest_also): if os.path.exists(dest_also):
return False return False
@ -700,7 +712,7 @@ def parse_commandline():
parser.add_option("-s", "--stop", action="store_true", default=False, parser.add_option("-s", "--stop", action="store_true", default=False,
help="Make the build stop on exceptions") help="Make the build stop on exceptions")
parser.add_option("-t", "--test", action="store_true", default=False, parser.add_option("-t", "--test", action="store_true", default=False,
help="Test mode - put output in the tmp directory only.") help="Test mode - put output in the tmp directory only, and always build, even if the output already exists.")
parser.add_option("--server", action="store_true", default=False, parser.add_option("--server", action="store_true", default=False,
help="Use build server") help="Use build server")
parser.add_option("--resetserver", action="store_true", default=False, parser.add_option("--resetserver", action="store_true", default=False,