Skip to content

Commit

Permalink
downgrade project Java language from 17 to 11
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Apr 17, 2023
1 parent 9de24b6 commit bc774dd
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(JavaLanguageVersion.of(11))
// vendor.set(JvmVendorSpec.GRAAL_VM)
}
}
Expand Down
12 changes: 4 additions & 8 deletions clusterless-main/src/main/java/clusterless/ConfigCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public Integer show(

@CommandLine.Command(
name = "init",
description = """
create a local or global configuration file.
set a provider name via --config to initialize a provider specific configuration.
"""
description = "create a local or global configuration file.\n" +
"set a provider name via --config to initialize a provider specific configuration.\n"
)
public Integer init(
@CommandLine.Option(
Expand All @@ -66,10 +64,8 @@ public Integer init(
) boolean global,
@CommandLine.Option(
names = "--merge",
description = """
merge all visible configuration files and cli options before writing
use this option to capture global and local configuration settings into a single configuration file
"""
description = "merge all visible configuration files and cli options before writing\n" +
"use this option to capture global and local configuration settings into a single configuration file\n"
) boolean merge,
@CommandLine.Option(
names = "--force",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
public class Lookup {
public static Architecture architecture(LambdaJavaRuntimeProps.Architecture architecture) {
switch (architecture) {
case ARM_64 -> {
case ARM_64: {
return Architecture.ARM_64;
}
case X86_64 -> {
case X86_64: {
return Architecture.X86_64;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public static Code find(Pattern pattern) {
}

if (files.isEmpty()) {
throw new IllegalStateException("no assets matching: %s found in: %s".formatted(pattern, assetDistributionPath.toAbsolutePath()));
throw new IllegalStateException(String.format("no assets matching: %s found in: %s", pattern, assetDistributionPath.toAbsolutePath()));
}

if (files.size() > 1) {
Set<Path> collect = files.stream().map(Path::getFileName).collect(Collectors.toSet());
throw new IllegalStateException("too many assets matching: %s found in: %s, found: %s".formatted(pattern, assetDistributionPath.toAbsolutePath(), collect));
throw new IllegalStateException(String.format("too many assets matching: %s found in: %s, found: %s", pattern, assetDistributionPath.toAbsolutePath(), collect));
}

Path path = files.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
package clusterless.substrate.aws.resource.eventbridge;

import clusterless.managed.component.ResourceComponent;
import clusterless.substrate.aws.managed.ManagedComponentContext;
import clusterless.substrate.aws.construct.ModelConstruct;
import clusterless.substrate.aws.managed.ManagedComponentContext;
import clusterless.util.Label;
import org.jetbrains.annotations.NotNull;
import software.amazon.awscdk.CfnOutput;
Expand All @@ -34,13 +34,13 @@ public EventBridgeModelConstruct(@NotNull ManagedComponentContext context, @NotN
.build();

new CfnOutput(this, id("EventBusARN"), new CfnOutputProps.Builder()
.exportName("eventbus:%s:arn".formatted(model().eventBusName().toLowerCase(Locale.ROOT)))
.exportName(String.format("eventbus:%s:arn", model().eventBusName().toLowerCase(Locale.ROOT)))
.value(eventBus().getEventBusArn())
.description("event bus arn")
.build());

new CfnOutput(this, id("EventBusName"), new CfnOutputProps.Builder()
.exportName("eventbus:%s:name".formatted(model().eventBusName().toLowerCase(Locale.ROOT)))
.exportName(String.format("eventbus:%s:name", model().eventBusName().toLowerCase(Locale.ROOT)))
.value(eventBus().getEventBusName())
.description("event bus name")
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public S3BucketResourceConstruct(@NotNull ManagedComponentContext context, @NotN
TagsUtil.applyTags(bucket, model().tags());

new CfnOutput(this, id("BucketARN"), new CfnOutputProps.Builder()
.exportName("s3:%s:arn".formatted(model().bucketName().toLowerCase(Locale.ROOT)))
.exportName(String.format("s3:%s:arn", model().bucketName().toLowerCase(Locale.ROOT)))
.value(bucket().getBucketArn())
.description("s3 bucket arn")
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ProcessExec {
private String cdk = "cdk";

@CommandLine.Option(names = "--cdk-app", description = "path to the cls-aws kernel")
private String cdkApp = URIs.normalize("%s/bin/cls-aws".formatted(System.getProperty(Startup.CLUSTERLESS_HOME)));
private String cdkApp = URIs.normalize(String.format("%s/bin/cls-aws", System.getProperty(Startup.CLUSTERLESS_HOME)));

@CommandLine.Option(
names = "--use-localstack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void constructManagedStacks(ManagedProject managedProject, Deployable de
ComponentService<ComponentContext, Model, Component> modelComponentService = managed.get(arc);

if (modelComponentService == null) {
String message = "component service not found in arc: %s, type: %s".formatted(arc.name(), arc.type());
String message = String.format("component service not found in arc: %s, type: %s", arc.name(), arc.type());
LOG.error(message);
throw new IllegalStateException(message);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ private static void construct(ComponentContext context, Map<Extensible, Componen
containers.entrySet().stream().filter(e -> e.getValue() != null).forEach(e -> {
Extensible extensible = e.getKey();
ComponentService<ComponentContext, Model, Component> modelComponentService = e.getValue();
LOG.info("creating %s construct: %s".formatted(extensible.label(), extensible.type()));
LOG.info("creating {} construct: {}", extensible.label(), extensible.type());
modelComponentService.create(context, extensible);
});
}
Expand Down Expand Up @@ -208,13 +208,16 @@ private Map<Extensible, ComponentService<ComponentContext, Model, Component>> ge

@NotNull
private static List<Extensible> getExtensiblesFor(ModelType modelType, Deployable deployableModel) {
List<Extensible> extensibles = Collections.emptyList();
switch (modelType) {
case Resource -> extensibles = new ArrayList<>(deployableModel.resources());
case Boundary -> extensibles = new ArrayList<>(deployableModel.boundaries());
case Arc -> extensibles = new ArrayList<>(deployableModel.arcs());
case Resource:
return new ArrayList<>(deployableModel.resources());
case Boundary:
return new ArrayList<>(deployableModel.boundaries());
case Arc:
return new ArrayList<>(deployableModel.arcs());
}
return extensibles;

return Collections.emptyList();
}

private static Set<String> verifyNonNull(String propertyName, Set<String> values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,69 +35,66 @@ public class KernelTest {
};

@Test
@StdIo("""
{
"project": {
"name" : "TestProject",
"version": "20230101-00"
},
"placement": {
"stage": "prod",
"provider": "aws",
"account": "abc123",
"region": "us-east-2"
},
"resources" : [
{
"type" : "aws:core:s3Bucket",
"bucketName" : "sample-bucket1"
},
{
"type" : "aws:core:s3Bucket",
"bucketName" : "sample-bucket2"
}
]
}
""")
@StdIo("{\n" +
"\"project\": {\n" +
" \"name\" : \"TestProject\",\n" +
" \"version\": \"20230101-00\"\n" +
"},\n" +
"\"placement\": {\n" +
" \"stage\": \"prod\",\n" +
" \"provider\": \"aws\",\n" +
" \"account\": \"abc123\",\n" +
" \"region\": \"us-east-2\"\n" +
"},\n" +
"\"resources\" : [\n" +
" {\n" +
" \"type\" : \"aws:core:s3Bucket\",\n" +
" \"bucketName\" : \"sample-bucket1\"\n" +
" },\n" +
" {\n" +
" \"type\" : \"aws:core:s3Bucket\",\n" +
" \"bucketName\" : \"sample-bucket2\"\n" +
" }\n" +
" ]\n" +
"}\n")
void createResourcesProject() {
Assertions.assertEquals(0, new Kernel().execute(args));
}

@Test
@StdIo("""
{
"project": {
"name": "TestProject",
"version": "20230101-00"
},
"placement": {
"stage": "prod",
"provider": "aws",
"account": "abc123",
"region": "us-east-2"
},
"arcs": [
{
"type": "aws:core:s3CopyArc",
"name": "copyWorkload",
"sources": {
"main": {
"name": "ingress",
"version": "20220101",
"pathURI": "s3://clusterless-test/ingress/"
}
},
"sinks": {
"main": {
"name": "copy",
"version": "20230101",
"pathURI": "s3://clusterless-test/copy/"
}
}
}
]
}
\s""")
@StdIo("{\n" +
" \"project\": {\n" +
" \"name\": \"TestProject\",\n" +
" \"version\": \"20230101-00\"\n" +
" },\n" +
" \"placement\": {\n" +
" \"stage\": \"prod\",\n" +
" \"provider\": \"aws\",\n" +
" \"account\": \"abc123\",\n" +
" \"region\": \"us-east-2\"\n" +
" },\n" +
" \"arcs\": [\n" +
" {\n" +
" \"type\": \"aws:core:s3CopyArc\",\n" +
" \"name\": \"copyWorkload\",\n" +
" \"sources\": {\n" +
" \"main\": {\n" +
" \"name\": \"ingress\",\n" +
" \"version\": \"20220101\",\n" +
" \"pathURI\": \"s3://clusterless-test/ingress/\"\n" +
" }\n" +
" },\n" +
" \"sinks\": {\n" +
" \"main\": {\n" +
" \"name\": \"copy\",\n" +
" \"version\": \"20230101\",\n" +
" \"pathURI\": \"s3://clusterless-test/copy/\"\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
"}\n" +
" ")
void copyArcProject() {
Assertions.assertEquals(0, new Kernel().execute(args));
}
Expand Down

0 comments on commit bc774dd

Please sign in to comment.