How to use the ninja.load_manifest_from_args function in ninja

To help you get started, we’ve selected a few ninja examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aosp-mirror / platform_development / vndk / tools / sourcedr / ninja / list_ninja_build_dep.py View on Github external
def main():
    args = _parse_args()

    # Build lookup map
    manifest = ninja.load_manifest_from_args(args)
    graph = {}
    for build in manifest.builds:
        for path in build.explicit_outs:
            graph[path] = build
        for path in build.implicit_outs:
            graph[path] = build

    # List all transitive targets
    try:
        builds = collect_build_targets(graph, args.target)
    except KeyError:
        print('error: Failed to find the target {}'.format(arg.target),
              file=sys.stderr)
        sys.exit(1)

    # Print all targets
github aosp-mirror / platform_development / vndk / tools / sourcedr / ninja / list_source_file.py View on Github external
out_dir = posixpath.normpath(args.out_dir)
    out_dir_pattern = re.compile(re.escape(out_dir) + '/')
    out_host_dir_pattern = re.compile(re.escape(out_dir) + '/host/')
    out_product_dir = out_dir + '/target/product/[^/]+'

    def _normalize_path(path):
        if path.startswith(out_dir + '/target'):
            return path
        return posixpath.join(out_product_dir, path)

    installed_filter = [_normalize_path(path) for path in args.installed_filter]
    installed_filter = re.compile(
        '|'.join('(?:' + p + ')' for p in installed_filter))

    manifest = ninja.load_manifest_from_args(args)

    # Build lookup map
    graph = {}
    for build in manifest.builds:
        for path in build.explicit_outs:
            graph[path] = build
        for path in build.implicit_outs:
            graph[path] = build

    # Collect all matching outputs
    matched_files = [path for path in graph if installed_filter.match(path)]
    matched_files.sort()

    for path in matched_files:
        source_files = collect_source_files(
            graph, path, out_dir_pattern, out_host_dir_pattern)

ninja

Ninja is a small build system with a focus on speed

Apache-2.0
Latest version published 1 year ago

Package Health Score

83 / 100
Full package analysis