1
- import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
1
+ import com.fasterxml.jackson.databind.SerializationFeature
2
+ import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder
2
3
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
3
4
import com.github.jk1.license.render.JsonReportRenderer
4
5
import com.jetbrains.plugin.structure.toolbox.ToolboxMeta
@@ -66,6 +67,7 @@ dependencies {
66
67
67
68
val extension = ExtensionJson (
68
69
id = properties(" group" ),
70
+
69
71
version = properties(" version" ),
70
72
meta = ExtensionJsonMeta (
71
73
name = " Coder Toolbox" ,
@@ -106,36 +108,30 @@ tasks.test {
106
108
useJUnitPlatform()
107
109
}
108
110
111
+
109
112
tasks.jar {
110
113
archiveBaseName.set(extension.id)
111
114
dependsOn(extensionJson)
112
- }
113
-
114
- val assemblePlugin by tasks.registering(Jar ::class ) {
115
- archiveBaseName.set(extension.id)
116
- from(sourceSets.main.get().output)
115
+ from(extensionJson.get().outputs)
117
116
}
118
117
119
118
val copyPlugin by tasks.creating(Sync ::class .java) {
120
- dependsOn(tasks.assemble)
121
- // fromCompileDependencies()
122
- from(tasks.jar)
123
-
124
- from(extensionJsonFile)
119
+ dependsOn(tasks.jar)
120
+ dependsOn(tasks.getByName(" generateLicenseReport" ))
125
121
126
- from(" src/main/resources" ) {
127
- include(" dependencies.json" )
128
- include(" icon.svg" )
129
- }
122
+ fromCompileDependencies()
130
123
into(getPluginInstallDir())
131
124
}
132
125
133
126
fun CopySpec.fromCompileDependencies () {
134
- from(assemblePlugin.get().outputs.files)
127
+ from(tasks.jar)
128
+ from(extensionJson.get().outputs.files)
135
129
from(" src/main/resources" ) {
136
- include(" extension.json" )
137
130
include(" dependencies.json" )
131
+ }
132
+ from(" src/main/resources" ) {
138
133
include(" icon.svg" )
134
+ rename(" icon.svg" , " pluginIcon.svg" )
139
135
}
140
136
141
137
// Copy dependencies, excluding those provided by Toolbox.
@@ -148,28 +144,20 @@ fun CopySpec.fromCompileDependencies() {
148
144
" core-api" ,
149
145
" ui-api" ,
150
146
" annotations" ,
147
+ " localization-api"
151
148
).any { file.name.contains(it) }
152
149
}
153
150
},
154
151
)
155
152
}
156
153
157
154
val pluginZip by tasks.creating(Zip ::class ) {
158
- dependsOn(tasks.assemble)
155
+ archiveBaseName.set(properties(" name" ))
156
+ dependsOn(tasks.jar)
159
157
dependsOn(tasks.getByName(" generateLicenseReport" ))
160
158
161
- // fromCompileDependencies()
162
- // into(pluginId)
163
- from(tasks.assemble.get().outputs.files)
164
- from(extensionJsonFile)
165
- from(" src/main/resources" ) {
166
- include(" dependencies.json" )
167
- }
168
- from(" src/main/resources" ) {
169
- include(" icon.svg" )
170
- rename(" icon.svg" , " pluginIcon.svg" )
171
- }
172
- archiveBaseName.set(extension.id)
159
+ fromCompileDependencies()
160
+ into(extension.id) // folder like com.coder.toolbox
173
161
}
174
162
175
163
tasks.register(" cleanAll" , Delete ::class .java) {
@@ -247,8 +235,12 @@ fun generateExtensionJson(extensionJson: ExtensionJson, destinationFile: Path) {
247
235
url = extensionJson.meta.url,
248
236
)
249
237
)
250
- val extensionJson = jacksonObjectMapper().writeValueAsString(descriptor)
251
238
destinationFile.parent.createDirectories()
252
- destinationFile.writeText(extensionJson)
239
+ destinationFile.writeText(
240
+ jacksonMapperBuilder()
241
+ .enable(SerializationFeature .INDENT_OUTPUT )
242
+ .build()
243
+ .writeValueAsString(descriptor)
244
+ )
253
245
}
254
246
// endregion
0 commit comments