Why pluginUntilBuild is mandatory

Answered

Does that mean that I should change pluginUntilBuild(currently it is 211) each time when a new version of IDEA released?

9 comments
Comment actions Permalink

There is no hard rule whether to specify untilBuild or leave it "open". It basically depends on your chosen strategy of targeting a range of platform versions, e.g. by using dedicated branches and limiting until-build for each platform accordingly.

Otherwise, using Plugin Verifier allows checking for problems (also locally) https://plugins.jetbrains.com/docs/intellij/api-changes-list.html#verifying-compatibility and can be run against any later released version(s).

The probability of problems or incompatibilities largely depends on the specific API a plugin is using, so there's no general advice on which strategy to use.

0
Comment actions Permalink

If I don't specify untilBuild I can't install it too Intellije IDEA, it says untilBuild is not specified. I created plugin using template in GitHub

0
Comment actions Permalink

Please show final plugin.xml and note your exact IDE version you try to install into

0
Comment actions Permalink

It is almost empty

<idea-plugin>
<id>com.***</id>
<name>plugin name</name>
<vendor>***</vendor>

<depends>com.intellij.modules.platform</depends>

<extensions defaultExtensionNs="com.intellij">
<psi.referenceContributor implementation="com.*.contributor.XmlPsiReferenceContributor" language="XML" id="my" order="first"/>
<gotoTargetRendererProvider implementation="com.*.contributor.XmlGotoTargetRendererProvider" order="first"/>
</extensions>
</idea-plugin>
0
Comment actions Permalink

It works, thank you, I've put the version into plugin.xml, and removed code with method patchPluginXml from file build.gradle.kts 

patchPluginXml {
version(properties("pluginVersion"))
sinceBuild(properties("pluginSinceBuild"))
untilBuild(properties("pluginUntilBuild"))

 

if I remove only untilBuild(properties("pluginUntilBuild")) line, without mentions sinceBuild in plugin.xml, then I install the plugin, IDEA says untilBuild not mentioned and denies installing the plugin. Is that possible to mention only sinceBuild version in gradle.properties file. What should I do in order to mention just pluginSinceBuild in properties?

pluginVersion = 0.0.2
pluginSinceBuild = 183

 

0
Comment actions Permalink

build.gradle.kts file 

import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.changelog.closure
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()
System.setProperty("user.dir", projectDir.toString())

plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.4.31"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "0.7.2"
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
id("org.jetbrains.changelog") version "1.1.2"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.15.0"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
}

group = properties("pluginGroup")
version = properties("pluginVersion")

// Configure project's dependencies
repositories {
mavenCentral()
jcenter()
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0")
}

// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
downloadSources = properties("platformDownloadSources").toBoolean()
// updateSinceUntilBuild = true

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
setPlugins(*properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray())
}

// Configure gradle-changelog-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
version = properties("pluginVersion")
groups = emptyList()
}

// Configure detekt plugin.
// Read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
config = files("./detekt-config.yml")
buildUponDefaultConfig = true

reports {
html.enabled = false
xml.enabled = false
txt.enabled = false
}
}

tasks {
// Set the compatibility versions to 1.8
withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

withType<Detekt> {
jvmTarget = "1.8"
}

patchPluginXml {
version(properties("pluginVersion"))
sinceBuild("202.*")
// untilBuild(properties("pluginUntilBuild"))

pluginDescription(
closure {
File("./README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
}
)

// Get the latest available change notes from the changelog file
changeNotes(
closure {
changelog.getLatest().toHTML()
}
)
}

// runPluginVerifier {
// ideVersions(properties("pluginVerifierIdeVersions"))
// }

publishPlugin {
dependsOn("patchChangelog")
token(System.getenv("PUBLISH_TOKEN"))
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())
}
}

 

plugin.xml 

<idea-plugin>
<id>com.***</id>
<name>plugin name</name>
<vendor>***</vendor>

<depends>com.intellij.modules.platform</depends>

<extensions defaultExtensionNs="com.intellij">
<psi.referenceContributor implementation="com.*.contributor.XmlPsiReferenceContributor" language="XML" id="my" order="first"/>
<gotoTargetRendererProvider implementation="com.*.contributor.XmlGotoTargetRendererProvider" order="first"/>
</extensions>
</idea-plugin>

 

If comment untilBuild(properties("pluginUntilBuild")) when intall the plugin IDEA shows 

The plugin is not compatible with the current version of the IDE, because it requires  build 202.* or older but the current build is IU-211.6693.111

 

What to do in order to mention version only in build.gradle.kts

 

0
Comment actions Permalink

Sorry, I'm a bit lost of what you have now and want to achieve. You are setting this value "202.*" in your Gradle build script explicitly, so obviously it cannot be installed into earlier versions like 211.6693.111.

I suggest to remove both since/until-build attributes from your plugin.xml _completely_ and set them as you wish from build.gradle patchPluginXml task. All the variants are fully described in docs mentioned above (https://plugins.jetbrains.com/docs/intellij/gradle-guide.html#patching-the-plugin-configuration-file).

0
Comment actions Permalink

The patching DSL generates both, the required `since-build` and the optional `until-build` attribute in plugin.xml regardless, even when the latter is not specified in the `patchPluginXml` in build.gradle. IMHO this is a source of confusion (confused me at least).

The solution is to not use patching DSL at all (`intellij.updateSinceUntilBuild = false`) and leave only `idea-version` tag in plugin.xml.

0

Please sign in to leave a comment.