Skip to content

Commit

Permalink
Added Unstable information to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Apr 23, 2021
1 parent 7d6a773 commit 3bbd461
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void execute() {
writers.flushWriters();

LOGGER.fine("Generating build manifest file");
ManifestWriter.writeManifest(settings, fileManifest, dependencies);
ManifestWriter.writeManifest(settings, model, fileManifest, dependencies);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
import software.amazon.smithy.build.FileManifest;
import software.amazon.smithy.codegen.core.CodegenException;
import software.amazon.smithy.codegen.core.SymbolDependency;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.node.ArrayNode;
import software.amazon.smithy.model.node.BooleanNode;
import software.amazon.smithy.model.node.Node;
import software.amazon.smithy.model.node.ObjectNode;
import software.amazon.smithy.model.node.StringNode;
import software.amazon.smithy.model.traits.UnstableTrait;

/**
* Generates a manifest description of the generated code, minimum go version, and minimum dependencies required.
Expand All @@ -48,11 +51,13 @@ private ManifestWriter() {
* Write the manifest description of the generated code.
*
* @param settings the go settings
* @param model the smithy model
* @param fileManifest the file manifest
* @param dependencies the list of symbol dependencies
*/
public static void writeManifest(
GoSettings settings,
Model model,
FileManifest fileManifest,
List<SymbolDependency> dependencies
) {
Expand All @@ -67,15 +72,17 @@ public static void writeManifest(
}
fileManifest.addFile(manifestFile);

Node generatedJson = buildManifestFile(settings, fileManifest, dependencies);
Node generatedJson = buildManifestFile(settings, model, fileManifest, dependencies);
fileManifest.writeFile(manifestFile.toString(), Node.prettyPrintJson(generatedJson) + "\n");
}

private static Node buildManifestFile(
GoSettings settings,
Model model,
FileManifest fileManifest,
List<SymbolDependency> dependencies
) {

List<SymbolDependency> nonStdLib = new ArrayList<>();
Optional<SymbolDependency> minStandard = Optional.empty();

Expand Down Expand Up @@ -115,6 +122,8 @@ private static Node buildManifestFile(
manifestNodes.put(StringNode.from("go"), StringNode.from(symbolDependency.getVersion())));
manifestNodes.put(StringNode.from("dependencies"), ObjectNode.objectNode(dependencyNodes));
manifestNodes.put(StringNode.from("files"), ArrayNode.fromStrings(generatedFiles));
manifestNodes.put(StringNode.from("unstable"),
BooleanNode.from(settings.getService(model).getTrait(UnstableTrait.class).isPresent()));

return ObjectNode.objectNode(manifestNodes).withDeepSortedKeys();
}
Expand Down

0 comments on commit 3bbd461

Please sign in to comment.