mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[platform] collecting Homebrew installation stats
(cherry picked from commit f6844ace5dd5f39ed9303af66831bc3c51c3ec5c) IJ-CR-169399 GitOrigin-RevId: 18dd985dff847fdd105ab6dc258af9e9dce2230b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d116dcf3de
commit
6a2a521c5f
@@ -9414,16 +9414,6 @@ e:com.intellij.openapi.updateSettings.impl.ChannelStatus
|
||||
- getDisplayName():java.lang.String
|
||||
- s:valueOf(java.lang.String):com.intellij.openapi.updateSettings.impl.ChannelStatus
|
||||
- s:values():com.intellij.openapi.updateSettings.impl.ChannelStatus[]
|
||||
e:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- java.lang.Enum
|
||||
- sf:ACTUAL:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:SNAP:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:TOOLBOX:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:UNKNOWN:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- f:toolName:java.lang.String
|
||||
- s:isCreatingDesktopEntries():Z
|
||||
- s:valueOf(java.lang.String):com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- s:values():com.intellij.openapi.updateSettings.impl.ExternalUpdateManager[]
|
||||
f:com.intellij.openapi.updateSettings.impl.IdeRestartKt
|
||||
- sf:restartOrNotify(com.intellij.openapi.project.Project,Z,java.lang.String,kotlin.jvm.functions.Function0):V
|
||||
- bs:restartOrNotify$default(com.intellij.openapi.project.Project,Z,java.lang.String,kotlin.jvm.functions.Function0,I,java.lang.Object):V
|
||||
|
||||
@@ -653,6 +653,16 @@ com.intellij.openapi.ui.playback.PlaybackCommand
|
||||
- a:canGoFurther():Z
|
||||
- a:execute(com.intellij.openapi.ui.playback.PlaybackContext):java.util.concurrent.CompletableFuture
|
||||
- getScriptDir():java.io.File
|
||||
e:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- java.lang.Enum
|
||||
- sf:ACTUAL:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:BREW:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:SNAP:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:TOOLBOX:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- sf:UNKNOWN:com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- f:toolName:java.lang.String
|
||||
- s:valueOf(java.lang.String):com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
- s:values():com.intellij.openapi.updateSettings.impl.ExternalUpdateManager[]
|
||||
com.intellij.openapi.updateSettings.impl.UpdateSettingsProvider
|
||||
- a:getPluginRepositories():java.util.List
|
||||
com.intellij.openapi.updateSettings.impl.UpdateSettingsUIProvider
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.internal.statistic.collectors.fus
|
||||
|
||||
import com.intellij.internal.statistic.beans.MetricEvent
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.events.EventId1
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
|
||||
import com.intellij.openapi.updateSettings.impl.ExternalUpdateManager
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
internal class UpdateManagerUsagesCollector : ApplicationUsagesCollector() {
|
||||
private val GROUP: EventLogGroup = EventLogGroup("platform.installer", 2)
|
||||
private val UPDATE_MANAGER: EventId1<String?> = GROUP.registerEvent(
|
||||
"Update Manager",
|
||||
EventFields.String("value", arrayListOf("Toolbox App", "Snap", "Other", "IDE"))
|
||||
)
|
||||
private val GROUP: EventLogGroup = EventLogGroup("platform.installer", 3)
|
||||
|
||||
override fun getMetrics(): Set<MetricEvent> = setOf(
|
||||
UPDATE_MANAGER.metric(when (ExternalUpdateManager.ACTUAL) {
|
||||
ExternalUpdateManager.TOOLBOX -> "Toolbox App"
|
||||
ExternalUpdateManager.SNAP -> "Snap"
|
||||
ExternalUpdateManager.UNKNOWN -> "Other"
|
||||
null -> "IDE"
|
||||
}))
|
||||
private val MANAGERS = listOf("Toolbox App", "Snap", "Homebrew", "Other", "IDE")
|
||||
|
||||
private val UPDATE_MANAGER = GROUP.registerEvent("Update Manager", EventFields.String("value", MANAGERS))
|
||||
|
||||
override fun getMetrics(): Set<MetricEvent> = setOf(UPDATE_MANAGER.metric(
|
||||
when (ExternalUpdateManager.ACTUAL) {
|
||||
ExternalUpdateManager.TOOLBOX -> "Toolbox App"
|
||||
ExternalUpdateManager.SNAP -> "Snap"
|
||||
ExternalUpdateManager.BREW -> "Homebrew"
|
||||
ExternalUpdateManager.UNKNOWN -> "Other"
|
||||
null -> "IDE"
|
||||
}
|
||||
))
|
||||
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.updateSettings.impl;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.system.OS;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.file.Files;
|
||||
@@ -15,6 +17,7 @@ import java.nio.file.Path;
|
||||
public enum ExternalUpdateManager {
|
||||
TOOLBOX("Toolbox App"),
|
||||
SNAP("Snap"),
|
||||
BREW("Homebrew"),
|
||||
UNKNOWN(null);
|
||||
|
||||
public final @NlsSafe String toolName;
|
||||
@@ -40,14 +43,17 @@ public enum ExternalUpdateManager {
|
||||
var toolboxV2Path = System.getProperty("ide.managed.by.toolbox");
|
||||
if (home.contains("/apps/") && home.contains("/ch-")) ACTUAL = TOOLBOX;
|
||||
else if (toolboxV2Path != null && Files.exists(Path.of(toolboxV2Path)))ACTUAL = TOOLBOX;
|
||||
else if (SystemInfo.isLinux && (home.startsWith("/snap/") || home.startsWith("/var/lib/snapd/snap/"))) ACTUAL = SNAP;
|
||||
else if (OS.CURRENT == OS.Linux && (home.startsWith("/snap/") || home.startsWith("/var/lib/snapd/snap/"))) ACTUAL = SNAP;
|
||||
else if (OS.CURRENT != OS.Windows && home.contains("/homebrew/")) ACTUAL = BREW;
|
||||
else if (System.getProperty("ide.no.platform.update") != null) ACTUAL = UNKNOWN;
|
||||
else ACTUAL = null;
|
||||
Logger.getInstance(ExternalUpdateManager.class).info("update manager: " + (ACTUAL == null ? "-" : ACTUAL.toolName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} when the update manager takes care of creating XDG desktop entries.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public static boolean isCreatingDesktopEntries() {
|
||||
return ACTUAL == TOOLBOX || ACTUAL == SNAP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user