Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimal requirements to Java 17 #532

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
java: ['17']
graalvm: ['latest', 'dev']
steps:
# https://github.com/actions/virtual-environments/issues/709
Expand Down
2 changes: 1 addition & 1 deletion .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
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: '8'
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 @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
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: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '11'
java-version: '17'
components: 'native-image'
- name: Optional setup step
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
java: ['11']
java: ['17']
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,16 @@ public DockerBuildOptions exportPorts(Integer... ports) {

private String getProjectFnVersion() {
JavaVersion javaVersion = Jvm.current().getJavaVersion();
if (javaVersion != null && javaVersion.isJava11Compatible()) {
return "jre11-latest";
if (javaVersion != null && javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
return "jre17-latest";
}
return "latest";
}

static void setupResources(Dockerfile task) {
String workDir = DEFAULT_WORKING_DIR;
if (task instanceof DockerBuildOptions) {
workDir = ((DockerBuildOptions) task).getTargetWorkingDirectory().get();
if (task instanceof DockerBuildOptions dbo) {
workDir = dbo.getTargetWorkingDirectory().get();
}
task.workingDir(workDir);
task.copyFile("layers/libs", workDir + "/libs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public abstract class NativeImageDockerfile extends Dockerfile implements Docker

private static final List<Integer> SUPPORTED_JAVA_VERSIONS = Collections.unmodifiableList(
// keep those in descending order
Arrays.asList(17, 11)
Arrays.asList(17)
);
private static final String ARM_ARCH = "aarch64";
private static final String X86_64_ARCH = "amd64";
Expand Down Expand Up @@ -361,7 +361,7 @@ private static int toSupportedJavaVersion(int version) {
return javaVersion;
}
}
return SUPPORTED_JAVA_VERSIONS.stream().reduce((x, y) -> y).orElse(11);
return SUPPORTED_JAVA_VERSIONS.stream().reduce((x, y) -> y).orElse(17);
}

@TaskAction
Expand Down Expand Up @@ -408,7 +408,7 @@ private void setupInstructions(List<Instruction> additionalInstructions) {
.getFiles()
.stream()
.map(this::toCopyResourceDirectoryInstruction)
.collect(Collectors.toList())
.toList()
));
runCommand(getProviders().provider(() -> String.join(" ", buildActualCommandLine(executable, buildStrategy, imageResolver))));
switch (buildStrategy) {
Expand Down Expand Up @@ -530,7 +530,7 @@ private List<String> buildNativeImageCommandLineArgs(Provider<String> executable
}
return arg;
})
.collect(Collectors.toList());
.toList();
}
return args;
}
Expand All @@ -553,7 +553,7 @@ private void prepareNativeImageOptions(NativeImageOptions options) {
.getFiles()
.stream()
.map(f -> getTargetWorkingDirectory().get() + "/config-dirs/" + f.getName())
.collect(Collectors.toList())
.toList()
);
options.getConfigurationFileDirectories().setFrom(
remappedConfigDirectories
Expand Down Expand Up @@ -609,8 +609,8 @@ public DockerBuildOptions exportPorts(Integer... ports) {

private String getProjectFnVersion() {
JavaVersion javaVersion = Jvm.current().getJavaVersion();
if (javaVersion != null && javaVersion.isJava11Compatible()) {
return "jre11-latest";
if (javaVersion != null && javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
return "jre17-latest";
}
return "latest";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.gradle.api.provider.ListProperty;

import java.util.List;
import java.util.stream.Collectors;

/**
* Represents a Micronaut docker image, represented
Expand All @@ -36,7 +35,7 @@ public interface MicronautDockerImage extends Named {
default List<Layer> findLayers(RuntimeKind runtimeKind) {
return getLayers().map(layers -> layers.stream()
.filter(layer -> layer.getRuntimeKind().get().isCompatibleWith(runtimeKind))
.collect(Collectors.toList()))
.toList())
.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package io.micronaut.gradle
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Requires

@IgnoreIf({ os.windows })
@Requires({ jvm.isJava11Compatible() })
class DockerBuildTaskSpec extends AbstractGradleBuildSpec {

def "test build docker image"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package io.micronaut.gradle.aot

import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Issue
import spock.lang.Requires

@Requires({ jvm.isJava11Compatible() })
class BasicMicronautAOTSpec extends AbstractAOTPluginSpec {

def "generates optimizations for #runtime (#kind)"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import io.micronaut.gradle.AbstractGradleBuildSpec
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Requires

@Requires({ jvm.isJava11Compatible() })
class FunctionsMicronautAOTSpec extends AbstractAOTPluginSpec {
private static final List<String> PROVIDERS = ["aws"]
private static final List<String> RUNTIMES = ["jit", "native"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package io.micronaut.gradle.aot

import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf
import spock.lang.Requires

@IgnoreIf({ os.windows })
@Requires({ jvm.isJava11() })
class MicronautAOTDockerSpec extends AbstractAOTPluginSpec {

def "generates an optimized docker file"() {
Expand Down Expand Up @@ -74,7 +72,7 @@ ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
result.task(":optimizedDockerBuildNative").outcome == TaskOutcome.SUCCESS

def dockerFile = normalizeLineEndings(file("build/docker/native-optimized/DockerfileNative").text)
dockerFile == """FROM ghcr.io/graalvm/native-image:ol7-java11-22.2.0 AS graalvm
dockerFile == """FROM ghcr.io/graalvm/native-image:ol7-java17-22.2.0 AS graalvm
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY layers/classes /home/app/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.micronaut.gradle.aot

import spock.lang.Requires

@Requires({ jvm.isJava11Compatible() })
class ShadowMicronautAOTSpec extends AbstractAOTPluginSpec {

def "builds a fatjar optimized flavor"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import spock.lang.Requires

@Requires({ AbstractGradleBuildSpec.graalVmAvailable })
@IgnoreIf({ os.windows })
@Requires({ jvm.isJava11Compatible() })
class DockerNativeFunctionalTest extends AbstractEagerConfiguringFunctionalTest {

def "test build docker native image for runtime #runtime"() {
Expand All @@ -33,8 +32,8 @@ class DockerNativeFunctionalTest extends AbstractEagerConfiguringFunctionalTest
mainClassName="example.Application"

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfileNative {
Expand Down Expand Up @@ -122,8 +121,8 @@ micronaut:
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfileNative {
Expand Down Expand Up @@ -170,8 +169,8 @@ micronaut:
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}
"""

Expand Down Expand Up @@ -211,8 +210,8 @@ micronaut:
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}
"""

Expand Down Expand Up @@ -256,8 +255,8 @@ micronaut:
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

mainClassName="example.Application"
Expand Down Expand Up @@ -429,8 +428,8 @@ class Application {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfile {
Expand Down Expand Up @@ -510,8 +509,8 @@ class Application {
mainClassName="example.Application"

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfileNative {
Expand Down Expand Up @@ -565,7 +564,7 @@ micronaut:
expect:
task.outcome == TaskOutcome.SUCCESS
dockerFile == """
FROM ghcr.io/graalvm/native-image:ol7-java11-22.2.0 AS graalvm
FROM ghcr.io/graalvm/native-image:ol7-java17-22.2.0 AS graalvm
WORKDIR /home/alternate
COPY layers/libs /home/alternate/libs
COPY layers/classes /home/alternate/classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Requires

@Requires({ AbstractGradleBuildSpec.graalVmAvailable && !os.windows })
@Requires({ jvm.isJava11Compatible() })
class MicronautGraalPluginSpec extends AbstractEagerConfiguringFunctionalTest {

void 'generate GraalVM resource-config.json with OpenAPI and resources included'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Requires
import spock.util.environment.RestoreSystemProperties

@Requires({ AbstractGradleBuildSpec.graalVmAvailable })
@IgnoreIf({ os.windows })
@Requires({ jvm.isJava11Compatible() })
class LambdaNativeImageSpec extends AbstractFunctionalTest {

void 'mainclass is set correctly for an application deployed as GraalVM and Lambda'() {
Expand All @@ -35,8 +33,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}
"""

Expand Down Expand Up @@ -77,8 +75,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfileNative {
Expand Down Expand Up @@ -126,8 +124,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

graalvmNative {
Expand Down Expand Up @@ -185,8 +183,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}
"""

Expand Down Expand Up @@ -234,8 +232,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}

dockerfileNative {
Expand Down Expand Up @@ -286,8 +284,8 @@ class LambdaNativeImageSpec extends AbstractFunctionalTest {
}

java {
sourceCompatibility = JavaVersion.toVersion('11')
targetCompatibility = JavaVersion.toVersion('11')
sourceCompatibility = JavaVersion.toVersion('17')
targetCompatibility = JavaVersion.toVersion('17')
}
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Requires

@Requires({ AbstractGradleBuildSpec.graalVmAvailable && !os.windows })
@Requires({ jvm.isJava11Compatible() })
class TestResourcesWithAotAndGraalVMSpec extends AbstractTestResourcesSpec {

def "runs optimized binary"() {
Expand Down
Loading