Skip to content

Commit

Permalink
4.6.0.1 release (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
burtbeckwith authored Sep 16, 2024
1 parent 623ddae commit 1d4235e
Show file tree
Hide file tree
Showing 24 changed files with 1,393 additions and 3,381 deletions.
4,240 changes: 1,045 additions & 3,195 deletions THIRD_PARTY_LICENSES.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ abstract class VersionCatalogUpdate extends DefaultTask {
if (reference != null) {
model.findVersion(reference).ifPresent { referencedVersion ->
RichVersion richVersion = referencedVersion.getVersion()
if (supportsUpdate(richVersion)) {
if (VersionCatalogUpdate.supportsUpdate(richVersion)) {
String require = richVersion.getRequire()
Status sourceStatus = Status.detectStatus(require)
if (!Objects.equals(require, latest) && targetStatus.isAsStableOrMoreStableThan(sourceStatus)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public GdkGeneratorContext(Project project,
if (!featureContext.getBuildTool().isGradle()) {
buildProperties.put("micronaut-maven-plugin.version", GdkDependencies.MICRONAUT_MAVEN_PLUGIN.getVersion());
buildProperties.put("micronaut.test.resources.version", GdkDependencies.MICRONAUT_TEST_RESOURCES_CORE.getVersion());
buildProperties.put("kotlin.version", GdkDependencies.KOTLIN_STDLIB.getVersion());
buildProperties.put("micronaut.core.version", GdkDependencies.MICRONAUT_CORE.getVersion());
}

INSTANCE.set(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import cloud.graal.gdk.GdkGeneratorContext;
import cloud.graal.gdk.feature.service.email.AbstractEmailFeature;
import cloud.graal.gdk.feature.service.security.AbstractSecurityFeature;
import cloud.graal.gdk.GdkUtils;
import cloud.graal.gdk.model.GdkCloud;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.starter.application.ApplicationType;
import io.micronaut.starter.application.Project;
Expand All @@ -28,6 +26,8 @@
import io.micronaut.starter.feature.MultiProjectFeature;
import io.micronaut.starter.template.StringTemplate;

import static cloud.graal.gdk.GdkUtils.LIB_MODULE;
import static cloud.graal.gdk.model.GdkCloud.NONE;
import static io.micronaut.starter.template.Template.ROOT;

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ protected String getModuleName() {
}

protected String getDefaultModule() {
return getCloud() == GdkCloud.NONE ? ROOT : GdkUtils.LIB_MODULE;
return getCloud() == NONE ? ROOT : LIB_MODULE;
}

/**
Expand All @@ -97,17 +97,24 @@ private void addLibPlaceholders(GdkGeneratorContext generatorContext) {

Project project = generatorContext.getProject();

addGitkeep(generatorContext, "gitkeep-resources", "src/main/resources");
addGitkeep(generatorContext, "gitkeep-src",
generatorContext.getLanguage().getSrcDir() + '/' + project.getPackagePath());
// add lib/src/main/resources/.gitkeep
addGitkeep(generatorContext, "gitkeep-resources-lib", "src/main/resources", getDefaultModule());

// add lib/src/main/java/com/example/.gitkeep
addGitkeep(generatorContext, "gitkeep-src-lib",
generatorContext.getLanguage().getSrcDir() + '/' + project.getPackagePath(), getDefaultModule());

// add cloud/src/test/resources/.gitkeep
addGitkeep(generatorContext, "gitkeep-resources-test-" + getModuleName(), "src/test/resources", getModuleName());

if (generatorContext.hasFeature(AbstractEmailFeature.class) || generatorContext.hasFeature(AbstractSecurityFeature.class)) {
addGitkeep(generatorContext, "gitkeep-jte", "src/main/jte");
addGitkeep(generatorContext, "gitkeep-jte", "src/main/jte", getDefaultModule());
}
}

private void addGitkeep(GdkGeneratorContext generatorContext, String name, String path) {
private void addGitkeep(GdkGeneratorContext generatorContext,
String name, String path, String module) {
generatorContext.addTemplate(name,
new StringTemplate(getDefaultModule(), path + "/.gitkeep", ""));
new StringTemplate(module, path + "/.gitkeep", ""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ public final class GdkTestedFeatures {
"micrometer-oracle-cloud",
// METRICS GCP
"micrometer-stackdriver",
// METRICS Azure
"micrometer-azure-monitor",
// OBJECTSTORAGE AWS
"object-storage-aws",
// OBJECTSTORAGE Azure
"object-storage-azure",
// OBJECTSTORAGE GCP
"object-storage-gcp",
// OBJECTSTORAGE OCI
Expand All @@ -83,6 +87,9 @@ public final class GdkTestedFeatures {
"gcp-secrets-manager",
// SECRETMANAGEMENT OCI
"oracle-cloud-vault",
// SECRETMANAGEMENT Azure
"azure-key-vault",
"discovery-client",
// STREAMING
"kafka",
// TRACING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.micronaut.starter.feature.k8s.Kubernetes;
import io.micronaut.starter.feature.other.Management;
import io.micronaut.starter.template.RockerTemplate;
import io.micronaut.starter.template.Template;
import jakarta.inject.Singleton;

import java.util.Map;
Expand All @@ -35,6 +34,7 @@
import static cloud.graal.gdk.model.GdkCloud.GCP;
import static cloud.graal.gdk.model.GdkCloud.NONE;
import static cloud.graal.gdk.model.GdkCloud.OCI;
import static io.micronaut.starter.template.Template.ROOT;

/**
* Replaces {@link Kubernetes} and adds different Kubernetes config file depending on the selected clouds.
Expand All @@ -45,13 +45,14 @@ public class GdkKubernetes extends Kubernetes {

private static final Map<GdkCloud, String> IMAGES = Map.of(
AWS, "<aws-account-id>.dkr.ecr.<aws-region>.amazonaws.com/%s:latest",
AZURE, "TODO",
AZURE, "<acr-repo-name>.azurecr.io/%s:latest",
GCP, "gcr.io/<gcp-project-id>/%s:latest",
OCI, "<region-key>.ocir.io/<tenancy-namespace>/gdk-k8s/%s:latest",
NONE, "%s"
);

public GdkKubernetes(Jib jib, Management management) {
public GdkKubernetes(Jib jib,
Management management) {
super(jib, management);
}

Expand All @@ -71,18 +72,17 @@ public void processSelectedFeatures(FeatureContext featureContext) {
protected void addYamlTemplate(GdkGeneratorContext generatorContext,
GdkCloud cloud) {

if (cloud.equals(NONE) && generatorContext.getClouds().size() > 1) {
if (cloud == NONE && generatorContext.getClouds().size() > 1) {
return;
}

String moduleName = cloud.equals(NONE) ? "" : "-" + cloud.getModuleName();
String moduleName = cloud == NONE ? "" : "-" + cloud.getModuleName();

generatorContext.addTemplate(cloud.name() + "k8sYaml",
new RockerTemplate(
Template.ROOT,
"k8s" + moduleName + ".yml",
new RockerTemplate(ROOT, "k8s" + moduleName + ".yml",
k8sYaml.template(
generatorContext.getProject(),
IMAGES.get(cloud).formatted(generatorContext.getProject().getName()), cloud)));
IMAGES.get(cloud).formatted(generatorContext.getProject().getName()),
cloud)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2024 Oracle and/or its affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cloud.graal.gdk.feature.replaced;

import io.micronaut.context.annotation.Replaces;
import io.micronaut.starter.feature.database.TestContainers;
import io.micronaut.starter.feature.database.jdbc.JdbcFeature;
import io.micronaut.starter.feature.function.Cloud;
import io.micronaut.starter.feature.function.CloudFeature;
import io.micronaut.starter.feature.oraclecloud.OracleCloudAutonomousDatabase;
import io.micronaut.starter.feature.oraclecloud.OracleCloudSdk;
import io.micronaut.starter.feature.testresources.TestResources;
import jakarta.inject.Singleton;

@Replaces(OracleCloudAutonomousDatabase.class)
@Singleton
public class GdkOracleCloudAutonomousDatabase extends OracleCloudAutonomousDatabase implements CloudFeature {

public GdkOracleCloudAutonomousDatabase(JdbcFeature jdbcFeature, TestContainers testContainers, TestResources testResources, OracleCloudSdk oracleCloudSdkFeature) {
super(jdbcFeature, testContainers, testResources, oracleCloudSdkFeature);
}

@Override
public Cloud getCloud() {
return Cloud.ORACLE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import cloud.graal.gdk.OracleCloudNettyClientDependencies;
import io.micronaut.context.annotation.Replaces;
import io.micronaut.starter.application.generator.GeneratorContext;
import io.micronaut.starter.feature.function.Cloud;
import io.micronaut.starter.feature.function.CloudFeature;
import io.micronaut.starter.feature.oraclecloud.OracleCloudSdk;
import jakarta.inject.Singleton;

Expand All @@ -28,11 +30,16 @@
*/
@Replaces(OracleCloudSdk.class)
@Singleton
public class GdkOracleCloudSdk extends OracleCloudSdk implements OracleCloudNettyClientDependencies {
public class GdkOracleCloudSdk extends OracleCloudSdk implements OracleCloudNettyClientDependencies, CloudFeature {

@Override
public void apply(GeneratorContext generatorContext) {
super.apply(generatorContext);
addNettyDependencies(generatorContext);
}

@Override
public Cloud getCloud() {
return Cloud.ORACLE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

import cloud.graal.gdk.GdkGeneratorContext;
import cloud.graal.gdk.feature.AbstractGdkFeature;
import cloud.graal.gdk.feature.service.template.AzureNativeImageProperties;
import cloud.graal.gdk.model.GdkCloud;
import cloud.graal.gdk.model.GdkService;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.starter.template.RockerTemplate;

import static io.micronaut.starter.feature.FeaturePhase.DEFAULT;

Expand Down Expand Up @@ -89,4 +91,18 @@ protected void applyForCloud(GdkGeneratorContext generatorContext,
generatorContext.setCloud(cloud);
}
}

/**
* Add --initialize-at-build-time for building Azure native executables.
*
* @param generatorContext generator context
*/
protected void addAzureNativeImageProperties(GdkGeneratorContext generatorContext) {
generatorContext.addTemplate("azure-native-image-properties",
new RockerTemplate(
getCloud().getModuleName(),
"src/main/resources/META-INF/native-image/native-image.properties",
AzureNativeImageProperties.template())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public final void apply(GdkGeneratorContext generatorContext) {
"flyway.datasources.default.enabled", true,
"datasources.default.dialect", driverFeature.getDataDialect()
));

jdbcFeature.applyDefaultConfig(generatorContext, driverFeature, jdbcConfig);

if (driverFeature instanceof OracleCloudAutonomousDatabase) {
generatorContext.getTestConfiguration().addNested(Map.of(
"datasources.default.url", "jdbc:tc:oracle:thin:@/xe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
*/
package cloud.graal.gdk.feature.service.logging;

import cloud.graal.gdk.GdkGeneratorContext;
import cloud.graal.gdk.feature.service.AbstractGdkServiceFeature;
import cloud.graal.gdk.feature.service.logging.template.LogControllerGroovy;
import cloud.graal.gdk.feature.service.logging.template.LogControllerJava;
import cloud.graal.gdk.feature.service.logging.template.LogControllerKotlin;
import cloud.graal.gdk.feature.service.logging.template.LogbackXml;
import cloud.graal.gdk.model.GdkService;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.starter.application.Project;
import io.micronaut.starter.template.RockerTemplate;

import static cloud.graal.gdk.model.GdkService.LOGGING;

Expand All @@ -33,4 +40,25 @@ public abstract class AbstractLoggingFeature extends AbstractGdkServiceFeature {
public final GdkService getService() {
return LOGGING;
}

protected void applyCommon(GdkGeneratorContext generatorContext,
String appenderName,
String appenderClass,
String jsonFormatter) {

generatorContext.addTemplate("loggingConfig-" + getModuleName(),
new RockerTemplate(getModuleName(), "src/main/resources/logback.xml",
LogbackXml.template(appenderName, appenderClass, jsonFormatter, getModuleName())));

if (generatorContext.generateExampleCode()) {

Project project = generatorContext.getProject();

generatorContext.addTemplate(getModuleName(), getModuleName() + "LogController",
generatorContext.getSourcePath("/{packagePath}/LogController"),
LogControllerJava.template(project),
LogControllerKotlin.template(project),
LogControllerGroovy.template(project));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@
package cloud.graal.gdk.feature.service.logging;

import cloud.graal.gdk.GdkGeneratorContext;
import cloud.graal.gdk.feature.service.logging.template.LogControllerGroovy;
import cloud.graal.gdk.feature.service.logging.template.LogControllerJava;
import cloud.graal.gdk.feature.service.logging.template.LogControllerKotlin;
import cloud.graal.gdk.feature.service.logging.template.LogbackXml;
import cloud.graal.gdk.model.GdkCloud;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.starter.application.Project;
import io.micronaut.starter.build.dependencies.Dependency;
import io.micronaut.starter.template.RockerTemplate;
import jakarta.inject.Singleton;

import static cloud.graal.gdk.model.GdkCloud.AWS;
Expand All @@ -37,34 +31,22 @@
@Singleton
public class AwsLogging extends AbstractLoggingFeature {

// TODO replace with io.micronaut.starter.feature.aws.AwsLogging feature when
// https://github.com/micronaut-projects/micronaut-starter/pull/2547 is published
private static final Dependency CLOUDWATCH_LOGGING = Dependency.builder()
.groupId("io.micronaut.aws")
.artifactId("micronaut-aws-cloudwatch-logging")
.compile()
.build();

private static final String APPENDER_NAME = "CLOUDWATCH";
private static final String APPENDER_CLASS = "io.micronaut.aws.cloudwatch.logging.CloudWatchLoggingAppender";
private static final String JSON_FORMATTER = "io.micronaut.aws.cloudwatch.logging.CloudWatchJsonFormatter";

@Override
public void apply(GdkGeneratorContext generatorContext) {

generatorContext.addDependency(CLOUDWATCH_LOGGING);

generatorContext.addTemplate("loggingConfig-aws",
new RockerTemplate(getModuleName(), "src/main/resources/logback.xml",
LogbackXml.template("CLOUDWATCH",
"io.micronaut.aws.cloudwatch.logging.CloudWatchLoggingAppender",
"io.micronaut.aws.cloudwatch.logging.CloudWatchJsonFormatter",
getModuleName())));

if (generatorContext.generateExampleCode()) {

Project project = generatorContext.getProject();

generatorContext.addTemplate(getModuleName(), "AwsLogController",
generatorContext.getSourcePath("/{packagePath}/LogController"),
LogControllerJava.template(project),
LogControllerKotlin.template(project),
LogControllerGroovy.template(project));
}
applyCommon(generatorContext, APPENDER_NAME, APPENDER_CLASS, JSON_FORMATTER);
}

@NonNull
Expand Down
Loading

0 comments on commit 1d4235e

Please sign in to comment.