build system implementation for c/cpp test mode codegen
Bug: b/300488560
Test: added unit test and tested with AconfigDemoActivity app
Change-Id: I6ad71cc2dada8feb53662ec47c8acad5bc43d5ce
diff --git a/aconfig/cc_aconfig_library.go b/aconfig/cc_aconfig_library.go
index 14090bc..ec86af7 100644
--- a/aconfig/cc_aconfig_library.go
+++ b/aconfig/cc_aconfig_library.go
@@ -17,7 +17,9 @@
import (
"android/soong/android"
"android/soong/cc"
+
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
"fmt"
"strings"
@@ -32,6 +34,9 @@
type CcAconfigLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
Aconfig_declarations string
+
+ // whether to generate test mode version of the library
+ Test *bool
}
type CcAconfigLibraryCallbacks struct {
@@ -113,6 +118,12 @@
}
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
+ var mode string
+ if proptools.Bool(this.properties.Test) {
+ mode = "test"
+ } else {
+ mode = "production"
+ }
ctx.Build(pctx, android.BuildParams{
Rule: cppRule,
Input: declarations.IntermediatePath,
@@ -123,6 +134,7 @@
Description: "cc_aconfig_library",
Args: map[string]string{
"gendir": this.generatedDir.String(),
+ "mode": mode,
},
})
}