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