Skip to content

Commit

Permalink
Merge branch '4.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo committed Oct 27, 2022
2 parents c00556a + 6a27eff commit bbea955
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/central-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'
- name: Publish to Sonatype OSSRH
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['11', '17']
java: ['17']
graalvm: ['latest', 'dev']
steps:
# https://github.com/actions/virtual-environments/issues/709
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8', '11', '17']
java: ['17']
steps:
# https://github.com/actions/virtual-environments/issues/709
- name: Free disk space
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
name: binary-compatibility-reports
path: "**/build/reports/binary-compatibility-*.html"
- name: Publish to Sonatype Snapshots
if: success() && github.event_name == 'push' && matrix.java == '11'
if: success() && github.event_name == 'push' && matrix.java == '17'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand All @@ -88,7 +88,7 @@ jobs:
if_true: "micronaut-projects/micronaut-docs"
if_false: ${{ github.repository }}
- name: Publish to Github Pages
if: success() && github.event_name == 'push' && matrix.java == '11'
if: success() && github.event_name == 'push' && matrix.java == '17'
uses: micronaut-projects/github-pages-deploy-action@master
env:
TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'
- name: Publish to Sonatype Snapshots
if: success()
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'
- name: Set the current release version
id: release_version
run: echo ::set-output name=release_version::${GITHUB_REF:11}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Optional setup step
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
Expand Down
Binary file added .settings.gradle.swp
Binary file not shown.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "io.micronaut.build.internal.docs"
id "io.micronaut.build.internal.dependency-updates"
id "io.micronaut.build.internal.quality-reporting"
}

Expand Down
5 changes: 5 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal()
mavenCentral()
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("org.codehaus.groovy:groovy"))
.using(module("org.apache.groovy:groovy:4.0.6"))
}
}

dependencies {
testRuntimeOnly mn.snakeyaml
}

20 changes: 20 additions & 0 deletions config/accepted-api-changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@
"type": "io.micronaut.servlet.http.ServletCookies",
"member": "Constructor io.micronaut.servlet.http.ServletCookies(java.lang.String,io.micronaut.http.HttpHeaders,io.micronaut.core.convert.ConversionService)",
"reason": "removed deprecated class for Micronaut 4.0.x"
},
{
"type": "io.micronaut.servlet.http.ServletCookies",
"member": "Implemented interface io.micronaut.core.convert.value.ConvertibleValues",
"reason": "removed deprecated class for Micronaut 4.0.x"
},
{
"type": "io.micronaut.servlet.http.ServletCookies",
"member": "Implemented interface io.micronaut.core.value.ValueResolver",
"reason": "removed deprecated class for Micronaut 4.0.x"
},
{
"type": "io.micronaut.servlet.http.ServletCookies",
"member": "Implemented interface java.lang.Iterable",
"reason": "removed deprecated class for Micronaut 4.0.x"
},
{
"type": "io.micronaut.servlet.http.ServletCookies",
"member": "Implemented interface io.micronaut.http.cookie.Cookies",
"reason": "removed deprecated class for Micronaut 4.0.x"
}
]

6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ projectGroup=io.micronaut.servlet
micronautDocsVersion=2.0.0
micronautVersion=4.0.0-SNAPSHOT

micronautTestVersion=3.7.0
micronautTestVersion=4.0.0-SNAPSHOT

groovyVersion=3.0.13
spockVersion=2.1-groovy-3.0
groovyVersion=4.0.6
spockVersion=2.3-groovy-4.0
kotlinVersion=1.7.20

title=Micronaut Servlet
Expand Down
21 changes: 1 addition & 20 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,10 @@ kotest-runner = '5.4.1'
undertow = '2.2.18.Final'
jetty = '9.4.49.v20220914'
tomcat = '9.0.65'
google-cloud-functions = '1.0.4'

[libraries]
managed-servlet-api = { module = 'javax.servlet:javax.servlet-api', version.ref = 'managed-servlet-api' }

micronaut-graal = { module = 'io.micronaut:micronaut-graal' }
micronaut-http-server = { module = 'io.micronaut:micronaut-http-server' }
micronaut-http-netty = { module = 'io.micronaut:micronaut-http-netty' }
micronaut-inject = { module = 'io.micronaut:micronaut-inject' }
micronaut-inject-java = { module = 'io.micronaut:micronaut-inject-java' }
micronaut-management = { module = 'io.micronaut:micronaut-management' }
micronaut-kotest = { module = 'io.micronaut.test:micronaut-test-kotest' }
micronaut-session = { module = 'io.micronaut:micronaut-session' }
micronaut-http-client = { module = 'io.micronaut:micronaut-http-client' }
micronaut-reactor = { module = 'io.micronaut.reactor:micronaut-reactor' }
micronaut-router = { module = 'io.micronaut:micronaut-router' }
micronaut-security = { module = 'io.micronaut.security:micronaut-security' }
micronaut-reactor-http-client = { module = 'io.micronaut.reactor:micronaut-reactor-http-client' }

groovy-json = { module = 'org.codehaus.groovy:groovy-json' }
graal = { module = "org.graalvm.nativeimage:svm" }
projectreactor = { module = 'io.projectreactor:reactor-core' }
junit-jupiter-engine = { module = 'org.junit.jupiter:junit-jupiter-engine' }
kotlin-stdlib-jdk8 = { module = 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' }
kotlin-reflect = { module = 'org.jetbrains.kotlin:kotlin-reflect' }
Expand All @@ -40,5 +22,4 @@ kotlinx-coroutines-rx2 = { module = 'org.jetbrains.kotlinx:kotlinx-coroutines-rx
tomcat-embed-core = { module = 'org.apache.tomcat.embed:tomcat-embed-core', version.ref = 'tomcat' }
undertow-servlet = { module = 'io.undertow:undertow-servlet', version.ref = 'undertow' }
jetty = { module = 'org.eclipse.jetty:jetty-servlet', version.ref = 'jetty' }
google-cloud-functions = { module = 'com.google.cloud.functions:functions-framework-api', version.ref = 'google-cloud-functions' }
kotest-runner = { module = 'io.kotest:kotest-runner-junit5', version.ref = 'kotest-runner' }
kotest-runner = { module = 'io.kotest:kotest-runner-junit5', version.ref = 'kotest-runner' }
22 changes: 11 additions & 11 deletions http-server-jetty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ plugins {
}

dependencies {
annotationProcessor libs.micronaut.graal
annotationProcessor mn.micronaut.graal

api project(":servlet-engine")
api libs.micronaut.http.server
api projects.servletEngine
api mn.micronaut.http.server

implementation(libs.jetty)

testAnnotationProcessor libs.micronaut.inject.java
testImplementation libs.micronaut.management
testImplementation libs.micronaut.http.client
testImplementation libs.micronaut.session
testImplementation(libs.groovy.json)
testImplementation libs.micronaut.reactor
testImplementation libs.micronaut.reactor.http.client
testAnnotationProcessor mn.micronaut.inject.java
testImplementation mn.micronaut.management
testImplementation mn.micronaut.http.client
testImplementation mn.micronaut.session
testImplementation(mn.groovy.json)
testImplementation mn.micronaut.reactor
testImplementation mn.micronaut.reactor.http.client

testImplementation(libs.micronaut.security)
testImplementation(mn.micronaut.security)
}
18 changes: 9 additions & 9 deletions http-server-tomcat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ plugins {
}

dependencies {
annotationProcessor libs.micronaut.graal
annotationProcessor mn.micronaut.graal

api project(":servlet-engine")
api libs.micronaut.http.server
api projects.servletEngine
api mn.micronaut.http.server

compileOnly libs.graal
compileOnly mn.graal

implementation libs.tomcat.embed.core

testAnnotationProcessor libs.micronaut.inject.java
testImplementation libs.micronaut.session
testImplementation libs.micronaut.http.client
testImplementation libs.projectreactor
testImplementation libs.micronaut.security
testAnnotationProcessor mn.micronaut.inject.java
testImplementation mn.micronaut.session
testImplementation mn.micronaut.http.client
testImplementation mn.reactor
testImplementation mn.micronaut.security
}

16 changes: 8 additions & 8 deletions http-server-undertow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ plugins {
}

dependencies {
annotationProcessor libs.micronaut.graal
annotationProcessor mn.micronaut.graal

api project(":servlet-engine")
api libs.micronaut.http.server
api projects.servletEngine
api mn.micronaut.http.server

implementation libs.undertow.servlet

testAnnotationProcessor libs.micronaut.inject.java
testImplementation libs.micronaut.http.client
testImplementation libs.micronaut.session
testImplementation libs.projectreactor
testImplementation libs.micronaut.security
testAnnotationProcessor mn.micronaut.inject.java
testImplementation mn.micronaut.http.client
testImplementation mn.micronaut.session
testImplementation mn.reactor
testImplementation mn.micronaut.security
}
12 changes: 6 additions & 6 deletions servlet-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ plugins {
}

dependencies {
api libs.micronaut.inject
api libs.micronaut.http.server
api mn.micronaut.inject
api mn.micronaut.http.server

implementation libs.micronaut.http.netty
implementation libs.micronaut.router
implementation libs.projectreactor
implementation mn.micronaut.http.netty
implementation mn.micronaut.router
implementation mn.reactor

testAnnotationProcessor libs.micronaut.inject.java
testAnnotationProcessor mn.micronaut.inject.java
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
import static io.micronaut.core.util.KotlinUtils.isKotlinCoroutineSuspended;
import static io.micronaut.http.HttpAttributes.AVAILABLE_HTTP_METHODS;
import static io.micronaut.http.HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD;
import static io.micronaut.inject.util.KotlinExecutableMethodUtils.isKotlinFunctionReturnTypeUnit;
import static io.micronaut.inject.beans.KotlinExecutableMethodUtils.isKotlinFunctionReturnTypeUnit;

/**
* An HTTP handler that can deal with Serverless requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import io.micronaut.http.HttpStatus;
import io.micronaut.http.MutableHttpResponse;
import io.micronaut.http.context.ServerRequestContext;
import io.micronaut.http.server.exceptions.InternalServerException;
import io.micronaut.http.simple.SimpleHttpResponseFactory;

import java.util.Objects;

/**
* An implementation of the {@link HttpResponseFactory} case that retrieves the
* response object from the current request bound to the current thread.
Expand All @@ -45,11 +46,7 @@ public class ServletResponseFactory implements HttpResponseFactory {
}
}

if (alternate != null) {
ALTERNATE = alternate;
} else {
ALTERNATE = new SimpleHttpResponseFactory();
}
ALTERNATE = Objects.requireNonNullElseGet(alternate, SimpleHttpResponseFactory::new);
}

@SuppressWarnings("unchecked")
Expand All @@ -60,27 +57,24 @@ public <T> MutableHttpResponse<T> ok(T body) {
final MutableHttpResponse response = ((ServletExchange) req).getResponse();
return response.status(HttpStatus.OK).body(body);
} else {
if (ALTERNATE != null) {
return ALTERNATE.ok(body);
} else {
throw new InternalServerException("No request present");
}
return ALTERNATE.ok(body);
}
}

@SuppressWarnings("unchecked")
@Override
public <T> MutableHttpResponse<T> status(HttpStatus status, String reason) {
return status(status.getCode(), reason);
}

@Override
public <T> MutableHttpResponse<T> status(int status, String reason) {
final HttpRequest<Object> req = ServerRequestContext.currentRequest().orElse(null);
if (req instanceof ServletExchange) {
final MutableHttpResponse response = ((ServletExchange) req).getResponse();
final MutableHttpResponse<T> response = ((ServletExchange) req).getResponse();
return response.status(status, reason);
} else {
if (ALTERNATE != null) {
return ALTERNATE.status(status, reason);
} else {
throw new InternalServerException("No request present");
}
return ALTERNATE.status(status, reason);
}
}

Expand All @@ -89,14 +83,10 @@ public <T> MutableHttpResponse<T> status(HttpStatus status, String reason) {
public <T> MutableHttpResponse<T> status(HttpStatus status, T body) {
final HttpRequest<Object> req = ServerRequestContext.currentRequest().orElse(null);
if (req instanceof ServletExchange) {
final MutableHttpResponse response = ((ServletExchange) req).getResponse();
final MutableHttpResponse<T> response = ((ServletExchange) req).getResponse();
return response.status(status).body(body);
} else {
if (ALTERNATE != null) {
return ALTERNATE.status(status, body);
} else {
throw new InternalServerException("No request present");
}
return ALTERNATE.status(status, body);
}
}
}
Loading

0 comments on commit bbea955

Please sign in to comment.