Index: build/android/gyp/lint.py |
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py |
index 71c1a6fa09c9f0624900c4a2771d97db2b3f4f28..76eefa032597d0dc09e395b196cbaf924c3627eb 100755 |
--- a/build/android/gyp/lint.py |
+++ b/build/android/gyp/lint.py |
@@ -9,6 +9,7 @@ |
import argparse |
import os |
+import re |
import sys |
import traceback |
from xml.dom import minidom |
@@ -22,8 +23,8 @@ _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), |
def _OnStaleMd5(changes, lint_path, config_path, processed_config_path, |
manifest_path, result_path, product_dir, sources, jar_path, |
- cache_dir, resource_dir=None, can_fail_build=False, |
- silent=False): |
+ cache_dir, resource_dir=None, classpath=None, |
+ can_fail_build=False, silent=False): |
def _RelativizePath(path): |
"""Returns relative path to top-level src dir. |
@@ -79,6 +80,7 @@ def _OnStaleMd5(changes, lint_path, config_path, processed_config_path, |
# Need to include all sources when a resource_dir is set so that resources are |
# not marked as unused. |
+ # TODO(agrieve): Figure out how IDEs make do incremental lint. |
jbudorick
2016/03/31 20:05:26
s/make// ?
agrieve
2016/04/01 00:45:06
Done.
|
if not resource_dir and changes.AddedOrModifiedOnly(): |
changed_paths = set(changes.IterChangedPaths()) |
sources = [s for s in sources if s in changed_paths] |
@@ -91,11 +93,16 @@ def _OnStaleMd5(changes, lint_path, config_path, processed_config_path, |
'--xml', _RelativizePath(result_path), |
] |
if jar_path: |
+ # --classpath is just for .class files for this one target. |
cmd.extend(['--classpath', _RelativizePath(jar_path)]) |
if processed_config_path: |
cmd.extend(['--config', _RelativizePath(processed_config_path)]) |
if resource_dir: |
cmd.extend(['--resources', _RelativizePath(resource_dir)]) |
+ if classpath: |
+ # --libraries is the classpath (excluding active target). |
jbudorick
2016/03/31 20:05:26
this naming is now less than stellar, with jar_pat
agrieve
2016/04/01 00:45:06
Agree. Took me many minutes of reading through its
|
+ cp = ':'.join(_RelativizePath(p) for p in classpath) |
+ cmd.extend(['--libraries', cp]) |
# There may be multiple source files with the same basename (but in |
# different directories). It is difficult to determine what part of the path |
@@ -235,6 +242,7 @@ def main(): |
help='Paths to java files.') |
parser.add_argument('--manifest-path', |
help='Path to AndroidManifest.xml') |
+ parser.add_argument('--classpath', help='Classpath for the target') |
parser.add_argument('--processed-config-path', |
help='Path to processed lint suppressions file.') |
parser.add_argument('--resource-dir', |
@@ -246,7 +254,7 @@ def main(): |
parser.add_argument('--stamp', |
help='Path to touch on success.') |
- args = parser.parse_args() |
+ args = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:])) |
if args.enable: |
sources = [] |
@@ -275,6 +283,12 @@ def main(): |
input_paths.extend(build_utils.FindInDirectory(args.resource_dir, '*')) |
if sources: |
input_paths.extend(sources) |
+ classpath = None |
+ if args.classpath: |
+ classpath = build_utils.ParseGypList(args.classpath) |
+ # Faster to use .interface.jar. |
+ classpath = [re.sub(r'\.jar$', '.interface.jar', p) for p in classpath] |
jbudorick
2016/03/31 20:05:26
Do we know that a corresponding .interface.jar cla
agrieve
2016/04/01 00:45:06
Done, but had to rebase onto: https://codereview.c
|
+ input_paths.extend(sources) |
input_strings = [] |
if args.processed_config_path: |
@@ -291,6 +305,7 @@ def main(): |
args.jar_path, |
args.cache_dir, |
resource_dir=args.resource_dir, |
+ classpath=classpath, |
can_fail_build=args.can_fail_build, |
silent=args.silent), |
args, |