• 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.
33 "MissingApplicationIcon", # False positive for non-production targets.
37 "StringFormatCount", # Has false-positives.
50 def _SrcRelative(path): argument
51 """Returns relative path to top-level src dir."""
52 return os.path.relpath(path, build_utils.DIR_SOURCE_ROOT)
67 project = ElementTree.Element('project')
68 root = ElementTree.SubElement(project, 'root')
71 sdk = ElementTree.SubElement(project, 'sdk')
72 # Lint requires that the sdk path be an absolute path.
73 sdk.set('dir', os.path.abspath(android_sdk_root))
75 baseline = ElementTree.SubElement(project, 'baseline')
77 cache = ElementTree.SubElement(project, 'cache')
79 main_module = ElementTree.SubElement(project, 'module')
83 # Required to make lint-resources.xml be written to a per-target path.
85 main_module.set('partial-results-dir', partials_dir)
92 src = ElementTree.SubElement(main_module, 'src')
93 src.set('file', srcjar_file)
99 src = ElementTree.SubElement(main_module, 'src')
100 src.set('file', source)
102 # non-test files, which lint does not allow:
114 lint = ElementTree.SubElement(main_module, 'lint-checks')
120 return project
156 for path in extra_manifest_paths:
157 _, _, extra_app_node = manifest_utils.ParseManifest(path)
161 uses_sdk = manifest.find('./uses-sdk')
163 uses_sdk = ElementTree.Element('uses-sdk')
172 def _WriteXmlFile(root, path): argument
173 logging.info('Writing xml file %s', path)
174 build_utils.MakeDirectory(os.path.dirname(path))
175 with action_helpers.atomic_output(path) as f:
180 root, encoding='utf-8')).toprettyxml(indent=' ').encode('utf-8'))
204 # Use per-target cache directory when --cache-dir is not used.
205 cache_dir = os.path.join(lint_gen_dir, 'cache')
207 # When --create-cache is used, ninja will create this directory because the
211 if baseline and not os.path.exists(baseline):
222 partials_dir = os.path.join(lint_gen_dir, 'partials')
227 # prefix. Path variable substitution is based off of prefix matching so custom
228 # path variables need to match exactly in order to show up in baseline files.
229 # e.g. lint_path=path/to/output/dir/../../file/in/src
231 pathvar_src = os.path.join(
232 root_path, os.path.relpath(build_utils.DIR_SOURCE_ROOT, start=root_path))
235 '-cp',
238 '--sdk-home',
240 '--jdk-home',
242 '--path-variables',
243 f'SRC={pathvar_src}',
244 '--offline',
245 '--quiet', # Silences lint's "." progress updates.
246 '--stacktrace', # Prints full stacktraces for internal lint errors.
247 '--disable',
252 manifest_path = os.path.join(build_utils.DIR_SOURCE_ROOT, 'build',
258 generated_config_path = os.path.join(lint_gen_dir, 'config.xml')
260 cmd.extend(['--config', generated_config_path])
270 lint_android_manifest_path = os.path.join(lint_gen_dir, 'AndroidManifest.xml')
273 resource_root_dir = os.path.join(lint_gen_dir, _RES_ZIP_DIR)
279 resource_dir = os.path.join(resource_root_dir, resource_zip)
283 build_utils.ExtractAll(resource_zip, path=resource_dir))
286 aar_root_dir = os.path.join(lint_gen_dir, _AAR_DIR)
292 aar_dir = os.path.join(aar_root_dir,
293 os.path.splitext(_SrcRelative(aar))[0])
296 aar_files = build_utils.ExtractAll(aar, path=aar_dir)
304 srcjar_root_dir = os.path.join(lint_gen_dir, _SRCJAR_DIR)
308 # Use path without extensions since otherwise the file name includes
310 srcjar_dir = os.path.join(srcjar_root_dir, os.path.splitext(srcjar)[0])
316 srcjar_sources.extend(build_utils.ExtractAll(srcjar, path=srcjar_dir))
318 logging.info('Generating project file')
324 project_xml_path = os.path.join(lint_gen_dir, 'project.xml')
326 cmd += ['--project', project_xml_path]
358 end = time.time() - start
368 print('- For more help with lint in Chrome:', _LINT_MD_URL)
370 print('- DEBUG MODE: Here is the project.xml: {}'.format(
373 print('- Run with LINT_DEBUG=1 to enable lint configuration debugging')
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',
398 help='Path to the directory in which the android cache '
400 parser.add_argument('--config-path', help='Path to lint suppressions file.')
401 parser.add_argument('--lint-gen-dir',
403 help='Path to store generated xml files.')
404 parser.add_argument('--stamp', help='Path to stamp upon success.')
405 parser.add_argument('--android-sdk-version',
408 parser.add_argument('--min-sdk-version',
411 parser.add_argument('--android-sdk-root',
413 help='Lint needs an explicit path to the android sdk.')
414 parser.add_argument('--create-cache',
417 parser.add_argument('--warnings-as-errors',
420 parser.add_argument('--sources',
423 parser.add_argument('--aars', help='GN list of included aars.')
424 parser.add_argument('--srcjars', help='GN list of included srcjars.')
425 parser.add_argument('--manifest-path',
426 help='Path to original AndroidManifest.xml')
427 parser.add_argument('--extra-manifest-paths',
429 help='GYP-list of manifest paths to merge into the '
431 parser.add_argument('--resource-sources',
434 help='GYP-list of resource sources files, similar to '
436 parser.add_argument('--resource-zips',
439 help='GYP-list of resource zips, zip files of generated '
441 parser.add_argument('--classpath',
443 parser.add_argument('--baseline',
458 assert os.path.basename(args.baseline) == 'lint-baseline.xml', (
459 'The baseline file needs to be named "lint-baseline.xml" in order for '