Skip to content
Snippets Groups Projects
Commit 0018bdfd authored by Yang Wang's avatar Yang Wang
Browse files

misc: exit when build script command fails

Change-Id: I70f8a48bd774978480a4f6828aa70ac932082c49
parent 5ec47bc3
No related branches found
No related tags found
No related merge requests found
...@@ -9,36 +9,31 @@ this_dir = os.path.dirname(os.path.realpath(__file__)) ...@@ -9,36 +9,31 @@ this_dir = os.path.dirname(os.path.realpath(__file__))
def execute_cmd(cmd, with_shell=False): def execute_cmd(cmd, with_shell=False):
p = subprocess.Popen(cmd, shell=with_shell) p = subprocess.Popen(cmd, shell=with_shell)
_, _ = p.communicate() _, _ = p.communicate()
if p.returncode != 0:
sys.exit(1)
return p.returncode return p.returncode
def build_daemon(parsed_args): def build_daemon(parsed_args):
make_cmd = os.path.dirname(this_dir) + '\\daemon\\compat\\msvc\\winmake.py' make_cmd = os.path.dirname(this_dir) + '\\daemon\\compat\\msvc\\winmake.py'
os.chdir(os.path.dirname(this_dir) + '\\daemon\\compat\\msvc') os.chdir(os.path.dirname(this_dir) + '\\daemon\\compat\\msvc')
status_code = execute_cmd('python ' + make_cmd + ' -iv -t ' + execute_cmd('python ' + make_cmd + ' -iv -t ' +
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -b daemon') parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -b daemon')
os.chdir(os.path.dirname(this_dir)) os.chdir(os.path.dirname(this_dir))
return status_code
def build_lrc(parsed_args): def build_lrc(parsed_args):
make_cmd = os.path.dirname(this_dir) + '\\lrc\\make-lrc.py' make_cmd = os.path.dirname(this_dir) + '\\lrc\\make-lrc.py'
return execute_cmd('python ' + make_cmd + ' -gb ' + ' -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver) execute_cmd('python ' + make_cmd + ' -gb ' + ' -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
def build_client(parsed_args): def build_client(parsed_args):
os.chdir('./client-qt') os.chdir('./client-qt')
ret = 0 execute_cmd('pandoc -f markdown -t html5 -o changelog.html changelog.md', True)
ret &= not execute_cmd( execute_cmd('python make-client.py -d')
'pandoc -f markdown -t html5 -o changelog.html changelog.md', True) execute_cmd('python make-client.py -b ' + '-t ' +
ret &= not execute_cmd('python make-client.py -d') parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
ret &= not execute_cmd('python make-client.py -b ' + '-t ' + execute_cmd('powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1' + ' "Release" ' + '"' + parsed_args.qtver + '"', True)
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
if not os.path.exists('./x64/Release/qt.conf'):
ret &= not execute_cmd(
'powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1' + ' "Release" ' + '"' + parsed_args.qtver + '"', True)
return ret
def parse_args(): def parse_args():
...@@ -57,20 +52,10 @@ def parse_args(): ...@@ -57,20 +52,10 @@ def parse_args():
def main(): def main():
parsed_args = parse_args() parsed_args = parse_args()
build_daemon(parsed_args)
if build_daemon(parsed_args) != 0: build_lrc(parsed_args)
print('daemon build failure!') build_client(parsed_args)
sys.exit(1)
if build_lrc(parsed_args) != 0:
print('lrc build failure!')
sys.exit(1)
if build_client(parsed_args) != 0:
print('client build failure!')
sys.exit(1)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment