OPENIDE #182 Add localization plugin to OpenIDE Marketplace

(cherry picked from commit c555ed1b5e)
This commit is contained in:
Nikita Iarychenko
2025-05-16 12:43:21 +04:00
parent 855fbe4bbb
commit 28cdf1e698
2 changed files with 13 additions and 10 deletions

View File

@@ -27,28 +27,29 @@ import java.nio.file.Path
object OpenIdePluginBundler {
private const val DOWNLOADABLE_PLUGINS_DIR = "build/download/plugins"
private const val PHYSICAL_PLUGINS_DIR = "build/bundled-plugins"
private const val AMPLICODE_URL = "https://amplicode.ru"
private const val AMPLICODE_MARKETPLACE_URL = "https://amplicode.ru/jetbrains-marketplace"
private const val PLUGINS_DOWNLOAD_URL = "https://plugins.openide.ru/pluginManager"
private val plugins = listOf(
PluginInfo("Lombook Plugin", "lombok"),
PluginInfo("com.haulmont.intellij.rupack", "ru_pack")
)
fun getBundlePluginPaths(context: BuildContext): List<Path> {
val communityHomeDir = context.paths.communityHomeDir
return listOf(
Path.of("${communityHomeDir}/$DOWNLOADABLE_PLUGINS_DIR/amplicode"),
Path.of("${communityHomeDir}/$DOWNLOADABLE_PLUGINS_DIR/lombok"),
Path.of("${communityHomeDir}/$PHYSICAL_PLUGINS_DIR/ru_pack")
)
return plugins.map { Path.of("${communityHomeDir}/$DOWNLOADABLE_PLUGINS_DIR/${it.folderName}") } +
listOf(Path.of("${communityHomeDir}/$DOWNLOADABLE_PLUGINS_DIR/amplicode"))
}
fun bundlePlugins(context: BuildContext) {
bundleLombokPluginFromMarketplace(context)
plugins.forEach { bundlePluginFromMarketplace(context, it) }
bundleAmplicodePlugin(context)
}
private fun bundleLombokPluginFromMarketplace(context: BuildContext) {
private fun bundlePluginFromMarketplace(context: BuildContext, pluginInfo: PluginInfo) {
val parameters = hashMapOf(
"id" to "Lombook Plugin",
"id" to pluginInfo.pluginId,
"build" to context.fullBuildNumber
)
@@ -58,7 +59,7 @@ object OpenIdePluginBundler {
.let(URI::create)
val archivePath = BuildDependenciesDownloader.downloadFileToCacheLocation(COMMUNITY_ROOT, uri)
val targetDir = context.paths.communityHomeDir.resolve("$DOWNLOADABLE_PLUGINS_DIR/lombok")
val targetDir = context.paths.communityHomeDir.resolve("$DOWNLOADABLE_PLUGINS_DIR/${pluginInfo.folderName}")
BuildDependenciesDownloader.extractFile(archivePath, targetDir, COMMUNITY_ROOT, BuildDependenciesExtractOptions.STRIP_ROOT)
}
@@ -94,4 +95,6 @@ object OpenIdePluginBundler {
val match = regex.find(this)
return match?.groupValues?.get(1)
}
private class PluginInfo(val pluginId: String, val folderName: String)
}