Skip to content

Commit

Permalink
Update dependency io.micronaut:micronaut-inject-java to v4 (#98)
Browse files Browse the repository at this point in the history
* Update dependency io.micronaut:micronaut-inject-java to v4

* FIx tests

* Update build-generate-LibrariesToTestCompatibility.gradle

* Fix tests

* Update build.gradle

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Semyon Levin <[email protected]>
Co-authored-by: Semyon Levin <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2023
1 parent bb3bd75 commit 135ed23
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
1 change: 1 addition & 0 deletions build-generate-LibrariesToTestCompatibility.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tasks.named('generateFunctionalTestJava') { Task task ->
it.writeImport("lombok.val")
it.println("")
it.println("@NoArgsConstructor(access = PRIVATE)")
it.writeSuppressWarnings("checkstyle:LineLength", "checkstyle:RightCurlyAlone")
it.writeBlock("abstract class ${it.simpleName}") {
it.println("")
it.println("private static final Map<String, String> MAPPING = ImmutableMap.<String, String>builder()")
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ createLombokArtifactsConfiguration('librariesToTestCompatibility', false)
dependencies {
librariesToTestCompatibility 'org.mapstruct:mapstruct:1.5.5.Final'
librariesToTestCompatibility 'org.mapstruct:mapstruct-processor:1.5.5.Final'
librariesToTestCompatibility 'io.micronaut:micronaut-inject-java:3.10.2'
librariesToTestCompatibility 'io.micronaut:micronaut-validation:3.10.2'
librariesToTestCompatibility 'io.micronaut:micronaut-inject-java:4.1.10'
librariesToTestCompatibility 'io.micronaut.validation:micronaut-validation:4.0.3'
librariesToTestCompatibility 'io.micronaut.validation:micronaut-validation-processor:4.0.3'
}

apply from: 'build-generate-LibrariesToTestCompatibility.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.nio.file.Path;
import lombok.RequiredArgsConstructor;
import lombok.val;
import name.remal.gradle_plugins.toolkit.testkit.MinSupportedJavaVersion;
import name.remal.gradle_plugins.toolkit.testkit.functional.GradleProject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
Expand All @@ -31,13 +32,14 @@ void beforeEach() {
project.forBuildFile(build -> {
build.applyPlugin("name.remal.lombok");
build.applyPlugin("java");
build.append("repositories { mavenCentral() }");
build.addMavenCentralRepository();
build.append("tasks.withType(JavaCompile) { options.compilerArgs.add('-parameters') }");
build.append("tasks.named('compileJava') {"
+ " options.generatedSourceOutputDirectory.fileValue(project.file('"
+ escapeGroovy(APT_GENERATED_FOLDER)
+ "'))"
+ " }"
build.append(
"tasks.named('compileJava') {",
" options.generatedSourceOutputDirectory.fileValue(",
" project.file('" + escapeGroovy(APT_GENERATED_FOLDER) + "')",
" )",
"}"
);
});

Expand Down Expand Up @@ -183,22 +185,29 @@ void mapstruct() throws Throwable {
}

@Test
void micronaut() throws Throwable {
project.forBuildFile(build -> {
build.append(format("dependencies { compileOnly '%s' }", escapeGroovy(getLibraryNotation(
"io.micronaut:micronaut-validation"
))));
build.append(format("dependencies { annotationProcessor '%s' }", escapeGroovy(getLibraryNotation(
"io.micronaut:micronaut-inject-java"
))));
});
@MinSupportedJavaVersion(17)
void micronaut() {
project.getBuildFile().appendBlock("dependencies", depsBlock -> depsBlock.append(
format(
"compileOnly '%s'",
escapeGroovy(getLibraryNotation("io.micronaut.validation:micronaut-validation"))
),
format(
"annotationProcessor '%s'",
escapeGroovy(getLibraryNotation("io.micronaut.validation:micronaut-validation-processor"))
),
format(
"annotationProcessor '%s'",
escapeGroovy(getLibraryNotation("io.micronaut:micronaut-inject-java"))
)
));

project.writeTextFile("src/main/java/pkg/TestClassValidated.java", join(
"\n",
"package pkg;",
"",
"import jakarta.inject.Singleton;",
"import javax.validation.constraints.NotEmpty;",
"import jakarta.validation.constraints.NotEmpty;",
"import io.micronaut.core.annotation.Introspected;",
"import lombok.Data;",
"import lombok.Setter;",
Expand Down

0 comments on commit 135ed23

Please sign in to comment.