From 55789448d7eb7baa7df761ccbfaec06e37c1ebb2 Mon Sep 17 00:00:00 2001 From: mpeddada1 Date: Mon, 18 Sep 2023 23:12:08 +0000 Subject: [PATCH 1/5] chore: exclude grpc-android from bom validation --- .../google/cloud/CreateBomCanaryProject.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java index 8560c0d5de4c..8401cad6d883 100644 --- a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java +++ b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java @@ -77,6 +77,26 @@ private static String calculateDependencyManagementSection(Bom bom) { String version = coordinatesElements[2]; StringBuilder builder = new StringBuilder(); + if (artifactId.equals("grpc-android")) { + builder.append(" \n"); + builder.append(" \n"); + builder.append(" \n"); + builder.append(" ").append(groupId).append("\n"); + builder.append(" ").append(artifactId).append("\n"); + builder.append(" ").append(version).append("\n"); + builder.append(" pom\n"); + builder.append(" import\n"); + builder.append(" \n"); + builder.append(" \n"); + builder.append(" io.grpc\n"); + builder.append(" grpc-android\n"); + builder.append(" \n"); + builder.append(" \n"); + builder.append(" \n"); + builder.append(" \n"); + builder.append(" \n"); + return builder.toString(); + } builder.append(" \n"); builder.append(" \n"); builder.append(" \n"); From 1eb437b50a2e17b1260062c72c7c8abea6c758b4 Mon Sep 17 00:00:00 2001 From: mpeddada1 Date: Mon, 18 Sep 2023 23:13:40 +0000 Subject: [PATCH 2/5] fix if-else statement --- .../src/main/java/com/google/cloud/CreateBomCanaryProject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java index 8401cad6d883..d6bc7bce5beb 100644 --- a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java +++ b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java @@ -77,7 +77,7 @@ private static String calculateDependencyManagementSection(Bom bom) { String version = coordinatesElements[2]; StringBuilder builder = new StringBuilder(); - if (artifactId.equals("grpc-android")) { + if (artifactId.equals("grpc-bom")) { builder.append(" \n"); builder.append(" \n"); builder.append(" \n"); From f965cf7da05e618cfcc7287da41ce8de6277606b Mon Sep 17 00:00:00 2001 From: mpeddada1 Date: Tue, 19 Sep 2023 15:23:56 +0000 Subject: [PATCH 3/5] exclude artifact frombeing added to validation bom --- .../google/cloud/CreateBomCanaryProject.java | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java index d6bc7bce5beb..eb4e6145721d 100644 --- a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java +++ b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java @@ -76,27 +76,11 @@ private static String calculateDependencyManagementSection(Bom bom) { String artifactId = coordinatesElements[1]; String version = coordinatesElements[2]; - StringBuilder builder = new StringBuilder(); - if (artifactId.equals("grpc-bom")) { - builder.append(" \n"); - builder.append(" \n"); - builder.append(" \n"); - builder.append(" ").append(groupId).append("\n"); - builder.append(" ").append(artifactId).append("\n"); - builder.append(" ").append(version).append("\n"); - builder.append(" pom\n"); - builder.append(" import\n"); - builder.append(" \n"); - builder.append(" \n"); - builder.append(" io.grpc\n"); - builder.append(" grpc-android\n"); - builder.append(" \n"); - builder.append(" \n"); - builder.append(" \n"); - builder.append(" \n"); - builder.append(" \n"); - return builder.toString(); + if (artifactId.equals("grpc-bom")){ + System.out.println("ARTIFACT iS GRPC"); } + + StringBuilder builder = new StringBuilder(); builder.append(" \n"); builder.append(" \n"); builder.append(" \n"); @@ -130,6 +114,9 @@ private static String calculateDependenciesSection(Bom bom) { // in "jar" artifacts. continue; } + if ("grpc-android".equals(managedDependency.getArtifactId())) { + continue; + } builder.append(" \n"); builder From 4f8f9bbacf66ab8cbdb372dd009d21660d35945d Mon Sep 17 00:00:00 2001 From: mpeddada1 Date: Tue, 19 Sep 2023 15:25:20 +0000 Subject: [PATCH 4/5] clean up --- .../main/java/com/google/cloud/CreateBomCanaryProject.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java index eb4e6145721d..e5a3a46ed1f0 100644 --- a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java +++ b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java @@ -76,10 +76,6 @@ private static String calculateDependencyManagementSection(Bom bom) { String artifactId = coordinatesElements[1]; String version = coordinatesElements[2]; - if (artifactId.equals("grpc-bom")){ - System.out.println("ARTIFACT iS GRPC"); - } - StringBuilder builder = new StringBuilder(); builder.append(" \n"); builder.append(" \n"); From 1358d39188d830d28b6ea9482b7b943fb376172f Mon Sep 17 00:00:00 2001 From: mpeddada1 Date: Tue, 19 Sep 2023 15:26:37 +0000 Subject: [PATCH 5/5] add comment --- .../main/java/com/google/cloud/CreateBomCanaryProject.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java index e5a3a46ed1f0..bebc300f80f3 100644 --- a/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java +++ b/tests/validate-bom/src/main/java/com/google/cloud/CreateBomCanaryProject.java @@ -110,6 +110,12 @@ private static String calculateDependenciesSection(Bom bom) { // in "jar" artifacts. continue; } + + // Skipping grpc-android as it is not used by Google Cloud Client Libraries for Java. Checking + // for availability of + // this unused artifact on Maven Central has caused BOM validation check to fail in the past. + // See + // https://github.com/googleapis/sdk-platform-java/pull/1989#issuecomment-1724039670 if ("grpc-android".equals(managedDependency.getArtifactId())) { continue; }