Skip to content

Commit

Permalink
Merge pull request #1024 from micronaut-projects/andriy/poja
Browse files Browse the repository at this point in the history
Add HTTP POJA runtime
  • Loading branch information
andriy-dmytruk authored Sep 16, 2024
2 parents dfb1b6c + 3fe3b8e commit 220eeb7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ public class FooControllerTest {
task.outcome == TaskOutcome.SUCCESS

where:
runtime << ["netty", "lambda_java", "lambda_provided", "jetty", "oracle_function", "tomcat", "google_function"]
runtime << ["netty", "lambda_java", "lambda_provided", "jetty", "oracle_function", "tomcat", "google_function", "http_poja"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class RuntimeDependenciesSpec extends AbstractEagerConfiguringFunctionalTest {
'lambda_provided' | 'compileClasspath' || ["io.micronaut.aws:micronaut-function-aws-api-proxy", "io.micronaut.aws:micronaut-function-aws-custom-runtime"]
'lambda_provided' | 'developmentOnly' || ["io.micronaut.aws:micronaut-function-aws-api-proxy-test"]
'lambda_provided' | 'testRuntimeClasspath' || ["io.micronaut.aws:micronaut-function-aws-api-proxy-test"]
'http_poja' | 'compileClasspath' || ['io.micronaut.servlet:micronaut-http-poja-apache']
'http_poja' | 'testRuntimeClasspath' || ['io.micronaut.servlet:micronaut-http-poja-apache', 'io.micronaut.servlet:micronaut-http-poja-test']

description = String.join(",", coordinates)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public enum MicronautRuntime {
/**
* Azure Cloud Function.
*/
AZURE_FUNCTION;
AZURE_FUNCTION,
/**
* Plain old Java application based on Apache libraries.
*/
HTTP_POJA;

private final DockerBuildStrategy buildStrategy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static io.micronaut.gradle.MicronautRuntime.JETTY;
import static io.micronaut.gradle.MicronautRuntime.NETTY;
import static io.micronaut.gradle.MicronautRuntime.NONE;
import static io.micronaut.gradle.MicronautRuntime.HTTP_POJA;
import static io.micronaut.gradle.MicronautRuntime.TOMCAT;
import static io.micronaut.gradle.MicronautRuntime.UNDERTOW;

Expand Down Expand Up @@ -61,6 +62,8 @@ public final class MicronautRuntimeDependencies {
private static final String ARTIFACT_ID_MICRONAUT_SERVLET_JETTY = "micronaut-http-server-jetty";
private static final String ARTIFACT_ID_MICRONAUT_SERVLET_TOMCAT = "micronaut-http-server-tomcat";
private static final String ARTIFACT_ID_MICRONAUT_SERVLET_UNDERTOW = "micronaut-http-server-undertow";
private static final String ARTIFACT_ID_MICRONAUT_SERVLET_POJA_APACHE = "micronaut-http-poja-apache";
private static final String ARTIFACT_ID_MICRONAUT_SERVLET_POJA_TEST = "micronaut-http-poja-test";

private static final ConfigurableVersionProperty AWS_VERSION_PROPERTY = ConfigurableVersionProperty.of("aws");
private static final ConfigurableVersionProperty AZURE_VERSION_PROPERTY = ConfigurableVersionProperty.of("azure");
Expand Down Expand Up @@ -133,6 +136,10 @@ public static Dependencies findApplicationPluginDependenciesByRuntime(MicronautR

} else if (runtime == UNDERTOW) {
return Dependencies.builder().implementation(micronautServletDependency(ARTIFACT_ID_MICRONAUT_SERVLET_UNDERTOW), SERVLET_VERSION_PROPERTY).build();
} else if (runtime == HTTP_POJA) {
return Dependencies.builder().implementation(micronautServletDependency(ARTIFACT_ID_MICRONAUT_SERVLET_POJA_APACHE), SERVLET_VERSION_PROPERTY)
.testImplementation(micronautServletDependency(ARTIFACT_ID_MICRONAUT_SERVLET_POJA_TEST), SERVLET_VERSION_PROPERTY)
.build();
} else if (runtime != NONE) {
throw new GradleException("Application plugin dependencies not specified for runtime " + runtime.name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ public class FooControllerTest {
task.outcome == TaskOutcome.SUCCESS

where:
runtime << ["netty", "lambda_provided", "lambda_java", "jetty", "oracle_function", "tomcat"]
runtime << ["netty", "lambda_provided", "lambda_java", "jetty", "oracle_function", "tomcat", "http_poja"]
}
}
1 change: 1 addition & 0 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ The available runtimes are:
* `oracle_function` - A Project.fn runtime for deploying Oracle Functions
* `google_function` - A runtime for deploying Google Functions.
* `azure_function` - A runtime for deploying Azure Functions
* `http_poja` - A plain old java application runtime based on Apache libraries

The advantage of allowing your dependencies to be dictated by the runtime is that you can potentially take the same application and deploy it to any of the above runtimes without changes.

Expand Down

0 comments on commit 220eeb7

Please sign in to comment.