mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
supported new attributes for full build numbers in updates.xml (IDEA-155844)
This commit is contained in:
@@ -54,7 +54,7 @@ class UpdateChannel(node: Element) {
|
||||
}
|
||||
|
||||
class BuildInfo(node: Element) {
|
||||
val number: BuildNumber = BuildNumber.fromString(node.getAttributeValue("number") ?: throw JDOMException("build@number missing"))
|
||||
val number: BuildNumber = BuildNumber.fromString(node.getAttributeValue("fullNumber") ?: node.getAttributeValue("number") ?: throw JDOMException("build@number missing"))
|
||||
val apiVersion: BuildNumber = BuildNumber.fromString(node.getAttributeValue("apiVersion"), number.productCode) ?: number
|
||||
val version: String = node.getAttributeValue("version") ?: ""
|
||||
val message: String = node.getChild("message")?.value ?: ""
|
||||
@@ -85,7 +85,7 @@ class ButtonInfo(node: Element) {
|
||||
}
|
||||
|
||||
class PatchInfo(node: Element) {
|
||||
val fromBuild: BuildNumber = BuildNumber.fromString(node.getAttributeValue("from") ?: throw JDOMException("patch@from missing"))
|
||||
val fromBuild: BuildNumber = BuildNumber.fromString(node.getAttributeValue("fullFrom") ?: node.getAttributeValue("from") ?: throw JDOMException("patch@from missing"))
|
||||
val size: String? = node.getAttributeValue("size")
|
||||
val isAvailable: Boolean = node.getAttributeValue("exclusions")?.splitToSequence(",")?.none { it.trim() == osSuffix } ?: true
|
||||
|
||||
|
||||
@@ -106,5 +106,22 @@ class UpdateInfoParsingTest {
|
||||
assertEquals(2, info["IU"]!!.channels[0].builds.count { it.target != null })
|
||||
}
|
||||
|
||||
@Test fun fullBuildNumbers() {
|
||||
val info = load("""
|
||||
<products>
|
||||
<product name="IntelliJ IDEA">
|
||||
<code>IU</code>
|
||||
<channel id="IDEA_EAP" status="eap">
|
||||
<build number="162.100" fullNumber="162.100.1" version="2016.2">
|
||||
<patch from="162.99" fullFrom="162.99.2" size="1"/>
|
||||
</build>
|
||||
</channel>
|
||||
</product>
|
||||
</products>""".trimIndent())
|
||||
val buildInfo = info["IU"]!!.channels[0].builds[0]
|
||||
assertEquals("162.100.1", buildInfo.number.asString())
|
||||
assertEquals("162.99.2", buildInfo.patches[0].fromBuild.asString())
|
||||
}
|
||||
|
||||
private fun load(text: String) = UpdatesInfo(loadElement(text))
|
||||
}
|
||||
Reference in New Issue
Block a user