From 9e30bf6f691a38234f55ace17ef550b8f26f93b2 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Tue, 30 Jun 2026 21:31:06 -0400 Subject: [PATCH 1/2] fix(internal/librarian/java): exclude google-cloud-bom and libraries-bom when generating gapic-libraries-bom/pom.xml --- internal/librarian/java/postgenerate.go | 2 ++ internal/librarian/java/postgenerate_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/internal/librarian/java/postgenerate.go b/internal/librarian/java/postgenerate.go index 8c8f95f8f28..cdc6423e796 100644 --- a/internal/librarian/java/postgenerate.go +++ b/internal/librarian/java/postgenerate.go @@ -49,6 +49,8 @@ var ( // excludedBOMs is a set of artifact IDs to exclude from the generated GAPIC BOM. excludedBOMs = map[string]bool{ "google-cloud-bigtable-deps-bom": true, + "google-cloud-bom": true, + "libraries-bom": true, } ignoredDirs = map[string]bool{ gapicBOM: true, diff --git a/internal/librarian/java/postgenerate_test.go b/internal/librarian/java/postgenerate_test.go index e097fe25d5b..65401e321e9 100644 --- a/internal/librarian/java/postgenerate_test.go +++ b/internal/librarian/java/postgenerate_test.go @@ -137,6 +137,16 @@ func verifyBOM(t *testing.T, path string, wantVersion string, wantDeps []bomDepe }) { t.Errorf("%s should NOT contain google-cloud-bigtable-deps-bom", path) } + if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { + return d.ArtifactID == "google-cloud-bom" + }) { + t.Errorf("%s should NOT contain google-cloud-bom", path) + } + if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { + return d.ArtifactID == "libraries-bom" + }) { + t.Errorf("%s should NOT contain libraries-bom", path) + } } func TestSearchForJavaModules(t *testing.T) { From 10f027607d34fc7f699b17365e8cc4a5b1681a14 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Tue, 30 Jun 2026 21:38:26 -0400 Subject: [PATCH 2/2] reduce repeated code in test --- internal/librarian/java/postgenerate_test.go | 29 ++++++-------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/internal/librarian/java/postgenerate_test.go b/internal/librarian/java/postgenerate_test.go index 65401e321e9..519bcb0da35 100644 --- a/internal/librarian/java/postgenerate_test.go +++ b/internal/librarian/java/postgenerate_test.go @@ -126,26 +126,15 @@ func verifyBOM(t *testing.T, path string, wantVersion string, wantDeps []bomDepe t.Errorf("mismatch (-want +got):\n%s", diff) } // Verify that libraries like java-maps-places are excluded because their - // GroupID (com.google.maps) is not in the allowed groupInclusions list. - if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { - return d.ArtifactID == "google-maps-places-bom" - }) { - t.Errorf("%s should NOT contain google-maps-places-bom", path) - } - if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { - return d.ArtifactID == "google-cloud-bigtable-deps-bom" - }) { - t.Errorf("%s should NOT contain google-cloud-bigtable-deps-bom", path) - } - if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { - return d.ArtifactID == "google-cloud-bom" - }) { - t.Errorf("%s should NOT contain google-cloud-bom", path) - } - if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { - return d.ArtifactID == "libraries-bom" - }) { - t.Errorf("%s should NOT contain libraries-bom", path) + // GroupID (com.google.maps) is not in the allowed groupInclusions list, and + // other BOMs explicitly excluded in excludedBOMs are also absent. + for _, excluded := range []string{"google-maps-places-bom", + "google-cloud-bigtable-deps-bom", "google-cloud-bom", "libraries-bom"} { + if slices.ContainsFunc(p.Dependencies, func(d bomDependency) bool { + return d.ArtifactID == excluded + }) { + t.Errorf("%s should NOT contain %s", path, excluded) + } } }