From d7dee83d9938672107008addd8183312b9f29a57 Mon Sep 17 00:00:00 2001 From: bageshwar <2353296+bageshwar@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:36:35 +0530 Subject: [PATCH 1/3] Having an uber pom for better build --- .../pibify/core/PibifyConfiguration.java | 7 +++- pom.xml | 38 +++++++++++++++++++ .../dropwizard/test-dropwizard/pom.xml | 4 +- .../pibify/PibifyDemoApplication.java | 10 +++-- test-environments/lombok/pom.xml | 2 +- test-environments/vertx/pom.xml | 9 ++++- .../java/com/flipkart/pibify/Product.java | 13 ++++++- 7 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 pom.xml diff --git a/pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java b/pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java index 06a7f37..2b6beb2 100644 --- a/pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java +++ b/pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java @@ -18,6 +18,8 @@ package com.flipkart.pibify.core; +import java.util.logging.Logger; + /** * This class is used for configuring pibify * Author bageshwar.pn @@ -25,6 +27,9 @@ */ public class PibifyConfiguration { + private static final Logger logger = Logger.getLogger(PibifyConfiguration.class.getName()); + + private static PibifyConfiguration INSTANCE; private boolean ignoreUnknownFields = true; private boolean ignoreUnknownEnums = true; @@ -61,7 +66,7 @@ public Builder() { synchronized public void build() { // A way to keep the static instance pseudo-final if (PibifyConfiguration.INSTANCE != null) { - throw new IllegalStateException("Re-creating pibify configuration"); + logger.warning("Re-creating pibify configuration"); } PibifyConfiguration.INSTANCE = config; } diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c0fada7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + com.flipkart.pibify + pibify + pom + 1.6 + pibify + + 4.28.2 + + + pibify-core + pibify-maven-plugin + test-environments/pibify-test-vanilla + test-environments/dropwizard/test-dropwizard + test-environments/lombok + test-environments/vertx + + diff --git a/test-environments/dropwizard/test-dropwizard/pom.xml b/test-environments/dropwizard/test-dropwizard/pom.xml index 46d34d0..8a6d7b9 100644 --- a/test-environments/dropwizard/test-dropwizard/pom.xml +++ b/test-environments/dropwizard/test-dropwizard/pom.xml @@ -24,12 +24,12 @@ 4.0.0 - pibify + com.pibify test-dropwizard 1.0-SNAPSHOT jar - PibifyDemo + pibify-test-dropwizard UTF-8 diff --git a/test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java b/test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java index b13756a..f6acf65 100644 --- a/test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java +++ b/test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java @@ -18,6 +18,7 @@ package com.flipkart.pibify; +import com.flipkart.pibify.codegen.stub.AbstractPibifyHandlerCache; import com.flipkart.pibify.dropwizard.JakartaPibifyMessageBodyWriter; import com.flipkart.pibify.paritychecker.IParityChecker; import com.flipkart.pibify.paritychecker.IParityCheckerListener; @@ -29,7 +30,6 @@ import io.dropwizard.core.Application; import io.dropwizard.core.setup.Bootstrap; import io.dropwizard.core.setup.Environment; -import pibify.generated.pibify.PibifyHandlerCache; import java.util.Optional; @@ -55,10 +55,12 @@ public void initialize(final Bootstrap bootstrap) { public void run(final PibifyDemoConfiguration configuration, final Environment environment) { - environment.jersey().register(new JakartaPibifyMessageBodyWriter(PibifyHandlerCache.getInstance(), new PibifySampler())); + AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache"); + + environment.jersey().register(new JakartaPibifyMessageBodyWriter(handlerCache, new PibifySampler())); environment.jersey().register(new SampleResource()); - environment.jersey().register(new JakartaParityCheckerResource(PibifyHandlerCache.getInstance())); - IParityChecker parityChecker = new PibifyParityChecker(PibifyHandlerCache.getInstance(), new ParityCheckerListener(), + environment.jersey().register(new JakartaParityCheckerResource(handlerCache)); + IParityChecker parityChecker = new PibifyParityChecker(handlerCache, new ParityCheckerListener(), Optional.of(() -> null), new PibifySampler()); environment.jersey().register(new JakartaJsonResponseFilter(parityChecker)); } diff --git a/test-environments/lombok/pom.xml b/test-environments/lombok/pom.xml index da1a7e7..f795ce5 100644 --- a/test-environments/lombok/pom.xml +++ b/test-environments/lombok/pom.xml @@ -44,7 +44,7 @@ com.flipkart.pibify pibify-maven-plugin - 1.1 + 1.6 generate-sources diff --git a/test-environments/vertx/pom.xml b/test-environments/vertx/pom.xml index 39511f1..a8a2e75 100644 --- a/test-environments/vertx/pom.xml +++ b/test-environments/vertx/pom.xml @@ -46,7 +46,14 @@ com.flipkart.pibify pibify-maven-plugin - 1.3 + 1.6 + + + io.vertx + vertx-core + 4.5.9 + + generate-sources diff --git a/test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java b/test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java index 5e29ffa..285af11 100644 --- a/test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java +++ b/test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java @@ -18,14 +18,25 @@ package com.flipkart.pibify; +import com.flipkart.pibify.core.Pibify; + /** * This class is used for * Author bageshwar.pn * Date 02/10/24 */ public class Product { - String id, name; + + @Pibify(1) + String id; + + @Pibify(2) + String name; + + @Pibify(3) int weight; + + @Pibify(4) double price; public Product(String id, String name, double price, int weight) { From c7c3068176135e3c1eb9c4e869b675a5c9670f1b Mon Sep 17 00:00:00 2001 From: bageshwar <2353296+bageshwar@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:40:22 +0530 Subject: [PATCH 2/3] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ded1b74..06b6aa0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,10 +21,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 8 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '8' + java-version: '17' distribution: 'temurin' cache: maven - name: Build with Maven From 92917043bdf9ed40379c400b73eefe9dd291aa1c Mon Sep 17 00:00:00 2001 From: bageshwar <2353296+bageshwar@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:52:44 +0530 Subject: [PATCH 3/3] Ignore depgraph-maven-plugin temporarily --- .github/workflows/maven.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 06b6aa0..523f24a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -31,5 +31,6 @@ jobs: run: mvn -B package --file pom.xml # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive - - name: Update dependency graph - uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + # Disabled temporarily + # - name: Update dependency graph + # uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6