Flutter Engine
The Flutter Engine
asset_package.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
3# Copyright 2013 The Flutter Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import argparse
8import subprocess
9import os
10import sys
11
12
13def main():
14 parser = argparse.ArgumentParser(description='Package a Flutter application')
15
16 parser.add_argument('--flutter-root', type=str, required=True, help='The root of the Flutter SDK')
17 parser.add_argument(
18 '--flutter-tools', type=str, required=True, help='The executable for the Flutter tool'
19 )
20 parser.add_argument(
21 '--asset-dir', type=str, required=True, help='The directory where to put intermediate files'
22 )
23 parser.add_argument('--app-dir', type=str, required=True, help='The root of the app')
24 parser.add_argument('--packages', type=str, required=True, help='The package map to use')
25 parser.add_argument('--manifest', type=str, help='The application manifest')
26 parser.add_argument('--component-name', type=str, help='The name of the component')
27 parser.add_argument(
28 '--asset-manifest-out',
29 type=str,
30 help='Output path for the asset manifest used by the fuchsia packaging tool'
31 )
32
33 args = parser.parse_args()
34
35 env = os.environ.copy()
36 env['FLUTTER_ROOT'] = args.flutter_root
37
38 call_args = [
39 args.flutter_tools,
40 '--asset-dir=%s' % args.asset_dir,
41 '--packages=%s' % args.packages,
42 ]
43 if 'manifest' in args:
44 call_args.append('--manifest=%s' % args.manifest)
45
46 if args.asset_manifest_out:
47 call_args.append('--asset-manifest-out=%s' % args.asset_manifest_out)
48
49 if args.component_name:
50 call_args.append('--component-name=%s' % args.component_name)
51
52 result = subprocess.call(call_args, env=env, cwd=args.app_dir)
53
54 return result
55
56
57if __name__ == '__main__':
58 sys.exit(main())
Definition: main.py:1