Commit c5e7f2bd authored by cjhopman@chromium.org's avatar cjhopman@chromium.org

Update lint and findbugs to use jars instead of class files

Now that this is done, we don't need to leave the class files laying
around anymore. So don't.

Review URL: https://codereview.chromium.org/458653002

Cr-Commit-Position: refs/heads/master@{#288971}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288971 0039d316-1c4b-4281-b951-d872f2087c98
parent dd4fdd8f
...@@ -20,7 +20,7 @@ _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ...@@ -20,7 +20,7 @@ _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
def _RunLint(lint_path, config_path, processed_config_path, manifest_path, def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
result_path, product_dir, src_dirs, classes_dir): result_path, product_dir, src_dirs, jar_path):
def _RelativizePath(path): def _RelativizePath(path):
"""Returns relative path to top-level src dir. """Returns relative path to top-level src dir.
...@@ -76,7 +76,7 @@ def _RunLint(lint_path, config_path, processed_config_path, manifest_path, ...@@ -76,7 +76,7 @@ def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
cmd = [ cmd = [
lint_path, '-Werror', '--exitcode', '--showall', lint_path, '-Werror', '--exitcode', '--showall',
'--config', _RelativizePath(processed_config_path), '--config', _RelativizePath(processed_config_path),
'--classpath', _RelativizePath(classes_dir), '--classpath', _RelativizePath(jar_path),
'--xml', _RelativizePath(result_path), '--xml', _RelativizePath(result_path),
] ]
for src in src_dirs: for src in src_dirs:
...@@ -135,7 +135,7 @@ def main(): ...@@ -135,7 +135,7 @@ def main():
parser.add_option('--result-path', help='Path to XML lint result file.') parser.add_option('--result-path', help='Path to XML lint result file.')
parser.add_option('--product-dir', help='Path to product dir.') parser.add_option('--product-dir', help='Path to product dir.')
parser.add_option('--src-dirs', help='Directories containing java files.') parser.add_option('--src-dirs', help='Directories containing java files.')
parser.add_option('--classes-dir', help='Directory containing class files.') parser.add_option('--jar-path', help='Jar file containing class files.')
parser.add_option('--stamp', help='Path to touch on success.') parser.add_option('--stamp', help='Path to touch on success.')
parser.add_option('--enable', action='store_true', parser.add_option('--enable', action='store_true',
help='Run lint instead of just touching stamp.') help='Run lint instead of just touching stamp.')
...@@ -146,7 +146,7 @@ def main(): ...@@ -146,7 +146,7 @@ def main():
options, parser, required=['lint_path', 'config_path', options, parser, required=['lint_path', 'config_path',
'processed_config_path', 'manifest_path', 'processed_config_path', 'manifest_path',
'result_path', 'product_dir', 'src_dirs', 'result_path', 'product_dir', 'src_dirs',
'classes_dir']) 'jar_path'])
src_dirs = build_utils.ParseGypList(options.src_dirs) src_dirs = build_utils.ParseGypList(options.src_dirs)
...@@ -156,7 +156,7 @@ def main(): ...@@ -156,7 +156,7 @@ def main():
rc = _RunLint(options.lint_path, options.config_path, rc = _RunLint(options.lint_path, options.config_path,
options.processed_config_path, options.processed_config_path,
options.manifest_path, options.result_path, options.manifest_path, options.result_path,
options.product_dir, src_dirs, options.classes_dir) options.product_dir, src_dirs, options.jar_path)
if options.stamp and not rc: if options.stamp and not rc:
build_utils.Touch(options.stamp) build_utils.Touch(options.stamp)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
'<(DEPTH)/build/android/gyp/lint.py', '<(DEPTH)/build/android/gyp/lint.py',
'<(DEPTH)/build/android/lint/suppressions.xml', '<(DEPTH)/build/android/lint/suppressions.xml',
'<(DEPTH)/build/android/AndroidManifest.xml', '<(DEPTH)/build/android/AndroidManifest.xml',
'<(lint_jar_path)',
], ],
'action': [ 'action': [
'python', '<(DEPTH)/build/android/gyp/lint.py', 'python', '<(DEPTH)/build/android/gyp/lint.py',
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
'--result-path=<(result_path)', '--result-path=<(result_path)',
'--product-dir=<(PRODUCT_DIR)', '--product-dir=<(PRODUCT_DIR)',
'--src-dirs=>(src_dirs)', '--src-dirs=>(src_dirs)',
'--classes-dir=<(classes_dir)', '--jar-path=<(lint_jar_path)',
'--stamp=<(stamp_path)', '--stamp=<(stamp_path)',
'<(is_enabled)', '<(is_enabled)',
], ],
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
'<(DEPTH)/build/android/gyp/util/md5_check.py', '<(DEPTH)/build/android/gyp/util/md5_check.py',
'<(DEPTH)/build/android/gyp/push_libraries.py', '<(DEPTH)/build/android/gyp/push_libraries.py',
'<(strip_stamp)', '<(strip_stamp)',
'<(strip_additional_stamp)',
'<(build_device_config_path)', '<(build_device_config_path)',
], ],
'outputs': [ 'outputs': [
......
...@@ -66,16 +66,17 @@ def _Rebaseline(current_warnings_set, known_bugs_file): ...@@ -66,16 +66,17 @@ def _Rebaseline(current_warnings_set, known_bugs_file):
return 0 return 0
def _GetChromeClasses(release_version): def _GetChromeJars(release_version):
version = 'Debug' version = 'Debug'
if release_version: if release_version:
version = 'Release' version = 'Release'
path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', version) path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', version, 'lib.java')
cmd = 'find %s -name "*.class"' % path cmd = 'find %s -name "*.jar"' % path
out = cmd_helper.GetCmdOutput(shlex.split(cmd)) out = cmd_helper.GetCmdOutput(shlex.split(cmd))
out = [p for p in out.splitlines() if not p.endswith('.dex.jar')]
if not out: if not out:
print 'No classes found in %s' % path print 'No classes found in %s' % path
return out return ' '.join(out)
def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes,
...@@ -135,7 +136,7 @@ def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, ...@@ -135,7 +136,7 @@ def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes,
if findbug_args: if findbug_args:
cmd = '%s %s ' % (cmd, findbug_args) cmd = '%s %s ' % (cmd, findbug_args)
chrome_classes = _GetChromeClasses(release_version) chrome_classes = _GetChromeJars(release_version)
if not chrome_classes: if not chrome_classes:
return 1 return 1
cmd = '%s %s ' % (cmd, chrome_classes) cmd = '%s %s ' % (cmd, chrome_classes)
......
...@@ -30,8 +30,7 @@ def print_landmines(target): ...@@ -30,8 +30,7 @@ def print_landmines(target):
builder() == 'ninja'): builder() == 'ninja'):
print 'Need to clobber winja goma due to backend cwd cache fix.' print 'Need to clobber winja goma due to backend cwd cache fix.'
if platform() == 'android': if platform() == 'android':
print 'Clobber: To avoid unresolved link errors on Breakpad roll.' print 'Clobber: To delete generated class files (we just use jars now).'
print 'Clobber: To get rid of generated files in the wrong package.'
if platform() == 'win' and builder() == 'ninja': if platform() == 'win' and builder() == 'ninja':
print 'Compile on cc_unittests fails due to symbols removed in r185063.' print 'Compile on cc_unittests fails due to symbols removed in r185063.'
if platform() == 'linux' and builder() == 'ninja': if platform() == 'linux' and builder() == 'ninja':
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
'res_v14_verify_only%': 0, 'res_v14_verify_only%': 0,
'resource_input_paths': ['>@(res_extra_files)'], 'resource_input_paths': ['>@(res_extra_files)'],
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)',
'classes_dir': '<(intermediate_dir)/classes',
'compile_stamp': '<(intermediate_dir)/compile.stamp', 'compile_stamp': '<(intermediate_dir)/compile.stamp',
'lint_stamp': '<(intermediate_dir)/lint.stamp', 'lint_stamp': '<(intermediate_dir)/lint.stamp',
'lint_result': '<(intermediate_dir)/lint_result.xml', 'lint_result': '<(intermediate_dir)/lint_result.xml',
...@@ -234,7 +233,6 @@ ...@@ -234,7 +233,6 @@
], ],
'action': [ 'action': [
'python', '<(DEPTH)/build/android/gyp/javac.py', 'python', '<(DEPTH)/build/android/gyp/javac.py',
'--classes-dir=<(classes_dir)',
'--classpath=>(input_jars_paths)', '--classpath=>(input_jars_paths)',
'--src-gendirs=>(generated_src_dirs)', '--src-gendirs=>(generated_src_dirs)',
'--javac-includes=<(javac_includes)', '--javac-includes=<(javac_includes)',
...@@ -245,6 +243,23 @@ ...@@ -245,6 +243,23 @@
'>@(java_sources)', '>@(java_sources)',
] ]
}, },
{
'action_name': 'instr_jar_<(_target_name)',
'message': 'Instrumenting <(_target_name) jar',
'variables': {
'input_path': '<(jar_path)',
'output_path': '<(jar_final_path)',
'stamp_path': '<(instr_stamp)',
'instr_type': 'jar',
},
'outputs': [
'<(jar_final_path)',
],
'inputs': [
'<(jar_path)',
],
'includes': [ 'android/instr_action.gypi' ],
},
{ {
'variables': { 'variables': {
'src_dirs': [ 'src_dirs': [
...@@ -254,8 +269,10 @@ ...@@ -254,8 +269,10 @@
'stamp_path': '<(lint_stamp)', 'stamp_path': '<(lint_stamp)',
'result_path': '<(lint_result)', 'result_path': '<(lint_result)',
'config_path': '<(lint_config)', 'config_path': '<(lint_config)',
'lint_jar_path': '<(jar_final_path)',
}, },
'inputs': [ 'inputs': [
'<(jar_final_path)',
'<(compile_stamp)', '<(compile_stamp)',
], ],
'outputs': [ 'outputs': [
...@@ -263,23 +280,6 @@ ...@@ -263,23 +280,6 @@
], ],
'includes': [ 'android/lint_action.gypi' ], 'includes': [ 'android/lint_action.gypi' ],
}, },
{
'action_name': 'instr_jar_<(_target_name)',
'message': 'Instrumenting <(_target_name) jar',
'variables': {
'input_path': '<(jar_path)',
'output_path': '<(jar_final_path)',
'stamp_path': '<(instr_stamp)',
'instr_type': 'jar',
},
'outputs': [
'<(jar_final_path)',
],
'inputs': [
'<(jar_path)',
],
'includes': [ 'android/instr_action.gypi' ],
},
{ {
'action_name': 'jar_toc_<(_target_name)', 'action_name': 'jar_toc_<(_target_name)',
'message': 'Creating <(_target_name) jar.TOC', 'message': 'Creating <(_target_name) jar.TOC',
......
...@@ -106,7 +106,6 @@ ...@@ -106,7 +106,6 @@
'strip_stamp': '<(intermediate_dir)/strip.stamp', 'strip_stamp': '<(intermediate_dir)/strip.stamp',
'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries', 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp', 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
'classes_dir': '<(intermediate_dir)/classes/2',
'javac_includes': [], 'javac_includes': [],
'jar_excluded_classes': [], 'jar_excluded_classes': [],
'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
...@@ -646,7 +645,6 @@ ...@@ -646,7 +645,6 @@
], ],
'action': [ 'action': [
'python', '<(DEPTH)/build/android/gyp/javac.py', 'python', '<(DEPTH)/build/android/gyp/javac.py',
'--classes-dir=<(classes_dir)',
'--classpath=>(input_jars_paths) <(android_sdk_jar)', '--classpath=>(input_jars_paths) <(android_sdk_jar)',
'--src-gendirs=>(gen_src_dirs)', '--src-gendirs=>(gen_src_dirs)',
'--javac-includes=<(javac_includes)', '--javac-includes=<(javac_includes)',
...@@ -657,24 +655,6 @@ ...@@ -657,24 +655,6 @@
'>@(java_sources)', '>@(java_sources)',
], ],
}, },
{
'variables': {
'src_dirs': [
'<(java_in_dir)/src',
'>@(additional_src_dirs)',
],
'stamp_path': '<(lint_stamp)',
'result_path': '<(lint_result)',
'config_path': '<(lint_config)',
},
'inputs': [
'<(compile_stamp)',
],
'outputs': [
'<(lint_stamp)',
],
'includes': [ 'android/lint_action.gypi' ],
},
{ {
'action_name': 'instr_jar_<(_target_name)', 'action_name': 'instr_jar_<(_target_name)',
'message': 'Instrumenting <(_target_name) jar', 'message': 'Instrumenting <(_target_name) jar',
...@@ -693,6 +673,22 @@ ...@@ -693,6 +673,22 @@
], ],
'includes': [ 'android/instr_action.gypi' ], 'includes': [ 'android/instr_action.gypi' ],
}, },
{
'variables': {
'src_dirs': [
'<(java_in_dir)/src',
'>@(additional_src_dirs)',
],
'lint_jar_path': '<(jar_path)',
'stamp_path': '<(lint_stamp)',
'result_path': '<(lint_result)',
'config_path': '<(lint_config)',
},
'outputs': [
'<(lint_stamp)',
],
'includes': [ 'android/lint_action.gypi' ],
},
{ {
'action_name': 'obfuscate_<(_target_name)', 'action_name': 'obfuscate_<(_target_name)',
'message': 'Obfuscating <(_target_name)', 'message': 'Obfuscating <(_target_name)',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment