diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6da8cf94..0852ee27 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,5 +3,21 @@ updates: - package-ecosystem: maven directory: "/" schedule: - interval: "daily" + interval: "weekly" open-pull-requests-limit: 10 + groups: + dev-deps: + dependency-type: "development" + prod-deps: + dependency-type: "production" + +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + commit-message: + prefix: "[workflow]" + labels: + - "dependencies" + target-branch: "master" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce1c4ae3..d8010a8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build -on: [push, pull_request, workflow_dispatch] +on: [push, workflow_dispatch] jobs: build: diff --git a/.github/workflows/jdk-ea.yml b/.github/workflows/jdk-ea.yml index ed8e24dd..28e94bc2 100644 --- a/.github/workflows/jdk-ea.yml +++ b/.github/workflows/jdk-ea.yml @@ -2,6 +2,7 @@ name: JDK EA on: + push: workflow_dispatch: schedule: - cron: '39 6 * * 1,3,5' diff --git a/blackbox-test/pom.xml b/blackbox-test/pom.xml index 9c343dbb..0a768671 100644 --- a/blackbox-test/pom.xml +++ b/blackbox-test/pom.xml @@ -4,7 +4,7 @@ io.avaje avaje-jsonb-parent - 1.11-RC3 + 1.12-SNAPSHOT blackbox-test @@ -28,7 +28,7 @@ io.avaje avaje-jsonb - 1.11-RC3 + 1.12-SNAPSHOT @@ -39,7 +39,7 @@ io.avaje avaje-inject - 9.11 + 9.12 provided true @@ -47,7 +47,7 @@ io.avaje avaje-jsonb-generator - 1.11-RC3 + 1.12-SNAPSHOT provided @@ -56,7 +56,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/jsonb-generator/pom.xml b/jsonb-generator/pom.xml index 85a9fcc6..5ff3986d 100644 --- a/jsonb-generator/pom.xml +++ b/jsonb-generator/pom.xml @@ -4,14 +4,14 @@ io.avaje avaje-jsonb-parent - 1.11-RC3 + 1.12-SNAPSHOT avaje-jsonb-generator jsonb generator annotation processor generating source code json adapters for avaje-jsonb - 1.21 + 1.24 @@ -36,7 +36,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/jsonb-generator/src/main/java/io/avaje/jsonb/generator/ProcessingContext.java b/jsonb-generator/src/main/java/io/avaje/jsonb/generator/ProcessingContext.java index b8a0583c..2ca9ef5c 100644 --- a/jsonb-generator/src/main/java/io/avaje/jsonb/generator/ProcessingContext.java +++ b/jsonb-generator/src/main/java/io/avaje/jsonb/generator/ProcessingContext.java @@ -8,11 +8,9 @@ import static io.avaje.jsonb.generator.APContext.logWarn; import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - +import java.net.URI; +import java.nio.file.Paths; +import java.util.*; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; @@ -30,8 +28,7 @@ private static final class Ctx { private boolean validated; Ctx(ProcessingEnvironment env) { - this.injectPresent = - env.getElementUtils().getTypeElement("io.avaje.inject.Component") != null; + this.injectPresent = env.getElementUtils().getTypeElement("io.avaje.inject.Component") != null; } } @@ -52,20 +49,16 @@ static FileObject createMetaInfWriterFor(String interfaceType) throws IOExceptio static void addImportedPrism(ImportPrism prism, Element element) { if (!prism.subtypes().isEmpty() && prism.value().size() > 1) { - logError( - element, "subtypes cannot be used when an import annotation imports more than one class"); + logError(element, "subtypes cannot be used when an import annotation imports more than one class"); return; } final var json = CTX.get().importedJsonMap; final var subtypes = CTX.get().importedSubtypeMap; - prism - .value() - .forEach( - m -> { - final var type = m.toString(); - json.put(type, prism.jsonSettings()); - subtypes.put(type, prism.subtypes()); - }); + prism.value().forEach(m -> { + final var type = m.toString(); + json.put(type, prism.jsonSettings()); + subtypes.put(type, prism.subtypes()); + }); } static Optional importedJson(TypeElement type) { @@ -76,35 +69,54 @@ static List importedSubtypes(TypeElement type) { return CTX.get().importedSubtypeMap.getOrDefault(type.asType().toString(), List.of()); } + private static boolean buildPluginAvailable() { + return resourceExists("target/avaje-plugin-exists.txt") + || resourceExists("build/avaje-plugin-exists.txt"); + } + + private static boolean resourceExists(String relativeName) { + try { + final String resource = + filer() + .getResource(StandardLocation.CLASS_OUTPUT, "", relativeName) + .toUri() + .toString() + .replaceFirst("/target/classes", "") + .replaceFirst("/build/classes/java/main", ""); + return Paths.get(new URI(resource)).toFile().exists(); + } catch (final Exception e) { + return false; + } + } + static void validateModule(String fqn) { var module = getProjectModuleElement(); if (module != null && !CTX.get().validated && !module.isUnnamed()) { - var injectPresent = CTX.get().injectPresent; CTX.get().validated = true; try (var reader = getModuleInfoReader()) { - var moduleInfo = new ModuleInfoReader(module, reader); boolean noInjectPlugin = - injectPresent && !moduleInfo.containsOnModulePath("io.avaje.jsonb.plugin"); + injectPresent && !moduleInfo.containsOnModulePath("io.avaje.jsonb.plugin"); var noProvides = - moduleInfo.provides().stream() - .flatMap(s -> s.implementations().stream()) - .noneMatch(s -> s.contains(fqn)); + moduleInfo.provides().stream() + .flatMap(s -> s.implementations().stream()) + .noneMatch(s -> s.contains(fqn)); - if (noProvides) { - logError( - module, "Missing `provides io.avaje.jsonb.Jsonb.GeneratedComponent with %s;`", fqn); + var buildPluginAvailable = buildPluginAvailable(); + if (noProvides && !buildPluginAvailable) { + logError(module, "Missing `provides io.avaje.jsonb.Jsonb.GeneratedComponent with %s;`", fqn); } - if (noInjectPlugin) { - logWarn( - module, - "`requires io.avaje.jsonb.plugin` must be explicity added or else avaje-inject may fail to detect and wire the default Jsonb instance", - fqn); + final var noDirectJsonb = + moduleInfo.requires().stream() + .noneMatch(r -> r.getDependency().getQualifiedName().contentEquals("io.avaje.jsonb")); + + if (noInjectPlugin && (!buildPluginAvailable || noDirectJsonb)) { + logWarn(module, "`requires io.avaje.jsonb.plugin` must be explicity added or else avaje-inject may fail to detect and wire the default Jsonb instance", fqn); } } catch (Exception e) { diff --git a/jsonb-inject-plugin/pom.xml b/jsonb-inject-plugin/pom.xml index d9b6cc5f..b9cb39c5 100644 --- a/jsonb-inject-plugin/pom.xml +++ b/jsonb-inject-plugin/pom.xml @@ -6,7 +6,7 @@ avaje-jsonb-parent io.avaje - 1.11-RC3 + 1.12-SNAPSHOT avaje-jsonb-inject-plugin @@ -26,7 +26,7 @@ io.avaje avaje-inject - 9.11 + 9.12 provided true @@ -34,7 +34,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/jsonb-jackson/pom.xml b/jsonb-jackson/pom.xml index 55eab6cd..e92b2bd1 100644 --- a/jsonb-jackson/pom.xml +++ b/jsonb-jackson/pom.xml @@ -4,7 +4,7 @@ avaje-jsonb-parent io.avaje - 1.11-RC3 + 1.12-SNAPSHOT avaje-jsonb-jackson @@ -16,7 +16,7 @@ com.fasterxml.jackson.core jackson-core - 2.17.0 + 2.17.1 io.avaje @@ -27,7 +27,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/jsonb-jakarta/pom.xml b/jsonb-jakarta/pom.xml index 074d8ed2..2a971bd4 100644 --- a/jsonb-jakarta/pom.xml +++ b/jsonb-jakarta/pom.xml @@ -47,7 +47,7 @@ io.avaje junit - 1.1 + 1.5 test diff --git a/jsonb-spring-adapter/pom.xml b/jsonb-spring-adapter/pom.xml index 2cf878dc..12d0842f 100644 --- a/jsonb-spring-adapter/pom.xml +++ b/jsonb-spring-adapter/pom.xml @@ -6,7 +6,7 @@ avaje-jsonb-parent io.avaje - 1.11-RC3 + 1.12-SNAPSHOT avaje-jsonb-spring-starter @@ -18,7 +18,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.3 + 3.3.0 pom import @@ -59,7 +59,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/jsonb/pom.xml b/jsonb/pom.xml index 4be011e8..77f1713e 100644 --- a/jsonb/pom.xml +++ b/jsonb/pom.xml @@ -4,7 +4,7 @@ io.avaje avaje-jsonb-parent - 1.11-RC3 + 1.12-SNAPSHOT avaje-jsonb @@ -22,7 +22,7 @@ io.helidon.webserver helidon-webserver - 4.0.5 + 4.0.9 provided true @@ -30,7 +30,7 @@ io.avaje junit - 1.4 + 1.5 test diff --git a/pom.xml b/pom.xml index 398559a2..c11dbd69 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ org.avaje java11-oss - 4.0 + 4.3 io.avaje avaje-jsonb-parent - 1.11-RC3 + 1.12-SNAPSHOT pom jsonb parent