platform_build_soong/starlark_import
Cole Faust 88c8efb18c Add CFI product config variables to platform_mappings
Bug: 269577299
Fixes: 283130542
Test: b test --config=android //build/bazel/rules/cc/...
Change-Id: I2fc4094167c48b1f3b22bee6b7ada309278f7250
2023-07-20 09:45:36 -07:00
..
Android.bp Load starlark files from soong 2023-04-26 17:18:19 -07:00
README.md Load starlark files from soong 2023-04-26 17:18:19 -07:00
starlark_import.go Load starlark files from soong 2023-04-26 17:18:19 -07:00
starlark_import_test.go Load starlark files from soong 2023-04-26 17:18:19 -07:00
unmarshal.go Add CFI product config variables to platform_mappings 2023-07-20 09:45:36 -07:00
unmarshal_test.go Platform mapping-based product config 2023-07-17 16:27:08 -07:00

starlark_import package

This allows soong to read constant information from starlark files. At package initialization time, soong will read build/bazel/constants_exported_to_soong.bzl, and then make the variables from that file available via starlark_import.GetStarlarkValue(). So to import a new variable, it must be added to constants_exported_to_soong.bzl and then it can be accessed by name.

Only constant information can be read, since this is not a full bazel execution but a standalone starlark interpreter. This means you can't use bazel contructs like rule, provider, select, glob, etc.

All starlark files that were loaded must be added as ninja deps that cause soong to rerun. The loaded files can be retrieved via starlark_import.GetNinjaDeps().