rust: add aconfig_flag support
Bug: b/308625757
Test: manual
Change-Id: Ifd98cd0ad4e2525b08f5766e9332991c049162ea
diff --git a/rust/Android.bp b/rust/Android.bp
index c5b2000..637042d 100644
--- a/rust/Android.bp
+++ b/rust/Android.bp
@@ -7,6 +7,7 @@
pkgPath: "android/soong/rust",
deps: [
"soong",
+ "soong-aconfig",
"soong-android",
"soong-bloaty",
"soong-cc",
diff --git a/rust/androidmk.go b/rust/androidmk.go
index e02c3f6..733ffc5 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -66,7 +66,8 @@
if mod.UseVndk() {
entries.SetBool("LOCAL_USE_VNDK", true)
}
-
+ // TODO(b/311155208): The container here should be system.
+ entries.SetPaths("LOCAL_ACONFIG_FILES", mod.mergedAconfigFiles[""])
},
},
}
diff --git a/rust/rust.go b/rust/rust.go
index 3d51a13..ddebb75 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -26,6 +26,7 @@
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
+ "android/soong/aconfig"
"android/soong/android"
"android/soong/cc"
cc_config "android/soong/cc/config"
@@ -176,6 +177,9 @@
transitiveAndroidMkSharedLibs *android.DepSet[string]
android.BazelModuleBase
+
+ // Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo
+ mergedAconfigFiles map[string]android.Paths
}
func (mod *Module) Header() bool {
@@ -1006,6 +1010,8 @@
if mod.testModule {
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}
+
+ aconfig.CollectDependencyAconfigFiles(ctx, &mod.mergedAconfigFiles)
}
func (mod *Module) deps(ctx DepsContext) Deps {