use of com.intellij.openapi.util.Version in project intellij-community by JetBrains.
the class CmdCheckoutClient method getSupportedFormats.
@Override
public List<WorkingCopyFormat> getSupportedFormats() throws VcsException {
ArrayList<WorkingCopyFormat> result = new ArrayList<>();
Version version = myFactory.createVersionClient().getVersion();
result.add(WorkingCopyFormat.from(version));
return result;
}
use of com.intellij.openapi.util.Version in project intellij-community by JetBrains.
the class JdkBundleListTest method testAddBundle.
@Test
public void testAddBundle() throws Exception {
JdkBundle jb0 = new JdkBundle(new File("/jb0"), "java", Pair.create(new Version(1, 8, 0), new Integer(0)), true, false);
JdkBundle jb1 = new JdkBundle(new File("/jb1"), "java", Pair.create(new Version(1, 8, 0), new Integer(1)), false, false);
JdkBundle jb2 = new JdkBundle(new File("/jb2"), "java", Pair.create(new Version(1, 8, 0), new Integer(2)), false, false);
JdkBundle jb3 = new JdkBundle(new File("/jb3"), "java", Pair.create(new Version(1, 8, 0), new Integer(3)), false, false);
JdkBundle jb4 = new JdkBundle(new File("/jb4"), "java", Pair.create(new Version(1, 8, 0), new Integer(4)), false, false);
JdkBundle ob0 = new JdkBundle(new File("/ob0"), "openjdk", Pair.create(new Version(1, 8, 0), new Integer(0)), false, true);
JdkBundle ob1 = new JdkBundle(new File("/ob1"), "openjdk", Pair.create(new Version(1, 8, 0), new Integer(1)), false, false);
JdkBundle ob2 = new JdkBundle(new File("/ob2"), "openjdk", Pair.create(new Version(1, 8, 0), new Integer(2)), false, false);
JdkBundle ob3 = new JdkBundle(new File("/ob3"), "openjdk", Pair.create(new Version(1, 8, 0), new Integer(3)), false, false);
JdkBundle ob4 = new JdkBundle(new File("/ob4"), "openjdk", Pair.create(new Version(1, 8, 0), new Integer(4)), false, false);
JdkBundleList bundleList = new JdkBundleList();
bundleList.addBundle(jb3, false);
bundleList.addBundle(ob1, false);
bundleList.addBundle(jb2, false);
bundleList.addBundle(ob2, false);
bundleList.addBundle(jb0, true);
bundleList.addBundle(ob0, true);
bundleList.addBundle(jb1, false);
bundleList.addBundle(ob4, false);
bundleList.addBundle(jb4, false);
bundleList.addBundle(ob3, false);
assertSameElements(bundleList.toArrayList(), Arrays.asList(jb4, ob4, jb0, ob0));
}
use of com.intellij.openapi.util.Version in project intellij-community by JetBrains.
the class JdkBundleTest method doTestCreateBundle.
public void doTestCreateBundle(File homeJDK) throws Exception {
// Skip pure jre
if (!new File(homeJDK, "lib/tools.jar").exists())
return;
File bootJDK = SystemInfo.isMac ? homeJDK.getParentFile().getParentFile() : homeJDK;
String verStr = System.getProperty("java.version");
boolean macNonStandardJDK = SystemInfo.isMac && !new File(bootJDK, "Contents/Home").exists();
JdkBundle bundle = macNonStandardJDK ? // the test is run under jdk with non-standard layout
JdkBundle.createBundle(homeJDK, "", true, false, true) : JdkBundle.createBundle(bootJDK, true, false);
assertNotNull(bundle);
assertTrue(bundle.isBoot());
assertFalse(bundle.isBundled());
assertTrue(FileUtil.filesEqual(bundle.getLocation(), macNonStandardJDK ? homeJDK : bootJDK));
Pair<Version, Integer> verUpdate = bundle.getVersionUpdate();
assertNotNull(verUpdate);
final String evalVerStr = verUpdate.first.toString() + "_" + verUpdate.second.toString();
assertTrue(evalVerStr + " is not the same with " + verStr, verStr.contains(evalVerStr));
}
use of com.intellij.openapi.util.Version in project intellij-community by JetBrains.
the class SystemHealthMonitor method checkJvm.
private void checkJvm() {
if (StringUtil.endsWithIgnoreCase(System.getProperty("java.version", ""), "-ea")) {
showNotification(new KeyHyperlinkAdapter("unsupported.jvm.ea.message"));
}
JdkBundle bundle = JdkBundle.createBoot();
if (bundle != null && !bundle.isBundled()) {
Version version = bundle.getVersion();
Integer updateNumber = bundle.getUpdateNumber();
if (version != null && updateNumber != null && updateNumber < 112) {
final String bundleVersion = version.toCompactString() + "u" + updateNumber;
boolean showSwitchOption = false;
final File bundledJDKAbsoluteLocation = JdkBundle.getBundledJDKAbsoluteLocation();
if (bundledJDKAbsoluteLocation.exists() && bundle.getBitness() == Bitness.x64) {
if (SystemInfo.isMacIntel64) {
showSwitchOption = true;
} else if (SystemInfo.isWindows || SystemInfo.isLinux) {
JdkBundle bundledJdk = JdkBundle.createBundle(bundledJDKAbsoluteLocation, false, false);
if (bundledJdk != null && bundledJdk.getVersion() != null) {
// Version of bundled jdk is available, so the jdk is compatible with underlying OS
showSwitchOption = true;
}
}
}
if (showSwitchOption) {
showNotification(new KeyHyperlinkAdapter("outdated.jvm.version.message1") {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
String url = e.getDescription();
if ("ack".equals(url)) {
myProperties.setValue(getIgnoreKey(), "true");
} else if ("switch".equals(url)) {
ActionManager.getInstance().getAction(SWITCH_JDK_ACTION).actionPerformed(null);
} else {
BrowserUtil.browse(url);
}
}
}, bundleVersion, LATEST_JDK_RELEASE);
} else {
showNotification(new KeyHyperlinkAdapter("outdated.jvm.version.message2"), bundleVersion, LATEST_JDK_RELEASE);
}
}
}
}
use of com.intellij.openapi.util.Version in project intellij-community by JetBrains.
the class OsVersionUsageCollector method getUsages.
@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
UsageDescriptor descriptor;
if (SystemInfo.isLinux) {
String releaseId = null, releaseVersion = null;
try {
Map<String, String> values = Files.lines(Paths.get("/etc/os-release")).map(line -> StringUtil.split(line, "=")).filter(parts -> parts.size() == 2).collect(Collectors.toMap(parts -> parts.get(0), parts -> StringUtil.unquoteString(parts.get(1))));
releaseId = values.get("ID");
releaseVersion = values.get("VERSION_ID");
} catch (IOException ignored) {
}
if (releaseId == null)
releaseId = "unknown";
if (releaseVersion == null) {
releaseVersion = SystemInfo.OS_VERSION;
Version version = Version.parseVersion(releaseVersion);
if (version != null) {
releaseVersion = version.toCompactString();
}
}
descriptor = new UsageDescriptor("Linux/" + releaseId + " " + releaseVersion, 1);
} else {
descriptor = new UsageDescriptor(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, 1);
}
return Collections.singleton(descriptor);
}
Aggregations