Show build number in internal mode (KT-28254)

^KT-28254 Fixed
This commit is contained in:
Nikolay Krasko
2018-08-03 15:38:07 +03:00
parent 0aec18c440
commit 226ade615c
3 changed files with 86 additions and 66 deletions
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.kotlin.idea.configuration.ui.ConfigurePluginUpdatesForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="5">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
@@ -8,41 +8,29 @@
<properties/>
<border type="none"/>
<children>
<component id="8d277" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="ca1a9"/>
<text value="Update &amp;channel:"/>
</properties>
</component>
<vspacer id="42b13">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="2505b" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="2505b" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4ec56" class="javax.swing.JLabel" binding="updateStatusLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<constraints/>
<properties>
<text value=" "/>
</properties>
</component>
</children>
</grid>
<grid id="b171" layout-manager="FlowLayout" hgap="-1" vgap="5" flow-align="0">
<grid id="b171" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -71,13 +59,36 @@
</grid>
</children>
</grid>
<grid id="209b0" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<grid id="6a5b2" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="290b2" class="javax.swing.JLabel" binding="verifierDisabledText">
<constraints/>
<properties>
<foreground color="-65536"/>
<text value="(status)"/>
</properties>
</component>
</children>
</grid>
<grid id="cf404" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="8d277" class="javax.swing.JLabel">
<constraints/>
<properties>
<labelFor value="ca1a9"/>
<text value="Update &amp;channel:"/>
</properties>
</component>
<component id="ca1a9" class="javax.swing.JComboBox" binding="channelCombo">
<constraints/>
<properties/>
@@ -94,62 +105,52 @@
</component>
</children>
</grid>
<grid id="6a5b2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="e3af8" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="290b2" class="javax.swing.JLabel" binding="verifierDisabledText">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="(status)"/>
</properties>
</component>
<hspacer id="edb4">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<grid id="cec56" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="335" height="24"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="f62d1" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<constraints/>
<properties>
<text value="Current Kotlin plugin version:"/>
</properties>
</component>
<grid id="9be5a" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e71d" class="javax.swing.JTextPane" binding="currentVersion">
<constraints/>
<properties>
<editable value="false"/>
<text value="{version}"/>
</properties>
</component>
</children>
<component id="e71d" class="javax.swing.JTextPane" binding="currentVersion">
<constraints/>
<properties>
<editable value="false"/>
<text value="{version}"/>
</properties>
</component>
</children>
</grid>
<grid id="4a454" binding="bundledCompilerVersionPanel" layout-manager="FlowLayout" hgap="5" vgap="0" flow-align="0">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="335" height="24"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a5e8c" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="Build number (internal mode):"/>
</properties>
</component>
<component id="d11da" class="javax.swing.JTextPane" binding="compilerVersion">
<constraints/>
<properties>
<editable value="false"/>
<text value="{version}"/>
</properties>
</component>
</children>
</grid>
</children>
@@ -5,9 +5,11 @@
package org.jetbrains.kotlin.idea.configuration.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.AsyncProcessIcon;
import org.jetbrains.kotlin.idea.KotlinPluginUtil;
import org.jetbrains.kotlin.idea.util.VersioningKt;
import javax.swing.*;
import java.util.List;
@@ -22,10 +24,19 @@ public class ConfigurePluginUpdatesForm {
public JLabel installStatusLabel;
private JLabel verifierDisabledText;
private JTextPane currentVersion;
private JPanel bundledCompilerVersionPanel;
private JTextPane compilerVersion;
public ConfigurePluginUpdatesForm() {
showVerifierDisabledStatus();
currentVersion.setText(KotlinPluginUtil.getPluginVersion());
if (ApplicationManager.getApplication().isInternal()) {
String buildNumber = VersioningKt.getBuildNumber();
compilerVersion.setText(buildNumber);
} else {
bundledCompilerVersionPanel.setVisible(false);
}
}
public void initChannels(List<String> channels) {
@@ -5,10 +5,18 @@
package org.jetbrains.kotlin.idea.util
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
fun isEap(version: String): Boolean {
return version.contains("rc") || version.contains("eap") || version.contains("-M")
}
fun isDev(version: String): Boolean {
return version.contains("dev")
}
val buildNumber: String by lazy {
val file = File(PathUtil.kotlinPathsForIdeaPlugin.homePath, "build.txt")
if (file.exists()) file.readText().trim() else "unknown"
}