forked from JetBrains/kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload_plugins.gradle.kts
42 lines (36 loc) · 1.41 KB
/
upload_plugins.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import org.jetbrains.intellij.pluginRepository.PluginRepositoryInstance
buildscript {
repositories {
mavenCentral()
maven("https://dl.bintray.com/jetbrains/intellij-plugin-service")
}
dependencies {
classpath("org.jetbrains.intellij:plugin-repository-rest-client:0.4.32")
}
}
task("uploadPlugins") {
doLast {
val kotlinPluginId = 6954
val channel = (project.findProperty("plugins.repository.channel") as String?)
?.let { if (it == "_default_") null else it }
val path = project.findProperty("plugins.path") as String? ?: "."
val token = project.property("plugins.repository.token") as String
val repo = PluginRepositoryInstance("https://plugins.jetbrains.com/", token)
val pluginFiles = File(path)
.listFiles { _, fileName ->
fileName.toLowerCase().let {
it.startsWith("kotlin-plugin") &&
it.endsWith(".zip") &&
// don't publish CIDR plugins to IDEA channel
!it.contains("clion") &&
!it.contains("appcode")
}
}
pluginFiles
?.sorted()
?.forEach { pluginFile ->
println("Uploading ${pluginFile.name}")
repo.uploadPlugin(kotlinPluginId, pluginFile, channel)
}
}
}