From 38167e774934b643338f94201b16a922d80bc448 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 5 Dec 2017 13:30:14 +0100 Subject: Stop hardcoding generateDebugSources Instead we write a list of generate tasks to output of flycheckAndroidJava task and let the pyhton script run them Reason to do it like this is that when the FlycheckAndroidJava task is created it's to early to get the list of buildtypes or flavors from the extensions. --- bin/flycheck-android-java.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/flycheck-android-java.py b/bin/flycheck-android-java.py index ae52fe7..d4a54ca 100644 --- a/bin/flycheck-android-java.py +++ b/bin/flycheck-android-java.py @@ -147,8 +147,8 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, outdir = None if not output: - cmd.extend(['-q', 'flycheckAndroidJava']) - output = subprocess.check_output(cmd, universal_newlines=True) + flycheck_cmd = cmd + ['-q', 'flycheckAndroidJava'] + output = subprocess.check_output(flycheck_cmd, universal_newlines=True) if sessiondir != None: try: with open(cachefile, 'w') as f: @@ -157,12 +157,28 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, pass output = output.split('\n') + + generate = None + all_generate = [] + + for line in output: + if line == '***' or line == '!!!': + if generate: + all_generate.extend(generate) + + generate = [] if line == '!!!' else None + elif generate != None: + generate.append(line) + + if all_generate: + subprocess.call(cmd + ['-q'] + all_generate) + data = None first = None ret = 0 compiled = False for line in output: - if line == '***': + if line == '***' or line == '!!!': if data: if not first: first = data @@ -174,7 +190,7 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, data['args'], tempfile, outdir) compiled = True break - data = {} + data = {} if line == '***' else None elif data != None: if line.startswith('args='): data['args'] = line[6:-1].split(', ') -- cgit v1.2.3-70-g09d2