• Home
  • Raw
  • Download

Lines Matching +full:build +full:- +full:root +full:- +full:directory

3 # Use of this source code is governed by a BSD-style license that can be
36 # Paths from the root of the tree to directories to skip.
39 os.path.join('third_party', 'llvm-build'),
83 """We raise this exception when a directory's licensing info isn't
88 def AbsolutePath(path, filename, root): argument
90 root."""
92 # Absolute-looking paths are relative to the source root
93 # (which is the directory we're run from).
94 absolute_path = os.path.join(root, filename[1:])
96 absolute_path = os.path.join(root, path, filename)
102 def ParseDir(path, root, require_license_file=True, optional_keys=None): argument
120 readme_path = os.path.join(root, path, 'README.chromium')
142 # Special-case modules that aren't in the shipping product, so don't need
147 license_path = AbsolutePath(path, filename, root)
165 def ContainsFiles(path, root): argument
166 """Determines whether any files exist in a directory or in any of its
168 for _, dirs, files in os.walk(os.path.join(root, path)):
177 def FilterDirsWithFiles(dirs_list, root): argument
178 # If a directory contains no files, assume it's a DEPS directory for a
180 return [x for x in dirs_list if ContainsFiles(x, root)]
183 def FindThirdPartyDirs(prune_paths, root): argument
184 """Find all third_party directories underneath the source root."""
186 for path, dirs, files in os.walk(root):
187 path = path[len(root) + 1:] # Pretty up the path.
215 def FindThirdPartyDirsWithFiles(root): argument
216 third_party_dirs = FindThirdPartyDirs(PRUNE_PATHS, root)
217 return FilterDirsWithFiles(third_party_dirs, root)
239 Note that it always returns the direct sub-directory of third_party
242 third_party/cld_3/src/src/BUILD.gn -> third_party/cld_3
251 r'^((.+[/\\])?third_party[/\\][^/\\]+[/\\])(.+[/\\])?BUILD\.gn$',
258 third_party_deps.add(third_party_path[:-1])
264 raise RuntimeError("--gn-out-dir is required if --gn-target is used.")
266 # Generate gn project in temp directory and use it to find dependencies.
267 # Current gn directory cannot be used when we run this script in a gn action
276 _GnBinary(), "desc", tmp_dir, gn_target, "deps", "--as=buildfile",
277 "--all"
280 gn_deps = gn_deps.decode("utf-8")
288 def ScanThirdPartyDirs(root=None): argument
290 if root is None:
291 root = os.getcwd()
292 third_party_dirs = FindThirdPartyDirsWithFiles(root)
297 metadata = ParseDir(path, root)
338 # Sanity-check to raise a build error if invalid gn_... settings are
390 template_contents = "<!-- Generated by licenses.py; do not edit. -->"
411 # Add in build.ninja so that the target will be considered dirty when
413 # added. This is still not perfect, as it will fail if no build files
419 WriteDepfile(depfile, output_file, license_file_list + ['build.ninja'])
427 path: The path of the file to read, relative to the root of the
432 with codecs.open(os.path.join(_REPOSITORY_ROOT, path), 'r', 'utf-8') as f:
437 """Generate a plain-text LICENSE file which can be used when you ship a part
438 of Chromium code (specified by gn_target) as a stand-alone library
441 The LICENSE file contains licenses of both Chromium and third-party
450 for directory in sorted(third_party_dirs):
451 metadata = ParseDir(directory,
456 content.append('-' * 20)
457 content.append(directory.split(os.sep)[-1])
458 content.append('-' * 20)
464 with codecs.open(output_file, 'w', 'utf-8') as output:
472 parser.add_argument('--file-template',
474 parser.add_argument('--entry-template',
476 parser.add_argument('--target-os', help='OS that this build is targeting.')
477 parser.add_argument('--gn-out-dir',
478 help='GN output directory for scanning dependencies.')
479 parser.add_argument('--gn-target',
484 parser.add_argument('--depfile',