@@ -13,6 +13,7 @@ plugins {
13
13
alias(libs.plugins.dependency.license.report)
14
14
alias(libs.plugins.ksp)
15
15
alias(libs.plugins.gradle.wrapper)
16
+ alias(libs.plugins.changelog)
16
17
}
17
18
18
19
buildscript {
@@ -50,6 +51,16 @@ dependencies {
50
51
testImplementation(kotlin(" test" ))
51
52
}
52
53
54
+ val pluginId = properties(" group" )
55
+ val pluginName = properties(" name" )
56
+ val pluginVersion = properties(" version" )
57
+
58
+ changelog {
59
+ version.set(pluginVersion)
60
+ groups.set(emptyList())
61
+ title.set(" Coder Toolbox Plugin Changelog" )
62
+ }
63
+
53
64
licenseReport {
54
65
renderers = arrayOf(JsonReportRenderer (" dependencies.json" ))
55
66
filters = arrayOf(ExcludeTransitiveDependenciesFilter ())
@@ -65,17 +76,19 @@ tasks.test {
65
76
useJUnitPlatform()
66
77
}
67
78
68
- val pluginId = " com.coder.toolbox"
69
- val pluginVersion = " 0.0.1"
70
-
71
79
val assemblePlugin by tasks.registering(Jar ::class ) {
72
80
archiveBaseName.set(pluginId)
73
81
from(sourceSets.main.get().output)
74
82
}
75
83
76
84
val copyPlugin by tasks.creating(Sync ::class .java) {
77
85
dependsOn(assemblePlugin)
86
+ fromCompileDependencies()
87
+
88
+ into(getPluginInstallDir())
89
+ }
78
90
91
+ fun CopySpec.fromCompileDependencies () {
79
92
from(assemblePlugin.get().outputs.files)
80
93
from(" src/main/resources" ) {
81
94
include(" extension.json" )
@@ -97,8 +110,14 @@ val copyPlugin by tasks.creating(Sync::class.java) {
97
110
}
98
111
},
99
112
)
113
+ }
100
114
101
- into(getPluginInstallDir())
115
+ val pluginZip by tasks.creating(Zip ::class ) {
116
+ dependsOn(assemblePlugin)
117
+
118
+ fromCompileDependencies()
119
+ into(pluginId)
120
+ archiveBaseName.set(pluginName)
102
121
}
103
122
104
123
tasks.register(" cleanAll" , Delete ::class .java) {
@@ -126,26 +145,14 @@ private fun getPluginInstallDir(): Path {
126
145
return pluginsDir / pluginId
127
146
}
128
147
129
- val pluginZip by tasks.creating(Zip ::class ) {
130
- dependsOn(assemblePlugin)
131
-
132
- from(assemblePlugin.get().outputs.files)
133
- from(" src/main/resources" ) {
134
- include(" extension.json" )
135
- include(" dependencies.json" )
136
- }
137
- from(" src/main/resources" ) {
138
- include(" icon.svg" )
139
- rename(" icon.svg" , " pluginIcon.svg" )
140
- }
141
- archiveBaseName.set(" $pluginId -$pluginVersion " )
142
- }
143
-
144
- val uploadPlugin by tasks.creating {
148
+ val publishPlugin by tasks.creating {
145
149
dependsOn(pluginZip)
146
150
147
151
doLast {
148
- val instance = PluginRepositoryFactory .create(" https://plugins.jetbrains.com" , project.property(" pluginMarketplaceToken" ).toString())
152
+ val instance = PluginRepositoryFactory .create(
153
+ " https://plugins.jetbrains.com" ,
154
+ project.property(" PUBLISH_TOKEN" ).toString()
155
+ )
149
156
150
157
// first upload
151
158
// instance.uploader.uploadNewPlugin(pluginZip.outputs.files.singleFile, listOf("toolbox", "gateway"), LicenseUrl.APACHE_2_0, ProductFamily.TOOLBOX)
@@ -163,3 +170,5 @@ tasks.register("classpath") {
163
170
)
164
171
}
165
172
}
173
+
174
+ fun properties (key : String ) = project.findProperty(key).toString()
0 commit comments