Store build targets in the soong metrics.
Bug: 194519312
Test: Added unit test and verified the soong metrics file generated.
Change-Id: I832da2501e0e8d3435d4f92642cf45ddccb7f2ea
diff --git a/ui/build/config_test.go b/ui/build/config_test.go
index 1f2158b..03d304e 100644
--- a/ui/build/config_test.go
+++ b/ui/build/config_test.go
@@ -1003,6 +1003,7 @@
tests := []struct {
name string
environ Environment
+ arguments []string
useBazel bool
expectedBuildConfig *smpb.BuildConfig
}{
@@ -1074,6 +1075,20 @@
},
},
{
+ name: "specified targets",
+ environ: Environment{},
+ useBazel: true,
+ arguments: []string{"droid", "dist"},
+ expectedBuildConfig: &smpb.BuildConfig{
+ ForceUseGoma: proto.Bool(false),
+ UseGoma: proto.Bool(false),
+ UseRbe: proto.Bool(false),
+ BazelAsNinja: proto.Bool(true),
+ BazelMixedBuild: proto.Bool(false),
+ Targets: []string{"droid", "dist"},
+ },
+ },
+ {
name: "all set",
environ: Environment{
"FORCE_USE_GOMA=1",
@@ -1095,8 +1110,9 @@
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
c := &configImpl{
- environ: &tc.environ,
- useBazel: tc.useBazel,
+ environ: &tc.environ,
+ useBazel: tc.useBazel,
+ arguments: tc.arguments,
}
config := Config{c}
actualBuildConfig := buildConfig(config)