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