mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Platform: build numbers: support multi-component build numbers
This commit is contained in:
@@ -226,7 +226,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
|
||||
myChangeNotes = pluginBean.changeNotes;
|
||||
myVersion = pluginBean.pluginVersion;
|
||||
if (myVersion == null) {
|
||||
myVersion = PluginManagerCore.getBuildNumber().getBaselineVersion() + ".SNAPSHOT";
|
||||
myVersion = PluginManagerCore.getBuildNumber().asStringWithoutProductCode();
|
||||
}
|
||||
|
||||
myCategory = pluginBean.category;
|
||||
|
||||
+7
-10
@@ -262,6 +262,12 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
|
||||
@Override
|
||||
public String getFullVersion() {
|
||||
String result = doGetFullVersion();
|
||||
if (isEAP()) result += " EAP";
|
||||
return result;
|
||||
}
|
||||
|
||||
private String doGetFullVersion() {
|
||||
if (myFullVersion == null) {
|
||||
if (!StringUtil.isEmptyOrSpaces(myMajorVersion)) {
|
||||
if (!StringUtil.isEmptyOrSpaces(myMinorVersion)) {
|
||||
@@ -503,16 +509,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
|
||||
@Override
|
||||
public String getFullApplicationName() {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(getVersionName());
|
||||
buffer.append(" ");
|
||||
if (getMajorVersion() != null && !isEAP() && !isBetaOrRC()) {
|
||||
buffer.append(getFullVersion());
|
||||
}
|
||||
else {
|
||||
buffer.append(getBuild().asStringWithAllDetails());
|
||||
}
|
||||
return buffer.toString();
|
||||
return getVersionName() + " " + getFullVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-3
@@ -424,12 +424,19 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, AccessibleCont
|
||||
appName.setForeground(JBColor.foreground());
|
||||
appName.setFont(font.deriveFont(JBUI.scale(36f)).deriveFont(Font.PLAIN));
|
||||
appName.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
String appVersion = "Version " + app.getFullVersion();
|
||||
String appVersion = "Version ";
|
||||
|
||||
if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) {
|
||||
appVersion += " (" + app.getBuild().asString() + ")";
|
||||
if (app.getBuild().getFormat() == BuildNumber.Format.YEAR_BASED) {
|
||||
appVersion += app.isEAP() ? (app.getBuild().asStringWithoutProductCode() + " EAP") : app.getFullVersion();
|
||||
}
|
||||
else {
|
||||
appVersion += app.getFullVersion();
|
||||
|
||||
if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) {
|
||||
appVersion += " (" + app.getBuild().asString() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
JLabel version = new JLabel(appVersion);
|
||||
version.setFont(getProductFont().deriveFont(JBUI.scale(16f)));
|
||||
version.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
@@ -217,18 +217,6 @@ public class BuildNumber implements Comparable<BuildNumber> {
|
||||
return myComponents.length - o.myComponents.length;
|
||||
}
|
||||
|
||||
public int compareToWithVariableLength(@NotNull BuildNumber o) {
|
||||
for (int i = 0; i < Math.min(myComponents.length, o.myComponents.length); i++) {
|
||||
int result = myComponents[i] - o.myComponents[i];
|
||||
if (result != 0) return result;
|
||||
|
||||
if (myComponents[i] == Integer.MAX_VALUE) return 0; // anything after first SNAPSHOT doesn't really matter
|
||||
}
|
||||
return myComponents.length - o.myComponents.length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@NotNull
|
||||
public String getProductCode() {
|
||||
return myProductCode;
|
||||
|
||||
+5
-5
@@ -19,8 +19,8 @@ import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
@@ -267,14 +267,14 @@ public class EclipseImportBuilder extends ProjectImportBuilder<String> implement
|
||||
}
|
||||
}
|
||||
if (!files.isEmpty()) {
|
||||
final int resultCode = Messages.showYesNoCancelDialog(ApplicationInfoEx.getInstanceEx().getFullApplicationName() +
|
||||
" module files found:\n" +
|
||||
StringUtil.join(files,new Function<File, String>() {
|
||||
final int resultCode = Messages.showYesNoCancelDialog(ApplicationNamesInfo.getInstance().getFullProductName() +
|
||||
" module files found:\n" +
|
||||
StringUtil.join(files,new Function<File, String>() {
|
||||
public String fun(File file) {
|
||||
return file.getPath();
|
||||
}
|
||||
}, "\n") +
|
||||
".\n Would you like to reuse them?", "Module Files Found",
|
||||
".\n Would you like to reuse them?", "Module Files Found",
|
||||
Messages.getQuestionIcon());
|
||||
if (resultCode != Messages.YES) {
|
||||
if (resultCode == Messages.NO) {
|
||||
|
||||
@@ -57,11 +57,7 @@ class IdeaCommitMessageFormatter : CommitMessageFormatter {
|
||||
append(appInfo.fullVersion)
|
||||
}
|
||||
else {
|
||||
var buildString = build.asStringWithoutProductCode()
|
||||
if (build.buildNumber == Integer.MAX_VALUE) {
|
||||
buildString = buildString.replace(".SNAPSHOT", "")
|
||||
}
|
||||
append(buildString)
|
||||
append(build.asStringWithoutProductCodeAndSnapshot())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user