aedi: ability to skip source code operations

This commit is contained in:
alexey.lysiuk 2021-03-13 16:53:14 +02:00
parent a11b7fcc20
commit a87e06540d
2 changed files with 14 additions and 3 deletions

View file

@ -38,6 +38,7 @@ class Builder(object):
state = self._state = BuildState()
state.xcode = arguments.xcode
state.checkout_commit = arguments.checkout_commit
state.skip_checkout = arguments.skip_checkout
state.verbose = arguments.verbose
self._platforms = []
@ -287,10 +288,14 @@ class Builder(object):
group.add_argument('--target', choices=self._targets.keys(), help='target to build')
group.add_argument('--source', metavar='path', help='path to target\'s source code')
group = parser.add_mutually_exclusive_group()
group.add_argument('--checkout-commit', metavar='commit',
help='source code commit or tag to checkout')
group.add_argument('--skip-checkout', action='store_true',
help='avoid any operations with source code')
group = parser.add_argument_group()
group.add_argument('--xcode', action='store_true', help='generate Xcode project instead of build')
group.add_argument('--checkout-commit', metavar='commit',
help='target\'s source code commit or tag to checkout')
group.add_argument('--source-path', metavar='path',
help='path to store downloaded and checked out source code')
group.add_argument('--build-path', metavar='path', help='target build path')

View file

@ -44,9 +44,11 @@ class BuildState:
self.output_path = None
self.install_path = None
self.checkout_commit = None
self.skip_checkout = False
self.platform = None
self.xcode = False
self.checkout_commit = None
self.verbose = False
self.jobs = 1
@ -70,9 +72,13 @@ class BuildState:
def checkout_git(self, url: str, branch: str = 'master'):
if os.path.exists(self.source):
if self.skip_checkout:
return
args = ('git', 'fetch', '--all', '--tags')
subprocess.run(args, cwd=self.source, check=True)
else:
assert not self.skip_checkout
args = ('git', 'clone', '--recurse-submodules', url, self.source)
subprocess.run(args, cwd=self.root_path, check=True)