Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for toolbox 2.6.0.38881#20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fioan89 merged 15 commits intomainfromsupport-for-toolbox-2_6_0_38881
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
99e56cf
impl: support for Toolbox 2.6.0.38881 (1)
fioan89Mar 4, 2025
059f3fc
impl: support for Toolbox 2.6.0.38881 (2)
fioan89Mar 4, 2025
d0af2c9
impl: support for Toolbox 2.6.0.38881 (3)
fioan89Mar 4, 2025
7cfd6f5
impl: support for Toolbox 2.6.0.38881 (4)
fioan89Mar 5, 2025
4e5ef77
impl: support for Toolbox 2.6.0.38881 (5)
fioan89Mar 5, 2025
11be558
impl: support for Toolbox 2.6.0.38881 (6)
fioan89Mar 5, 2025
9a2c44a
impl: support for Toolbox 2.6.0.38881 (7)
fioan89Mar 5, 2025
09c99d1
build: fix build tasks
fioan89Mar 5, 2025
cce41b0
fix: workspaces were not properly loaded
fioan89Mar 6, 2025
d75d0c7
refactor: centralize all toolbox services in a context
fioan89Mar 6, 2025
142a587
impl: get rid of last remaining of internal logger
fioan89Mar 6, 2025
477d6ec
fix: non-code files needed at runtime should be under resources/ folder
fioan89Mar 6, 2025
42e4ca5
Merge branch 'main' into support-for-toolbox-2_6_0_38881
fioan89Mar 6, 2025
42ac589
fix: use template display name as env. description
fioan89Mar 6, 2025
d4f933a
fix: support email
fioan89Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 106 additions & 33 deletionsbuild.gradle.kts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
import com.github.jk1.license.render.JsonReportRenderer
import com.jetbrains.plugin.structure.toolbox.ToolboxMeta
import com.jetbrains.plugin.structure.toolbox.ToolboxPluginDescriptor
import org.jetbrains.intellij.pluginRepository.PluginRepositoryFactory
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.nio.file.Path
import kotlin.io.path.createDirectories
import kotlin.io.path.div
import kotlin.io.path.writeText

plugins {
alias(libs.plugins.kotlin)
Expand All@@ -14,23 +20,31 @@ plugins {
alias(libs.plugins.ksp)
alias(libs.plugins.gradle.wrapper)
alias(libs.plugins.changelog)
alias(libs.plugins.gettext)
}

buildscript {
dependencies {
classpath(libs.marketplace.client)
}
}

repositories {
mavenCentral()
maven("https://packages.jetbrains.team/maven/p/tbx/toolbox-api")
}

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath(libs.marketplace.client)
classpath(libs.plugin.structure)
}
}

jvmWrapper {
unixJvmInstallDir = "jvm"
winJvmInstallDir = "jvm"
linuxAarch64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-aarch64-b631.28.tar.gz"
linuxAarch64JvmUrl =
"https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-aarch64-b631.28.tar.gz"
linuxX64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-x64-b631.28.tar.gz"
macAarch64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-aarch64-b631.28.tar.gz"
macX64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-x64-b631.28.tar.gz"
Expand All@@ -39,24 +53,43 @@ jvmWrapper {

dependencies {
compileOnly(libs.bundles.toolbox.plugin.api)
implementation(libs.slf4j)
implementation(libs.bundles.serialization)
implementation(libs.coroutines.core)
compileOnly(libs.bundles.serialization)
compileOnly(libs.coroutines.core)
implementation(libs.okhttp)
implementation(libs.exec)
implementation(libs.moshi)
ksp(libs.moshi.codegen)
implementation(libs.retrofit)
implementation(libs.retrofit.moshi)
testImplementation(kotlin("test"))
testImplementation(libs.mokk)
testImplementation(libs.bundles.toolbox.plugin.api)
}

val pluginId = properties("group")
val pluginName = properties("name")
val pluginVersion = properties("version")
val extension = ExtensionJson(
id = properties("group"),

version = properties("version"),
meta = ExtensionJsonMeta(
name = "Coder Toolbox",
description = "Connects your JetBrains IDE to Coder workspaces",
vendor = "Coder",
url = "https://github.com/coder/coder-jetbrains-toolbox-plugin",
)
)

val extensionJsonFile = layout.buildDirectory.file("generated/extension.json")
val extensionJson by tasks.registering {
inputs.property("extension", extension.toString())

outputs.file(extensionJsonFile)
doLast {
generateExtensionJson(extension, extensionJsonFile.get().asFile.toPath())
}
}

changelog {
version.set(pluginVersion)
version.set(extension.version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we want to call plugin an extension from now on?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

WIP but indeed it is confusing me as well (especially when "extension" has a different meaning in the context of JetBrains plugins). It is the "nomenclature" used by JetBrains in the sample. I will refactor and simplify some of the things once I have the code working. Bear in mind that this is a wip for now :)

matifali reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we should probably involve the JetBrains team. At least share the confusion wit them.

groups.set(emptyList())
title.set("Coder Toolbox Plugin Changelog")
}
Expand All@@ -76,24 +109,30 @@ tasks.test {
useJUnitPlatform()
}

val assemblePlugin by tasks.registering(Jar::class) {
archiveBaseName.set(pluginId)
from(sourceSets.main.get().output)

tasks.jar {
archiveBaseName.set(extension.id)
dependsOn(extensionJson)
from(extensionJson.get().outputs)
}

val copyPlugin by tasks.creating(Sync::class.java) {
dependsOn(assemblePlugin)
fromCompileDependencies()
dependsOn(tasks.jar)
dependsOn(tasks.getByName("generateLicenseReport"))

fromCompileDependencies()
into(getPluginInstallDir())
}

fun CopySpec.fromCompileDependencies() {
from(assemblePlugin.get().outputs.files)
from(tasks.jar)
from(extensionJson.get().outputs.files)
from("src/main/resources") {
include("extension.json")
include("dependencies.json")
}
from("src/main/resources") {
include("icon.svg")
rename("icon.svg", "pluginIcon.svg")
}

// Copy dependencies, excluding those provided by Toolbox.
Expand All@@ -106,18 +145,20 @@ fun CopySpec.fromCompileDependencies() {
"core-api",
"ui-api",
"annotations",
"localization-api"
).any { file.name.contains(it) }
}
},
)
}

val pluginZip by tasks.creating(Zip::class) {
dependsOn(assemblePlugin)
archiveBaseName.set(properties("name"))
dependsOn(tasks.jar)
dependsOn(tasks.getByName("generateLicenseReport"))

fromCompileDependencies()
into(pluginId)
archiveBaseName.set(pluginName)
into(extension.id) // folder like com.coder.toolbox
}

tasks.register("cleanAll", Delete::class.java) {
Expand All@@ -142,7 +183,7 @@ private fun getPluginInstallDir(): Path {
else -> error("Unknown os")
} / "plugins"

return pluginsDir /pluginId
return pluginsDir /extension.id
}

val publishPlugin by tasks.creating {
Expand All@@ -158,17 +199,49 @@ val publishPlugin by tasks.creating {
// instance.uploader.uploadNewPlugin(pluginZip.outputs.files.singleFile, listOf("toolbox", "gateway"), LicenseUrl.APACHE_2_0, ProductFamily.TOOLBOX)

// subsequent updates
instance.uploader.upload(pluginId, pluginZip.outputs.files.singleFile)
instance.uploader.upload(extension.id, pluginZip.outputs.files.singleFile)
}
}

// For use with kotlin-language-server.
tasks.register("classpath") {
doFirst {
File("classpath").writeText(
sourceSets["main"].runtimeClasspath.asPath
fun properties(key: String) = project.findProperty(key).toString()

gettext {
potFile = project.layout.projectDirectory.file("src/main/resources/localization/defaultMessages.pot")
keywords = listOf("ptrc:1c,2", "ptrl")
}

// region will be moved to the gradle plugin late
data class ExtensionJsonMeta(
val name: String,
val description: String,
val vendor: String,
val url: String?,
)

data class ExtensionJson(
val id: String,
val version: String,
val meta: ExtensionJsonMeta,
)

fun generateExtensionJson(extensionJson: ExtensionJson, destinationFile: Path) {
val descriptor = ToolboxPluginDescriptor(
id = extensionJson.id,
version = extensionJson.version,
apiVersion = libs.versions.toolbox.plugin.api.get(),
meta = ToolboxMeta(
name = extensionJson.meta.name,
description = extensionJson.meta.description,
vendor = extensionJson.meta.vendor,
url = extensionJson.meta.url,
)
}
)
destinationFile.parent.createDirectories()
destinationFile.writeText(
jacksonMapperBuilder()
.enable(SerializationFeature.INDENT_OUTPUT)
.build()
.writeValueAsString(descriptor)
)
}

fun properties(key: String) = project.findProperty(key).toString()
// endregion
27 changes: 15 additions & 12 deletionsgradle/libs.versions.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
[versions]
toolbox-plugin-api = "0.7.2.6.0.38311"
toolbox-plugin-api = "1.0.38881"
kotlin = "2.1.0"
coroutines = "1.10.1"
serialization = "1.8.0"
okhttp = "4.10.0"
slf4j = "2.0.17"
dependency-license-report = "2.9"
marketplace-client = "2.0.45"
gradle-wrapper = "0.14.0"
Expand All@@ -13,6 +12,9 @@ moshi = "1.15.2"
ksp = "2.1.0-1.0.29"
retrofit = "2.11.0"
changelog = "2.2.1"
gettext = "0.7.0"
plugin-structure = "3.298"
mockk = "1.13.17"

[libraries]
toolbox-core-api = { module = "com.jetbrains.toolbox:core-api", version.ref = "toolbox-plugin-api" }
Expand All@@ -23,23 +25,24 @@ serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cor
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "serialization" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
exec = { module = "org.zeroturnaround:zt-exec", version.ref = "exec" }
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi"}
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi"}
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit"}
retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit"}

moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
plugin-structure = { module = "org.jetbrains.intellij.plugins:structure-toolbox", version.ref = "plugin-structure" }
mokk = { module = "io.mockk:mockk", version.ref = "mockk" }
marketplace-client = { module = "org.jetbrains.intellij:plugin-repository-rest-client", version.ref = "marketplace-client" }

[bundles]
serialization = ["serialization-core", "serialization-json", "serialization-json-okio"]
toolbox-plugin-api = ["toolbox-core-api", "toolbox-ui-api", "toolbox-remote-dev-api"]
serialization = ["serialization-core", "serialization-json", "serialization-json-okio"]
toolbox-plugin-api = ["toolbox-core-api", "toolbox-ui-api", "toolbox-remote-dev-api"]

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
dependency-license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "dependency-license-report" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
gradle-wrapper = { id = "me.filippov.gradle.jvm.wrapper", version.ref = "gradle-wrapper" }
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gettext = { id = "name.kropp.kotlinx-gettext", version.ref = "gettext" }
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp