File tree Expand file tree Collapse file tree
codegen/src/main/kotlin/tools/samt/codegen Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,12 +12,23 @@ import tools.samt.semantic.SemanticModel
1212object Codegen {
1313 private val generators: MutableList <Generator > = mutableListOf ()
1414
15+ /* *
16+ * Register the [generator] to be used when generating code.
17+ * The generator is called when a user configures it within their `samt.yaml` configuration, where the generator is referenced by its [Generator.name].
18+ * Only generators registered here will be considered when calling [generate].
19+ */
20+ @JvmStatic
1521 fun registerGenerator (generator : Generator ) {
1622 generators + = generator
1723 }
1824
1925 private val transports: MutableList <TransportConfigurationParser > = mutableListOf ()
2026
27+ /* *
28+ * Register the [parser] as a transport configuration, which will be used to parse the `transport` section of a SAMT provider.
29+ * Only transport configurations registered here will be considered when calling [generate].
30+ */
31+ @JvmStatic
2132 fun registerTransportParser (parser : TransportConfigurationParser ) {
2233 transports + = parser
2334 }
@@ -43,6 +54,12 @@ object Codegen {
4354 }
4455 }
4556
57+ /* *
58+ * Run the appropriate generator for the given [configuration], using the given [semanticModel].
59+ * To ensure binary compatibility, the types within the [semanticModel] will be mapped to their [tools.samt.api] equivalents.
60+ * @return a list of generated files
61+ */
62+ @JvmStatic
4663 fun generate (
4764 semanticModel : SemanticModel ,
4865 configuration : SamtGeneratorConfiguration ,
You can’t perform that action at this time.
0 commit comments