@@ -69,30 +69,30 @@ abstract class ExportFromModelServer @Inject constructor(of: ObjectFactory) : De
69
69
70
70
@TaskAction
71
71
fun export () {
72
- val client = ModelClientV2PlatformSpecificBuilder ()
72
+ val modelClient = ModelClientV2PlatformSpecificBuilder ()
73
73
.url(url.get())
74
74
.build()
75
+ modelClient.use { client ->
76
+ runBlocking { client.init () }
75
77
76
- runBlocking { client.init () }
77
-
78
- val branch = if (revision.isPresent) {
79
- getBranchByRevision(client)
80
- } else {
81
- getBranchByRepoIdAndBranch(client)
82
- }
78
+ val branch = if (revision.isPresent) {
79
+ getBranchByRevision(client)
80
+ } else {
81
+ getBranchByRepoIdAndBranch(client)
82
+ }
83
83
84
- branch.runRead {
85
- val root = branch.getRootNode()
86
- logger.info(" Got root node: {}" , root)
87
- val outputDir = outputDir.get().asFile
84
+ branch.runRead {
85
+ val root = branch.getRootNode()
86
+ logger.info(" Got root node: {}" , root)
87
+ val outputDir = outputDir.get().asFile
88
88
89
- getIncludedModules(root).forEach {
90
- val fileName = it.getPropertyValue(BuiltinLanguages .jetbrains_mps_lang_core.INamedConcept .name)
91
- val outputFile = outputDir.resolve(" $fileName .json" )
92
- ModelExporter (it).export(outputFile)
89
+ getIncludedModules(root).forEach {
90
+ val fileName = it.getPropertyValue(BuiltinLanguages .jetbrains_mps_lang_core.INamedConcept .name)
91
+ val outputFile = outputDir.resolve(" $fileName .json" )
92
+ ModelExporter (it).export(outputFile)
93
+ }
93
94
}
94
95
}
95
- client.close()
96
96
}
97
97
98
98
private fun getIncludedModules (root : INode ): Iterable <INode > {
0 commit comments