• Home
  • Raw
  • Download

Lines Matching +full:project +full:- +full:src +full:- +full:path

4 # Use of this source code is governed by a BSD-style license that can be
20 import action_helpers # build_utils adds //build to sys.path.
22 …https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md' # pylint: disab…
27 "Assert", # R8 --force-enable-assertions is used to enable java asserts.
32 "MissingApplicationIcon", # False positive for non-production targets.
67 def _SrcRelative(path): argument
68 """Returns relative path to top-level src dir."""
69 return os.path.relpath(path, build_utils.DIR_SOURCE_ROOT)
83 project = ElementTree.Element('project')
84 root = ElementTree.SubElement(project, 'root')
87 sdk = ElementTree.SubElement(project, 'sdk')
88 # Lint requires that the sdk path be an absolute path.
89 sdk.set('dir', os.path.abspath(android_sdk_root))
91 baseline = ElementTree.SubElement(project, 'baseline')
93 cache = ElementTree.SubElement(project, 'cache')
95 main_module = ElementTree.SubElement(project, 'module')
105 src = ElementTree.SubElement(main_module, 'src')
106 src.set('file', srcjar_file)
109 src = ElementTree.SubElement(main_module, 'src')
110 src.set('file', source)
121 lint = ElementTree.SubElement(main_module, 'lint-checks')
127 return project
163 for path in extra_manifest_paths:
164 _, _, extra_app_node = manifest_utils.ParseManifest(path)
168 uses_sdk = manifest.find('./uses-sdk')
170 uses_sdk = ElementTree.Element('uses-sdk')
179 def _WriteXmlFile(root, path): argument
180 logging.info('Writing xml file %s', path)
181 build_utils.MakeDirectory(os.path.dirname(path))
182 with action_helpers.atomic_output(path) as f:
187 root, encoding='utf-8')).toprettyxml(indent=' ').encode('utf-8'))
214 # Occasionally lint may crash due to re-using intermediate files from older
220 if baseline and not os.path.exists(baseline):
230 # prefix. Path variable substitution is based off of prefix matching so custom
231 # path variables need to match exactly in order to show up in baseline files.
232 # e.g. lint_path=path/to/output/dir/../../file/in/src
234 pathvar_src = os.path.join(
235 root_path, os.path.relpath(build_utils.DIR_SOURCE_ROOT, start=root_path))
238 '-cp',
241 '--sdk-home',
243 '--jdk-home',
245 '--path-variables',
246 f'SRC={pathvar_src}',
247 '--quiet', # Silences lint's "." progress updates.
248 '--stacktrace', # Prints full stacktraces for internal lint errors.
249 '--disable',
254 cmd.extend(['--disable', ','.join(_DISABLED_FOR_TESTS)])
257 manifest_path = os.path.join(build_utils.DIR_SOURCE_ROOT, 'build',
263 generated_config_path = os.path.join(lint_gen_dir, 'config.xml')
265 cmd.extend(['--config', generated_config_path])
272 # Include the rebased manifest_path in the lint generated path so that it is
274 lint_android_manifest_path = os.path.join(lint_gen_dir, manifest_path)
277 resource_root_dir = os.path.join(lint_gen_dir, _RES_ZIP_DIR)
283 resource_dir = os.path.join(resource_root_dir, resource_zip)
287 build_utils.ExtractAll(resource_zip, path=resource_dir))
290 aar_root_dir = os.path.join(lint_gen_dir, _AAR_DIR)
296 aar_dir = os.path.join(aar_root_dir,
297 os.path.splitext(_SrcRelative(aar))[0])
300 aar_files = build_utils.ExtractAll(aar, path=aar_dir)
308 srcjar_root_dir = os.path.join(lint_gen_dir, _SRCJAR_DIR)
312 # Use path without extensions since otherwise the file name includes
314 srcjar_dir = os.path.join(srcjar_root_dir, os.path.splitext(srcjar)[0])
320 srcjar_sources.extend(build_utils.ExtractAll(srcjar, path=srcjar_dir))
322 logging.info('Generating project file')
330 project_xml_path = os.path.join(lint_gen_dir, 'project.xml')
332 cmd += ['--project', project_xml_path]
361 print('- For more help with lint in Chrome:', _LINT_MD_URL)
363 print('- DEBUG MODE: Here is the project.xml: {}'.format(
366 print('- Run with LINT_DEBUG=1 to enable lint configuration debugging')
368 end = time.time() - start
382 parser.add_argument('--target-name', help='Fully qualified GN target name.')
383 parser.add_argument('--skip-build-server',
386 parser.add_argument('--use-build-server',
389 parser.add_argument('--lint-jar-path',
391 help='Path to the lint jar.')
392 parser.add_argument('--custom-lint-jar-path',
394 help='Path to our custom lint jar.')
395 parser.add_argument('--backported-methods',
396 help='Path to backported methods file created by R8.')
397 parser.add_argument('--cache-dir',
399 help='Path to the directory in which the android cache '
401 parser.add_argument('--config-path', help='Path to lint suppressions file.')
402 parser.add_argument('--lint-gen-dir',
404 help='Path to store generated xml files.')
405 parser.add_argument('--stamp', help='Path to stamp upon success.')
406 parser.add_argument('--android-sdk-version',
409 parser.add_argument('--min-sdk-version',
412 parser.add_argument('--android-sdk-root',
414 help='Lint needs an explicit path to the android sdk.')
415 parser.add_argument('--testonly',
420 parser.add_argument('--create-cache',
423 parser.add_argument('--warnings-as-errors',
426 parser.add_argument('--sources',
429 parser.add_argument('--aars', help='GN list of included aars.')
430 parser.add_argument('--srcjars', help='GN list of included srcjars.')
431 parser.add_argument('--manifest-path',
432 help='Path to original AndroidManifest.xml')
433 parser.add_argument('--extra-manifest-paths',
435 help='GYP-list of manifest paths to merge into the '
437 parser.add_argument('--resource-sources',
440 help='GYP-list of resource sources files, similar to '
442 parser.add_argument('--resource-zips',
445 help='GYP-list of resource zips, zip files of generated '
447 parser.add_argument('--classpath',
449 parser.add_argument('--baseline',
464 assert os.path.basename(args.baseline) == 'lint-baseline.xml', (
465 'The baseline file needs to be named "lint-baseline.xml" in order for '