Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
merge_deps_sources.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3"""Merges sources of a Dart target and its dependencies"""
4
5# Copyright 2013 The Flutter Authors. All rights reserved.
6# Use of this source code is governed by a BSD-style license that can be
7# found in the LICENSE file.
8
9import argparse
10import json
11import os
12import sys
13
14
15def main():
16 parser = argparse.ArgumentParser(
17 'Merges sources of a Dart target and its dependencies', fromfile_prefix_chars='@'
18 )
19 parser.add_argument(
20 '--output', help='Path to output the final list', type=argparse.FileType('w'), required=True
21 )
22 parser.add_argument(
23 '--depfile',
24 help='Path to the depfile to generate',
25 type=argparse.FileType('w'),
26 required=True
27 )
28 parser.add_argument(
29 '--sources',
30 help='Sources of this target',
31 nargs='*',
32 )
33 parser.add_argument('--source_lists', help='Files containing lists of Dart sources', nargs='*')
34 args = parser.parse_args()
35
36 args.depfile.write('{}: {}\n'.format(args.output.name, ' '.join(args.source_lists)))
37
38 # Merges sources of this target, and all of its dependencies.
39 all_sources = set(args.sources)
40 for f in args.source_lists:
41 with open(f, 'r') as f:
42 all_sources.update(json.load(f))
43 json.dump(sorted(all_sources), args.output)
44
45
46if __name__ == '__main__':
47 sys.exit(main())
uint32_t uint32_t * format
Definition main.py:1