Skip to content

Commit

Permalink
4.3.7.2 release (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
burtbeckwith authored Apr 23, 2024
1 parent dacc32e commit 49ed70b
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ private static Map<GcnCloud, GcnFeatures> splitFeatures(Set<Feature> allFeatures
public void setCloud(GcnCloud cloud) {
this.cloud = cloud;
if (cloud != NONE) {
applicationConfigurations.putIfAbsent(cloud, new ApplicationConfiguration());
cloudApplicationConfigurations.putIfAbsent(cloud, new ApplicationConfiguration());
bootstrapConfigurations.putIfAbsent(cloud, new BootstrapConfiguration());
cloudBootstrapConfigurations.putIfAbsent(cloud, new BootstrapConfiguration());
applicationConfigurations.putIfAbsent(cloud, new ApplicationConfiguration(cloud.getModuleName()));
cloudApplicationConfigurations.putIfAbsent(cloud, new ApplicationConfiguration(cloud.getModuleName()));
bootstrapConfigurations.putIfAbsent(cloud, new BootstrapConfiguration(cloud.getModuleName()));
cloudBootstrapConfigurations.putIfAbsent(cloud, new BootstrapConfiguration(cloud.getModuleName()));
cloudDependencyContexts.putIfAbsent(cloud, new DependencyContextImpl(coordinateResolver));
cloudProjects.putIfAbsent(cloud, createProject(cloud));
}
Expand Down Expand Up @@ -1057,21 +1057,12 @@ public Set<String> getBuildPluginsGAV() {
gavs.add(JTE_GROUP_ID + ":" + JTE_NATIVE_RESOURCES + ":" + plugin.getVersion());
}

gav = updateVersion(gav);
gavs.add(gav);
}

return gavs;
}

// TODO remove this once we upgrade to a version of Micronaut that uses these plugin versions or higher
private String updateVersion(String gav) {
if (gav.startsWith("io.micronaut.gradle:") && gav.endsWith(":3.7.2")) {
gav = gav.replace("3.7.2", "3.7.7");
}
return gav;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder("GcnGeneratorContext:\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,26 @@ public void apply(GeneratorContext generatorContext) {

private void addMavenBuild(GcnGeneratorContext generatorContext) {

GcnCloud reset = generatorContext.getCloud();
GcnCloud currentCloud = generatorContext.getCloud();

generatorContext.getClouds().forEach(x -> cloudPom(generatorContext, x));
for (GcnCloud cloud : generatorContext.getClouds()) {
cloudPom(generatorContext, cloud);
}

generatorContext.setCloud(currentCloud);

generatorContext.setCloud(reset);
String templateName = generatorContext.getModuleNames().size() > 1 ? "multi-module-pom" : "mavenPom";

// this is called for each cloud, but the templates are stored in a Map, so it's idempotent
generatorContext.addTemplate("multi-module-pom", new RockerTemplate(ROOT, generatorContext.getBuildTool().getBuildFileName(),
generatorContext.addTemplate(templateName, new RockerTemplate(ROOT, generatorContext.getBuildTool().getBuildFileName(),
multimodule.template(MavenRepository.listOf(repositoryResolver.resolveRepositories(generatorContext)),
generatorContext.getLibProject(),
generatorContext.getModuleNames())
));

generatorContext.addPostProcessor("multi-module-pom", new MavenPlatformPostProcessor());
generatorContext.addPostProcessor(templateName, new MavenPlatformPostProcessor());

if (generatorContext.getClouds().size() > 1) {

// this is called for each cloud, but the post processors are stored in a Set, so it's idempotent
generatorContext.addPostProcessor("mavenPom", new MavenPomPostProcessor(
generatorContext.getLibProject().getName(),
Expand All @@ -142,7 +145,6 @@ private void cloudPom(GcnGeneratorContext generatorContext, GcnCloud gcnCloud) {
MavenBuild mavenBuild = mavenBuildCreator.create(generatorContext, repositoryResolver.resolveRepositories(generatorContext));

String templateKey = "mavenPom-" + gcnCloud.getModuleName();

if (templateKey.equals("mavenPom-")) {
templateKey = "mavenPom";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ public final void apply(GcnGeneratorContext generatorContext) {
}
});

generatorContext.getConfiguration().addNested(Map.of(
"micronaut.metrics.enabled", "true",
"micronaut.metrics.binders.files.enabled", "true",
"micronaut.metrics.binders.jvm.enabled", "true",
"micronaut.metrics.binders.logback.enabled", "true",
"micronaut.metrics.binders.processor.enabled", "true",
"micronaut.metrics.binders.uptime.enabled", "true",
"micronaut.metrics.binders.web.enabled", "true"
));

if (generatorContext.generateExampleCode() && generatorContext.getApplicationType() == DEFAULT) {

generatorContext.getTestConfiguration().addNested(Map.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ protected void addConfig(GcnGeneratorContext generatorContext) {

generatorContext.getCloudConfiguration().addNested(Map.of(
"micronaut.object-storage.azure.default.bucket", "true",
"micronaut.object-storage.azure.default.container", "${OBJECT_STORAGE_CONTAINER}",
"micronaut.object-storage.azure.default.endpoint", "${OBJECT_STORAGE_ENDPOINT}"
"micronaut.object-storage.azure.default.container", "",
"micronaut.object-storage.azure.default.endpoint", ""
));
generatorContext.getTestConfiguration().addNested("micronaut.object-storage.azure.default.enabled", "false");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.micronaut.starter.feature.objectstorage.ObjectStorageGcp;
import jakarta.inject.Singleton;

import java.util.Map;

import static cloud.graal.gcn.model.GcnCloud.GCP;

/**
Expand Down Expand Up @@ -53,10 +55,11 @@ protected void addConfig(GcnGeneratorContext generatorContext) {
// gcp:
// default:
// bucket:
generatorContext.getCloudConfiguration().addNested("micronaut.object-storage.gcp.default.bucket", "");
generatorContext.getCloudConfiguration().addNested("micronaut.object-storage.gcp.default.enabled", "true");
generatorContext.getCloudConfiguration().addNested(Map.of(
"micronaut.object-storage.gcp.default.bucket", "",
"micronaut.object-storage.gcp.default.enabled", "true"
));
generatorContext.getTestConfiguration().addNested("micronaut.object-storage.gcp.default.enabled", "false");

}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,31 @@ public GcnPropertiesTemplate(String module, String path, Map<String, Object> con

@Override
public void write(OutputStream outputStream) throws IOException {
OutputStream outputStream1 = new OutputStream() {
private final StringBuilder string = new StringBuilder();

@Override
final StringBuilder buffer = new StringBuilder();

properties.store(new OutputStream() {
public void write(int b) {
this.string.append((char) b);
buffer.append((char) b);
}
}, null);

public String toString() {
return this.string.toString();
}
};

properties.store(outputStream1, null);
String string = outputStream1.toString();
string = string.substring(string.indexOf('\n') + 1);
List<String> lines = Stream.of(string.split("\n")).sorted().toList();
string = String.join("\n", lines);
outputStream.write(string.getBytes());
String renderedProperties = buffer.toString();

// remove date comment
String cleanedProperties;
if (renderedProperties.startsWith("#")) {
cleanedProperties = renderedProperties.substring(renderedProperties.indexOf(System.lineSeparator()) + 1);
} else {
cleanedProperties = renderedProperties;
}

// sort the properties
List<String> lines = Stream.of(cleanedProperties.split(System.lineSeparator())).sorted().toList();

cleanedProperties = String.join(System.lineSeparator(), lines);

outputStream.write(cleanedProperties.getBytes());
}

public Map<String, Object> getOriginalConfig() {
Expand Down
2 changes: 1 addition & 1 deletion gcn/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.parallel=true
org.gradle.caching=true
version=4.3.7.1
version=4.3.7.2

0 comments on commit 49ed70b

Please sign in to comment.