diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2018-02-15 22:58:17 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2018-02-15 22:58:40 +0100 |
| commit | 2ca250f508f795fa786ea3b41f61a451a511a4a0 (patch) | |
| tree | 3779911a9f01bf1e9ba0e3f716a4fb3379659aa8 /bin | |
| parent | 5ea5ec068a5cd7d4b1328b6c14a34d17ac69f69d (diff) | |
Add option for not running generate*Sources task before check
For large projects running generate*Sources can incur a heavy cost
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/flycheck-android-java.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/flycheck-android-java.py b/bin/flycheck-android-java.py index 9bbb31a..4919c52 100644 --- a/bin/flycheck-android-java.py +++ b/bin/flycheck-android-java.py @@ -121,7 +121,7 @@ Otherwise return None.""" return None def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, - variant, force=False): + variant, run_gen, force=False): """Get options for Java compilation from gradle project and run javac.""" (cmd, mtime, projectdir) = get_gradle_command_and_project_mtime( os.path.dirname(sourcefile)) @@ -212,7 +212,7 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, fallback = data files = file_in_list(sourcefile, data['files']) if files: - if v['gen'] < len(gen): + if run_gen and v['gen'] < len(gen): subprocess.call(cmd + ['-q'] + gen[v['gen']]) ret = run_javac(data['encoding'], data['source'], @@ -232,7 +232,7 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, fallback = data files = file_in_list(sourcefile, data['files']) if files: - if v['gen'] < len(gen): + if run_gen and v['gen'] < len(gen): subprocess.call(cmd + ['-q'] + gen[v['gen']]) ret = run_javac(data['encoding'], data['source'], @@ -247,7 +247,7 @@ def figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, if cached and os.path.exists(sourcefile): return figure_out_java_compilation(sessiondir, sourcefile, tempfile, checkstyle, variant, - force=True) + run_gen, force=True) # OK, perhaps file doesn't exist yet or not yet added to gradle, # whatever, assume the first group is good enough if fallback: @@ -290,6 +290,8 @@ def main(argv): parser.add_argument('--checkstyle-config') parser.add_argument('--checkstyle-properties') parser.add_argument('--variant') + parser.add_argument('--skip-gen', dest='gen', action='store_const', + const=False, default=True) parser.add_argument('sessiondir', nargs='?') parser.add_argument('sourcefile') parser.add_argument('tempfile', nargs='?') @@ -307,6 +309,6 @@ def main(argv): sourcefile = os.path.abspath(sourcefile) return figure_out_java_compilation(args.sessiondir, sourcefile, tempfile, - checkstyle, args.variant) + checkstyle, args.variant, args.gen) sys.exit(main(sys.argv)) |
