aboutsummaryrefslogtreecommitdiff
path: root/product_config/BUILD
blob: 92a57bf495b21521b4056527d44ee6f1679905c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag", "string_list_flag")
load("//build/bazel/rules/aconfig:aconfig_value_sets.bzl", "aconfig_value_sets")
load(":product_variables_for_attributes.bzl", "product_variables_for_attributes")

package(default_visibility = ["//visibility:public"])

# This rule type outputs a TemplateVariableInfo provider that contains a subset of the product
# variables to be available for expansion using make-like syntax on certain rule attributes.
# Soong had this feature, so it was ported to bazel.
product_variables_for_attributes(name = "product_variables_for_attributes")

# This label flag will always point to the device platform for the current android product.
# It can be used to transition into the device configuration from the host configuration.
label_flag(
    name = "device_platform",
    build_setting_default = "//build/bazel/utils:fail",
)

string_flag(
    name = "target_build_variant",
    build_setting_default = "eng",
    values = [
        "user",
        "userdebug",
        "eng",
    ],
)

_string_list_variables = [
    # keep-sorted start
    "aapt_config",
    "build_version_tags",
    "cfi_exclude_paths",
    "cfi_include_paths",
    "device_abi",
    "manifest_package_name_overrides",
    "memtag_heap_async_include_paths",
    "memtag_heap_exclude_paths",
    "memtag_heap_sync_include_paths",
    "tidy_checks",
    "unbundled_build_apps",
    # keep-sorted end
]

_string_variables = [
    # keep-sorted start
    # TODO: b/301593550 - commas can't be escaped in a string-list passed in a platform mapping,
    # so commas are switched for ":" in soong injection, and must be back-substituted
    # into commas wherever the AAPTCharacteristics product config variable is used.
    "aapt_characteristics",
    "aapt_preferred_config",
    "apex_global_min_sdk_version_override",
    "build_id",
    "default_app_certificate",
    "device_max_page_size_supported",
    "device_name",
    "device_product",
    "override_rs_driver",
    "platform_sdk_extension_version",
    "platform_sdk_version",
    "platform_sdk_version_or_codename",
    "platform_security_patch",
    "platform_version_last_stable",
    "platform_version_name",
    "product_brand",
    "product_manufacturer",
    "release_aconfig_flag_default_permission",
    "release_version",
    # keep-sorted end
]

_bool_variables = [
    # keep-sorted start
    "always_use_prebuilt_sdks",
    "arc",
    "binder32bit",
    "build_broken_incorrect_partition_images",
    "build_from_text_stub",
    "compressed_apex",
    "device_page_size_agnostic",
    "enforce_vintf_manifest",
    "malloc_not_svelte",
    "malloc_pattern_fill_contents",
    "malloc_zero_contents",
    "native_coverage",
    "pdk",
    "platform_sdk_final",
    "release_aidl_use_unfrozen",
    "safestack",
    "treble_linker_namespaces",
    "uml",
    "unbundled_build",
    # keep-sorted end
]

[
    string_list_flag(
        name = name,
        build_setting_default = [],
    )
    for name in _string_list_variables
]

[
    string_flag(
        name = name,
        build_setting_default = "",
    )
    for name in _string_variables
]

[
    bool_flag(
        name = name,
        build_setting_default = False,
    )
    for name in _bool_variables
]

bool_flag(
    name = "enable_cfi",
    build_setting_default = True,
)

label_flag(
    name = "default_app_certificate_filegroup",
    build_setting_default = "//build/bazel/utils:empty_filegroup",
)

label_flag(
    name = "release_aconfig_value_sets",
    build_setting_default = ":empty_aconfig_value_sets",
)

aconfig_value_sets(
    name = "empty_aconfig_value_sets",
    value_sets = [],
    visibility = ["//visibility:public"],
)