flutter_flutter/engine/src/flutter/tools/gen_android_buildconfig.py
Zachary Anderson f6629ffe5c Use 'et format' in CI. Check formatting of all files in CI (flutter/engine#50810)
This PR changes the format check on CI to use the command added in
https://github.com/flutter/engine/pull/50747.

Additionally, while making this change, I noticed that the CI check was
not checking the formatting of all files, and that as a result, files
were present in the repo with incorrect formatting. I have fixed the
formatting and fixed the check to always check all files.
2024-02-21 09:38:08 -08:00

58 lines
1.6 KiB
Python

#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import sys
BUILD_CONFIG_TEMPLATE = """
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// THIS FILE IS AUTO_GENERATED
// DO NOT EDIT THE VALUES HERE - SEE $flutter_root/tools/gen_android_buildconfig.py
package io.flutter;
public final class BuildConfig {{
private BuildConfig() {{}}
public final static boolean DEBUG = {0};
public final static boolean PROFILE = {1};
public final static boolean RELEASE = {2};
public final static boolean JIT_RELEASE = {3};
}}
"""
def main():
parser = argparse.ArgumentParser(description='Generate BuildConfig.java for Android')
parser.add_argument('--runtime-mode', type=str, required=True)
parser.add_argument('--out', type=str, required=True)
args = parser.parse_args()
jit_release = 'jit_release' in args.runtime_mode.lower()
release = not jit_release and 'release' in args.runtime_mode.lower()
profile = 'profile' in args.runtime_mode.lower()
debug = 'debug' in args.runtime_mode.lower()
assert debug or profile or release or jit_release
with open(os.path.abspath(args.out), 'w+') as output_file:
output_file.write(
BUILD_CONFIG_TEMPLATE.format(
str(debug).lower(),
str(profile).lower(),
str(release).lower(),
str(jit_release).lower()
)
)
if __name__ == '__main__':
sys.exit(main())