Flutter Engine
The Flutter Engine
gen_android_buildconfig.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 os
9import sys
10
11BUILD_CONFIG_TEMPLATE = """
12// Copyright 2013 The Flutter Authors. All rights reserved.
13// Use of this source code is governed by a BSD-style license that can be
14// found in the LICENSE file.
15
16
17// THIS FILE IS AUTO_GENERATED
18// DO NOT EDIT THE VALUES HERE - SEE $flutter_root/tools/gen_android_buildconfig.py
19package io.flutter;
20
21public final class BuildConfig {{
22 private BuildConfig() {{}}
23
24 public final static boolean DEBUG = {0};
25 public final static boolean PROFILE = {1};
26 public final static boolean RELEASE = {2};
27 public final static boolean JIT_RELEASE = {3};
28}}
29"""
30
31
32def main():
33 parser = argparse.ArgumentParser(description='Generate BuildConfig.java for Android')
34 parser.add_argument('--runtime-mode', type=str, required=True)
35 parser.add_argument('--out', type=str, required=True)
36
37 args = parser.parse_args()
38
39 jit_release = 'jit_release' in args.runtime_mode.lower()
40 release = not jit_release and 'release' in args.runtime_mode.lower()
41 profile = 'profile' in args.runtime_mode.lower()
42 debug = 'debug' in args.runtime_mode.lower()
43 assert debug or profile or release or jit_release
44
45 with open(os.path.abspath(args.out), 'w+') as output_file:
46 output_file.write(
47 BUILD_CONFIG_TEMPLATE.format(
48 str(debug).lower(),
49 str(profile).lower(),
50 str(release).lower(),
51 str(jit_release).lower()
52 )
53 )
54
55
56if __name__ == '__main__':
57 sys.exit(main())
Definition: main.py:1