Merge "Add test mode support for rust_aconfig_library" into main am: a207d486e1
am: d6c3a399dc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2706453 Change-Id: I1914382ea9238132e739c8a40e1623a226556deb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
type rustDeclarationsTagType struct {
|
type rustDeclarationsTagType struct {
|
||||||
@@ -17,6 +18,7 @@ var rustDeclarationsTag = rustDeclarationsTagType{}
|
|||||||
type RustAconfigLibraryProperties struct {
|
type RustAconfigLibraryProperties struct {
|
||||||
// name of the aconfig_declarations module to generate a library for
|
// name of the aconfig_declarations module to generate a library for
|
||||||
Aconfig_declarations string
|
Aconfig_declarations string
|
||||||
|
Test *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type aconfigDecorator struct {
|
type aconfigDecorator struct {
|
||||||
@@ -58,6 +60,11 @@ func (a *aconfigDecorator) GenerateSource(ctx rust.ModuleContext, deps rust.Path
|
|||||||
}
|
}
|
||||||
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
|
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
|
||||||
|
|
||||||
|
mode := "production"
|
||||||
|
if proptools.Bool(a.Properties.Test) {
|
||||||
|
mode = "test"
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: rustRule,
|
Rule: rustRule,
|
||||||
Input: declarations.IntermediatePath,
|
Input: declarations.IntermediatePath,
|
||||||
@@ -67,8 +74,7 @@ func (a *aconfigDecorator) GenerateSource(ctx rust.ModuleContext, deps rust.Path
|
|||||||
Description: "rust_aconfig_library",
|
Description: "rust_aconfig_library",
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"gendir": generatedDir.String(),
|
"gendir": generatedDir.String(),
|
||||||
// TODO: Add test mode
|
"mode": mode,
|
||||||
"mode": "production",
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
a.BaseSourceProvider.OutputFiles = android.Paths{generatedSource}
|
a.BaseSourceProvider.OutputFiles = android.Paths{generatedSource}
|
||||||
|
Reference in New Issue
Block a user