use of com.intellij.openapi.util.BuildNumber in project intellij-community by JetBrains.
the class UpdatePluginsFromCustomRepositoryTest method testOnlyCompatiblePluginsAreChecked.
@Test
public void testOnlyCompatiblePluginsAreChecked() throws Exception {
Map<PluginId, PluginDownloader> toUpdate = new LinkedHashMap<>();
IdeaPluginDescriptor[] descriptors = new IdeaPluginDescriptor[] { loadDescriptor("plugin1.xml"), loadDescriptor("plugin2.xml") };
BuildNumber currentBuildNumber = BuildNumber.fromString("IU-142.100");
for (IdeaPluginDescriptor descriptor : descriptors) {
PluginDownloader downloader = PluginDownloader.createDownloader(descriptor, null, currentBuildNumber);
UpdateChecker.checkAndPrepareToInstall(downloader, new InstalledPluginsState(), toUpdate, new ArrayList<>(), null);
}
assertEquals("Found: " + toUpdate.size(), 1, toUpdate.size());
PluginDownloader downloader = toUpdate.values().iterator().next();
assertNotNull(downloader);
assertEquals("0.1", downloader.getPluginVersion());
}
use of com.intellij.openapi.util.BuildNumber in project intellij-community by JetBrains.
the class IdeAboutInfoUtil method writeAboutJson.
public static void writeAboutJson(JsonWriter writer) throws IOException {
String appName = ApplicationInfoEx.getInstanceEx().getFullApplicationName();
BuildNumber build = ApplicationInfo.getInstance().getBuild();
if (!PlatformUtils.isIdeaUltimate()) {
String productName = ApplicationNamesInfo.getInstance().getProductName();
appName = appName.replace(productName + " (" + productName + ")", productName);
appName = StringUtil.trimStart(appName, "JetBrains ");
}
writer.name("name").value(appName);
writer.name("productName").value(ApplicationNamesInfo.getInstance().getProductName());
writer.name("baselineVersion").value(build.getBaselineVersion());
if (!build.isSnapshot()) {
writer.name("buildNumber").value(build.asStringWithoutProductCode());
}
}
use of com.intellij.openapi.util.BuildNumber in project intellij by bazelbuild.
the class PluginCompatibilityEnforcer method checkPluginCompatibility.
public void checkPluginCompatibility() {
String pluginProductBuildString = readProductBuildTxt();
if (Strings.isNullOrEmpty(pluginProductBuildString)) {
return;
}
// Dev mode?
if (pluginProductBuildString.equals("PRODUCT_BUILD")) {
return;
}
BuildNumber pluginProductBuild = BuildNumber.fromString(pluginProductBuildString);
if (pluginProductBuild == null) {
LOG.warn("Invalid META-INF/product-build.txt");
return;
}
if (!isCompatible(pluginProductBuild)) {
String message = Joiner.on(' ').join("Invalid Android Studio version for the ASwB plugin.", "Android Studio version: " + ApplicationInfo.getInstance().getBuild(), "Compatible version: " + pluginProductBuild, "Please update the ASwB plugin from the plugin manager.");
NOTIFICATION_GROUP.createNotification(message, MessageType.ERROR).notify(null);
LOG.warn(message);
}
}
use of com.intellij.openapi.util.BuildNumber in project intellij-community by JetBrains.
the class ITNProxy method createParameters.
@NotNull
private static Multimap<String, String> createParameters(String login, String password, @NotNull ErrorBean error) {
Multimap<String, String> params = ArrayListMultimap.create(40, 1);
params.put("protocol.version", "1");
params.put("user.login", login);
params.put("user.password", password);
params.put("os.name", SystemProperties.getOsName());
params.put("java.version", SystemProperties.getJavaVersion());
params.put("java.vm.vendor", SystemProperties.getJavaVmVendor());
ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
Application application = ApplicationManager.getApplication();
params.put("app.name", namesInfo.getProductName());
params.put("app.name.full", namesInfo.getFullProductName());
params.put("app.name.version", appInfo.getVersionName());
params.put("app.eap", Boolean.toString(appInfo.isEAP()));
params.put("app.internal", Boolean.toString(application.isInternal()));
params.put("app.build", appInfo.getApiVersion());
params.put("app.version.major", appInfo.getMajorVersion());
params.put("app.version.minor", appInfo.getMinorVersion());
params.put("app.build.date", format(appInfo.getBuildDate()));
params.put("app.build.date.release", format(appInfo.getMajorReleaseBuildDate()));
params.put("app.compilation.timestamp", IdeaLogger.getOurCompilationTimestamp());
BuildNumber build = appInfo.getBuild();
String buildNumberWithAllDetails = build.asString();
params.put("app.product.code", build.getProductCode());
if (StringUtil.startsWith(buildNumberWithAllDetails, build.getProductCode() + "-")) {
buildNumberWithAllDetails = buildNumberWithAllDetails.substring(build.getProductCode().length() + 1);
}
params.put("app.build.number", buildNumberWithAllDetails);
UpdateSettings updateSettings = UpdateSettings.getInstance();
params.put("update.channel.status", updateSettings.getSelectedChannelStatus().getCode());
params.put("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ","));
params.put("plugin.name", error.getPluginName());
params.put("plugin.version", error.getPluginVersion());
params.put("last.action", error.getLastAction());
params.put("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException()));
params.put("error.message", error.getMessage());
params.put("error.stacktrace", error.getStackTrace());
params.put("error.description", error.getDescription());
params.put("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId()));
for (Attachment attachment : error.getAttachments()) {
params.put("attachment.name", attachment.getName());
params.put("attachment.value", attachment.getEncodedBytes());
}
return params;
}
use of com.intellij.openapi.util.BuildNumber in project intellij-community by JetBrains.
the class MacMainFrameDecorator method createProtocolHandler.
private static void createProtocolHandler() {
if (ourProtocolHandler == null) {
// install uri handler
final ID mainBundle = invoke("NSBundle", "mainBundle");
final ID urlTypes = invoke(mainBundle, "objectForInfoDictionaryKey:", Foundation.nsString("CFBundleURLTypes"));
final ApplicationInfoEx info = ApplicationInfoImpl.getShadowInstance();
final BuildNumber build = info != null ? info.getBuild() : null;
if (urlTypes.equals(ID.NIL) && build != null && !build.isSnapshot()) {
LOG.warn("no url bundle present. \n" + "To use platform protocol handler to open external links specify required protocols in the mac app layout section of the build file\n" + "Example: args.urlSchemes = [\"your-protocol\"] will handle following links: your-protocol://open?file=file&line=line");
return;
}
ourProtocolHandler = new CustomProtocolHandler();
Application.getApplication().setOpenURIHandler(new OpenURIHandler() {
@Override
public void openURI(AppEvent.OpenURIEvent event) {
ourProtocolHandler.openLink(event.getURI());
}
});
}
}
Aggregations