fix(bin/linja): show ninja error/warning
This commit is contained in:
parent
bf9ff192ca
commit
23ca9f0f76
1 changed files with 13 additions and 6 deletions
19
bin/linja
19
bin/linja
|
@ -155,7 +155,7 @@ def check_required_packages():
|
||||||
def make_deps(lean_file, dlean_file, olean_file):
|
def make_deps(lean_file, dlean_file, olean_file):
|
||||||
with open(dlean_file, "w") as f:
|
with open(dlean_file, "w") as f:
|
||||||
deps = []
|
deps = []
|
||||||
proc = subprocess.Popen([g_lean_path, "--deps", lean_file], stdout=subprocess.PIPE, stderr=None)
|
proc = subprocess.Popen([g_lean_path, "--deps", lean_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
output = proc.communicate()[0]
|
output = proc.communicate()[0]
|
||||||
print >> f, olean_file + ": \\"
|
print >> f, olean_file + ": \\"
|
||||||
for olean_file in output.strip().split("\n"):
|
for olean_file in output.strip().split("\n"):
|
||||||
|
@ -228,7 +228,10 @@ def build_clean():
|
||||||
return """build clean: CLEAN"""
|
return """build clean: CLEAN"""
|
||||||
|
|
||||||
def build_olean(lean, olean, clean, dlean, ilean, base):
|
def build_olean(lean, olean, clean, dlean, ilean, base):
|
||||||
str = """build %s %s %s: LEAN %s | %s\n""" % (olean, ilean, clean, lean, dlean)
|
if clean.startswith(base):
|
||||||
|
str = """build %s %s %s: LEAN %s | %s\n""" % (olean, ilean, clean, lean, dlean)
|
||||||
|
else:
|
||||||
|
str = """build %s %s: LEAN %s | %s\n""" % (olean, ilean, lean, dlean)
|
||||||
str += " DLEAN_FILE=%s\n" % dlean
|
str += " DLEAN_FILE=%s\n" % dlean
|
||||||
str += " OLEAN_FILE=%s\n" % olean
|
str += " OLEAN_FILE=%s\n" % olean
|
||||||
str += " CLEAN_FILE=%s\n" % clean
|
str += " CLEAN_FILE=%s\n" % clean
|
||||||
|
@ -260,7 +263,7 @@ def find_project_upward(path):
|
||||||
return find_project_upward(up)
|
return find_project_upward(up)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def handle_failure_for_flycheck(out, args):
|
def handle_failure_for_flycheck(out, err, args):
|
||||||
if len(args.targets) == 0:
|
if len(args.targets) == 0:
|
||||||
error("handle_failure_for_flycheck is called without targets")
|
error("handle_failure_for_flycheck is called without targets")
|
||||||
target = args.targets[0]
|
target = args.targets[0]
|
||||||
|
@ -275,6 +278,10 @@ def handle_failure_for_flycheck(out, args):
|
||||||
print "FLYCHECK_BEGIN ERROR"
|
print "FLYCHECK_BEGIN ERROR"
|
||||||
print "%s:1:0: error: failed to compile %s" % (target, failed_file)
|
print "%s:1:0: error: failed to compile %s" % (target, failed_file)
|
||||||
print "FLYCHECK_END"
|
print "FLYCHECK_END"
|
||||||
|
if err:
|
||||||
|
print "FLYCHECK_BEGIN ERROR"
|
||||||
|
print "%s:1:0: error: %s" % (target, err.strip())
|
||||||
|
print "FLYCHECK_END"
|
||||||
if failed:
|
if failed:
|
||||||
call_lean(target, args)
|
call_lean(target, args)
|
||||||
|
|
||||||
|
@ -329,12 +336,12 @@ def call_ninja(directory, args):
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
if args.flycheck:
|
if args.flycheck:
|
||||||
out = proc.communicate()[0]
|
(out, err) = proc.communicate()
|
||||||
if len(args.targets) == 1 and args.targets[0].endswith(".lean"):
|
if len(args.targets) == 1 and args.targets[0].endswith(".lean"):
|
||||||
print_flycheck_output_upto_n(targets[0], out, args.flycheck_max_messages)
|
print_flycheck_output_upto_n(targets[0], out, args.flycheck_max_messages)
|
||||||
handle_failure_for_flycheck(out, args)
|
handle_failure_for_flycheck(out, err, args)
|
||||||
else:
|
else:
|
||||||
print out
|
print out + err
|
||||||
|
|
||||||
return proc.returncode
|
return proc.returncode
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue