1"""Hard-coded rules for product variables until product config files are
2converted and available."""
3
4def _product_variables_providing_rule_impl(ctx):
5    return [
6        platform_common.TemplateVariableInfo({
7            "Platform_version_name": ctx.attr.platform_version_name,
8            "Platform_sdk_version": str(ctx.attr.platform_sdk_version),
9            "Platform_sdk_codename": ctx.attr.platform_sdk_codename,
10            "Platform_sdk_final": str(1 if ctx.attr.platform_sdk_final else 0),
11            "Platform_version_active_codenames": ",".join(ctx.attr.platform_version_active_codenames),
12            "Platform_vndk_version": ctx.attr.platform_vndk_version,
13        }),
14    ]
15
16# Values taken from https://cs.android.com/android/platform/superproject/+/master:build/soong/android/variable.go;l=412;drc=7b85eeb41ef3e6d2cf44558d3f54f9ed1b247036
17product_variables_providing_rule = rule(
18    implementation = _product_variables_providing_rule_impl,
19    attrs = {
20        "platform_version_name": attr.string(default="S"),
21        "platform_sdk_version": attr.int(default=30),
22        "platform_sdk_codename": attr.string(default="S"),
23        "platform_sdk_final": attr.bool(default=False),
24        "platform_version_active_codenames": attr.string_list(default=["S"]),
25        "platform_vndk_version": attr.string(default="S"),
26    },
27)
28
29
30