Export device arm64 rust flags to Bazel

Test: b build //build/bazel/examples/rust:all --config=android
Change-Id: I2656dc963cc4fe0c42da52a0d2a235b5cd86fa13
This commit is contained in:
Vinh Tran 2023-10-04 17:35:22 -04:00
parent 4414c4e7ff
commit 8321763764
2 changed files with 14 additions and 5 deletions

View file

@ -54,6 +54,7 @@ func init() {
strings.Join(rustFlags, " "))
}
ExportedVars.ExportStringListStaticVariable("DEVICE_ARM64_RUSTC_FLAGS", Arm64RustFlags)
}
type toolchainArm64 struct {

View file

@ -23,7 +23,7 @@ import (
var (
pctx = android.NewPackageContext("android/soong/rust/config")
exportedVars = android.NewExportedVariables(pctx)
ExportedVars = android.NewExportedVariables(pctx)
RustDefaultVersion = "1.72.0"
RustDefaultBase = "prebuilts/rust/"
@ -111,9 +111,17 @@ func init() {
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion)
exportedVars.ExportStringListStaticVariable("GLOBAL_RUSTC_FLAGS", GlobalRustFlags)
exportedVars.ExportStringListStaticVariable("LINUX_HOST_GLOBAL_LINK_FLAGS", LinuxHostGlobalLinkFlags)
ExportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion)
ExportedVars.ExportStringListStaticVariable("GLOBAL_RUSTC_FLAGS", GlobalRustFlags)
ExportedVars.ExportStringListStaticVariable("LINUX_HOST_GLOBAL_LINK_FLAGS", LinuxHostGlobalLinkFlags)
ExportedVars.ExportStringListStaticVariable("DEVICE_GLOBAL_RUSTC_FLAGS", deviceGlobalRustFlags)
ExportedVars.ExportStringListStaticVariable("DEVICE_GLOBAL_LINK_FLAGS",
android.RemoveListFromList(deviceGlobalLinkFlags, []string{
// The cc_config flags are retrieved from cc_toolchain by rust rules.
"${cc_config.DeviceGlobalLldflags}",
"-B${cc_config.ClangBin}",
}))
}
func HostPrebuiltTag(config android.Config) string {
@ -137,5 +145,5 @@ func GetRustVersion(ctx android.PathContext) string {
// BazelRustToolchainVars returns a string with
func BazelRustToolchainVars(config android.Config) string {
return android.BazelToolchainVars(config, exportedVars)
return android.BazelToolchainVars(config, ExportedVars)
}