Skip to content

Commit 2ff915d

Browse files
committed
introduce plugin uploader and marketplace integration
1 parent f53decc commit 2ff915d

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

build.gradle.kts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
22
import com.github.jk1.license.render.JsonReportRenderer
3+
import org.jetbrains.intellij.pluginRepository.PluginRepositoryFactory
34
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt
45
import java.nio.file.Path
56
import kotlin.io.path.div
@@ -11,6 +12,12 @@ plugins {
1112
alias(libs.plugins.dependency.license.report)
1213
}
1314

15+
buildscript {
16+
dependencies {
17+
classpath(libs.marketplace.client)
18+
}
19+
}
20+
1421
repositories {
1522
mavenCentral()
1623
maven("https://packages.jetbrains.team/maven/p/tbx/gateway")
@@ -37,7 +44,8 @@ tasks.compileKotlin {
3744
)
3845
}
3946

40-
val pluginId = "sample"
47+
val pluginId = "dev.kropp.toolbox.sample"
48+
val pluginVersion = "0.0.1"
4149

4250
val assemblePlugin by tasks.registering(Jar::class) {
4351
archiveBaseName.set(pluginId)
@@ -68,8 +76,38 @@ val copyPlugin by tasks.creating(Sync::class.java) {
6876

6977
from("src/main/resources") {
7078
include("extension.json")
79+
include("dependencies.json")
7180
include("icon.svg")
7281
}
7382

7483
into(targetDir)
84+
}
85+
86+
val pluginZip by tasks.creating(Zip::class) {
87+
dependsOn(assemblePlugin)
88+
89+
from(assemblePlugin.get().outputs.files)
90+
from("src/main/resources") {
91+
include("extension.json")
92+
include("dependencies.json")
93+
}
94+
from("src/main/resources") {
95+
include("icon.svg")
96+
rename("icon.svg", "pluginIcon.svg")
97+
}
98+
archiveBaseName.set("$pluginId-$pluginVersion")
99+
}
100+
101+
val uploadPlugin by tasks.creating {
102+
dependsOn(pluginZip)
103+
104+
doLast {
105+
val instance = PluginRepositoryFactory.create("https://plugins.jetbrains.com", project.property("pluginMarketplaceToken").toString())
106+
107+
// first upload
108+
// instance.uploader.uploadNewPlugin(pluginZip.outputs.files.singleFile, listOf("toolbox", "gateway"), LicenseUrl.APACHE_2_0, ProductFamily.TOOLBOX)
109+
110+
// subsequent updates
111+
instance.uploader.upload("dev.kropp.toolbox.sample", pluginZip.outputs.files.singleFile)
112+
}
75113
}

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ serialization = "1.5.0"
66
okhttp = "4.10.0"
77
slf4j = "2.0.3"
88
dependency-license-report = "2.5"
9+
marketplace-client = "2.0.38"
910

1011
[libraries]
1112
kotlin-stdlib = { module = "com.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
@@ -17,6 +18,8 @@ serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serializatio
1718
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
1819
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
1920

21+
marketplace-client = { module = "org.jetbrains.intellij:plugin-repository-rest-client", version.ref = "marketplace-client" }
22+
2023
[bundles]
2124
serialization = [ "serialization-core", "serialization-json", "serialization-json-okio" ]
2225

src/main/resources/extension.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "sample",
2+
"id": "dev.kropp.toolbox.sample",
33
"version": "0.0.1",
44
"meta": {
55
"readableName": "Sample plugin",
@@ -14,6 +14,7 @@
1414
},
1515
"apiVersion": "0.1.0",
1616
"compatibleVersionRange": {
17-
"from": "2.1.0"
17+
"from": "2.1.0",
18+
"to": "2.2.0"
1819
}
1920
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy