From 09e0dd2ec941464ba1359a45067b45d65f420419 Mon Sep 17 00:00:00 2001 From: Usta Shrestha Date: Tue, 20 Dec 2022 17:28:05 -0500 Subject: [PATCH 1/2] cosmetic: use map[_]struct{} for set semantics Bug: NA Test: `m nothing` then view soong_metrics Change-Id: I2b3354de3259ffef9ae881d59ac844fb518074f2 --- metrics/event_handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metrics/event_handler.go b/metrics/event_handler.go index f3641b0..3fd0f37 100644 --- a/metrics/event_handler.go +++ b/metrics/event_handler.go @@ -98,12 +98,12 @@ func (h *EventHandler) CompletedEvents() []Event { h.scopeIds)) } // Validate no two events have the same full id. - ids := map[string]bool{} + ids := map[string]struct{}{} for _, event := range h.completedEvents { if _, containsId := ids[event.Id]; containsId { panic(fmt.Errorf("Duplicate event registered: %s", event.Id)) } - ids[event.Id] = true + ids[event.Id] = struct{}{} } return h.completedEvents } From f0e02237da876ac9ae0c8102b14d445d7982e82a Mon Sep 17 00:00:00 2001 From: Usta Shrestha Date: Tue, 20 Dec 2022 17:30:18 -0500 Subject: [PATCH 2/2] comment on how glob files are written Bug: NA Test: NA Change-Id: I516c984b62d07ca7f188b2faef1466c5720b3b22 --- bootstrap/glob.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap/glob.go b/bootstrap/glob.go index 77de891..a766676 100644 --- a/bootstrap/glob.go +++ b/bootstrap/glob.go @@ -237,6 +237,8 @@ func generateGlobNinjaFile(glob *GlobSingleton, config interface{}) ([]byte, []e return nil, errs } + // PrepareBuildActions() will write $OUTDIR/soong/globs/$m/$i files + // where $m=bp2build|build and $i=0..numGlobBuckets extraDeps, errs = ctx.PrepareBuildActions(config) if len(extraDeps) > 0 { return nil, []error{fmt.Errorf("shouldn't have extra deps")}