Skip to content

Commit

Permalink
Merge branch 'main' into numberParser
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan authored Jun 10, 2024
2 parents 5130497 + b0a9cef commit 4374364
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 56 deletions.
18 changes: 17 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push, pull_request, workflow_dispatch]
on: [push, workflow_dispatch]

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/jdk-ea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: JDK EA

on:
push:
workflow_dispatch:
schedule:
- cron: '39 6 * * 1,3,5'
Expand Down
10 changes: 5 additions & 5 deletions blackbox-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-parent</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>blackbox-test</artifactId>
Expand All @@ -28,7 +28,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- <dependency>-->
Expand All @@ -39,15 +39,15 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject</artifactId>
<version>9.11</version>
<version>9.12</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-generator</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -56,7 +56,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions jsonb-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<parent>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-parent</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>avaje-jsonb-generator</artifactId>
<name>jsonb generator</name>
<description>annotation processor generating source code json adapters for avaje-jsonb</description>
<properties>
<avaje.prisms.version>1.21</avaje.prisms.version>
<avaje.prisms.version>1.24</avaje.prisms.version>
</properties>

<dependencies>
Expand All @@ -36,7 +36,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}

Expand All @@ -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<JsonPrism> importedJson(TypeElement type) {
Expand All @@ -76,35 +69,54 @@ static List<SubTypePrism> 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) {
Expand Down
6 changes: 3 additions & 3 deletions jsonb-inject-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>avaje-jsonb-parent</artifactId>
<groupId>io.avaje</groupId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>avaje-jsonb-inject-plugin</artifactId>
Expand All @@ -26,15 +26,15 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject</artifactId>
<version>9.11</version>
<version>9.12</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions jsonb-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>avaje-jsonb-parent</artifactId>
<groupId>io.avaje</groupId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>avaje-jsonb-jackson</artifactId>
Expand All @@ -16,7 +16,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.0</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion jsonb-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.1</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions jsonb-spring-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>avaje-jsonb-parent</artifactId>
<groupId>io.avaje</groupId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>avaje-jsonb-spring-starter</artifactId>
Expand All @@ -18,7 +18,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.2.3</version>
<version>3.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions jsonb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-parent</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>
</parent>

<artifactId>avaje-jsonb</artifactId>
Expand All @@ -22,15 +22,15 @@
<dependency>
<groupId>io.helidon.webserver</groupId>
<artifactId>helidon-webserver</artifactId>
<version>4.0.5</version>
<version>4.0.9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>org.avaje</groupId>
<artifactId>java11-oss</artifactId>
<version>4.0</version>
<version>4.3</version>
</parent>

<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb-parent</artifactId>
<version>1.11-RC3</version>
<version>1.12-SNAPSHOT</version>

<packaging>pom</packaging>
<name>jsonb parent</name>
Expand Down

0 comments on commit 4374364

Please sign in to comment.