|
18 | 18 | import java.nio.file.Paths;
|
19 | 19 | import java.util.ArrayList;
|
20 | 20 | import java.util.Collection;
|
21 |
| -import java.util.Comparator; |
22 | 21 | import java.util.HashMap;
|
23 | 22 | import java.util.List;
|
24 | 23 | import java.util.Map;
|
|
31 | 30 | import software.amazon.smithy.build.FileManifest;
|
32 | 31 | import software.amazon.smithy.build.PluginContext;
|
33 | 32 | import software.amazon.smithy.codegen.core.CodegenException;
|
| 33 | +import software.amazon.smithy.codegen.core.SmithyIntegration; |
34 | 34 | import software.amazon.smithy.codegen.core.Symbol;
|
35 | 35 | import software.amazon.smithy.codegen.core.SymbolDependency;
|
36 | 36 | import software.amazon.smithy.codegen.core.SymbolProvider;
|
@@ -84,26 +84,27 @@ class CodegenVisitor extends ShapeVisitor.Default<Void> {
|
84 | 84 | private final FileManifest fileManifest;
|
85 | 85 | private final SymbolProvider symbolProvider;
|
86 | 86 | private final TypeScriptDelegator writers;
|
87 |
| - private final List<TypeScriptIntegration> integrations = new ArrayList<>(); |
| 87 | + private final List<TypeScriptIntegration> integrations; |
88 | 88 | private final List<RuntimeClientPlugin> runtimePlugins = new ArrayList<>();
|
89 | 89 | private final ProtocolGenerator protocolGenerator;
|
90 | 90 | private final ApplicationProtocol applicationProtocol;
|
91 | 91 |
|
92 | 92 | CodegenVisitor(PluginContext context, ArtifactType artifactType) {
|
93 | 93 | // Load all integrations.
|
| 94 | + List<TypeScriptIntegration> unsortedIntegrations = new ArrayList<>(); |
94 | 95 | ClassLoader loader = context.getPluginClassLoader().orElse(getClass().getClassLoader());
|
95 | 96 | LOGGER.info("Attempting to discover TypeScriptIntegration from the classpath...");
|
96 | 97 | ServiceLoader.load(TypeScriptIntegration.class, loader)
|
97 | 98 | .forEach(integration -> {
|
98 | 99 | LOGGER.info(() -> "Adding TypeScriptIntegration: " + integration.getClass().getName());
|
99 |
| - integrations.add(integration); |
| 100 | + unsortedIntegrations.add(integration); |
100 | 101 | integration.getClientPlugins().forEach(runtimePlugin -> {
|
101 | 102 | LOGGER.info(() -> "Adding TypeScript runtime plugin: " + runtimePlugin);
|
102 | 103 | runtimePlugins.add(runtimePlugin);
|
103 | 104 | });
|
104 | 105 | });
|
105 | 106 | // Sort the integrations in specified order.
|
106 |
| - integrations.sort(Comparator.comparingInt(TypeScriptIntegration::getOrder)); |
| 107 | + integrations = SmithyIntegration.sort(unsortedIntegrations); |
107 | 108 |
|
108 | 109 | // Preprocess model using integrations.
|
109 | 110 | settings = TypeScriptSettings.from(context.getModel(), context.getSettings(), artifactType);
|
|
0 commit comments