Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7ece788 authored by Yu Liu's avatar Yu Liu Committed by Gerrit Code Review
Browse files

Merge "Store build targets in the soong metrics."

parents ba26bdc3 e737a991
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -355,13 +355,16 @@ func storeConfigMetrics(ctx Context, config Config) {
}

func buildConfig(config Config) *smpb.BuildConfig {
	return &smpb.BuildConfig{
	c := &smpb.BuildConfig{
		ForceUseGoma:    proto.Bool(config.ForceUseGoma()),
		UseGoma:         proto.Bool(config.UseGoma()),
		UseRbe:          proto.Bool(config.UseRBE()),
		BazelAsNinja:    proto.Bool(config.UseBazel()),
		BazelMixedBuild: proto.Bool(config.bazelBuildMode() == mixedBuild),
	}
	c.Targets = append(c.Targets, config.arguments...)

	return c
}

// getConfigArgs processes the command arguments based on the build action and creates a set of new
+18 −2
Original line number Diff line number Diff line
@@ -1003,6 +1003,7 @@ func TestBuildConfig(t *testing.T) {
	tests := []struct {
		name                string
		environ             Environment
		arguments           []string
		useBazel            bool
		expectedBuildConfig *smpb.BuildConfig
	}{
@@ -1073,6 +1074,20 @@ func TestBuildConfig(t *testing.T) {
				BazelMixedBuild: proto.Bool(true),
			},
		},
		{
			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{
@@ -1097,6 +1112,7 @@ func TestBuildConfig(t *testing.T) {
			c := &configImpl{
				environ:   &tc.environ,
				useBazel:  tc.useBazel,
				arguments: tc.arguments,
			}
			config := Config{c}
			actualBuildConfig := buildConfig(config)
+108 −96

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -123,6 +123,10 @@ message BuildConfig {
  // Whether build is occurring in a mixed build mode, where Bazel maintains the
  // definition and build of some modules in cooperation with Soong.
  optional bool bazel_mixed_build = 5;

  // These are the targets soong passes to ninja, these targets include special
  // targets such as droid as well as the regular build targets.
  repeated string targets = 6;
}

message SystemResourceInfo {