Search in sources :

Example 1 with BuildNumber

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());
}
Also used : PluginDownloader(com.intellij.openapi.updateSettings.impl.PluginDownloader) InstalledPluginsState(com.intellij.ide.plugins.InstalledPluginsState) BuildNumber(com.intellij.openapi.util.BuildNumber) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 2 with BuildNumber

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());
    }
}
Also used : BuildNumber(com.intellij.openapi.util.BuildNumber)

Example 3 with BuildNumber

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);
    }
}
Also used : BuildNumber(com.intellij.openapi.util.BuildNumber)

Example 4 with BuildNumber

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;
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) BuildNumber(com.intellij.openapi.util.BuildNumber) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) Attachment(com.intellij.openapi.diagnostic.Attachment) UpdateSettings(com.intellij.openapi.updateSettings.impl.UpdateSettings) Application(com.intellij.openapi.application.Application) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with BuildNumber

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());
            }
        });
    }
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) BuildNumber(com.intellij.openapi.util.BuildNumber) CustomProtocolHandler(com.intellij.ui.CustomProtocolHandler) ID(com.intellij.ui.mac.foundation.ID)

Aggregations

BuildNumber (com.intellij.openapi.util.BuildNumber)5 ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)2 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 InstalledPluginsState (com.intellij.ide.plugins.InstalledPluginsState)1 Application (com.intellij.openapi.application.Application)1 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)1 Attachment (com.intellij.openapi.diagnostic.Attachment)1 PluginId (com.intellij.openapi.extensions.PluginId)1 PluginDownloader (com.intellij.openapi.updateSettings.impl.PluginDownloader)1 UpdateSettings (com.intellij.openapi.updateSettings.impl.UpdateSettings)1 CustomProtocolHandler (com.intellij.ui.CustomProtocolHandler)1 ID (com.intellij.ui.mac.foundation.ID)1 LinkedHashMap (java.util.LinkedHashMap)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.junit.Test)1