1# Copyright 2019 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Flag definitions."""
16
17load("@rules_android//rules/flags:flags.bzl", "flags")
18
19def define_flags():
20    flags.DEFINE_bool(
21        name = "android_enable_res_v3",
22        default = False,
23        description = "Enable Resource Processing Pipeline v3.",
24    )
25
26    flags.DEFINE_bool(
27        name = "use_direct_deploy",
28        default = False,
29        description = "Enable direct deployment.",
30    )
31
32    flags.DEFINE_int(
33        name = "num_dex_shards",
34        default = 16,
35        description = "Number of dex shards to use for mobile-install.",
36    )
37
38    flags.DEFINE_bool(
39        name = "use_custom_dex_shards",
40        default = False,
41        description = "Whether to use custom dex shard value for mobile-install.",
42    )
43
44    flags.DEFINE_bool_group(
45        name = "mi_v3",
46        default = True,
47        description = "Enable mobile-install v3.",
48        flags = [
49            # TODO(b/160897244): resv3 temporarily disabled while Starlark
50            #     resource processing is implemented and rolled out
51            # ":android_enable_res_v3",
52            ":use_custom_dex_shards",
53            ":use_direct_deploy",
54        ],
55    )
56
57    flags.DEFINE_bool_group(
58        name = "mi_dogfood",
59        default = False,
60        description = "Opt-in to mobile-install dogfood track.",
61        flags = [
62        ],
63    )
64
65    flags.DEFINE_bool(
66        name = "enable_splits",
67        default = False,
68        description = "Build and install split apks if the device supports them.",
69    )
70
71    flags.DEFINE_bool(
72        name = "use_adb_root",
73        default = True,
74        description = "Restart adb with root permissions.",
75    )
76
77    flags.DEFINE_bool(
78        name = "mi_desugar_java8_libs",
79        default = False,
80        description = "Set True with --config=android_java8_libs",
81    )
82
83    flags.DEFINE_bool(
84        name = "debug",
85        default = False,
86        description = "",
87    )
88
89    flags.EXPOSE_native_bool(
90        name = "stamp",
91        description = "Accesses the native --stamp CLI flag",
92    )
93