mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[build] IJPL-173517 Extract Smart Update to a plugin
GitOrigin-RevId: 9eeb8e87c167f46188a17ae150ce1e7a9b251549
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f0572e69ff
commit
626ba0c034
Generated
+1
@@ -340,6 +340,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.devkit.plugin/intellij.devkit.plugin.main.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.devkit.plugin/intellij.devkit.plugin.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.devkit.plugin/noKotlin/intellij.devkit.plugin.main.noKotlin.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.devkit.plugin/noKotlin/intellij.devkit.plugin.main.noKotlin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/runtimeModuleRepository/jps/intellij.devkit.runtimeModuleRepository.jps.iml" filepath="$PROJECT_DIR$/plugins/devkit/runtimeModuleRepository/jps/intellij.devkit.runtimeModuleRepository.jps.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.devkit.smartupdate/intellij.devkit.smartupdate.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.devkit.smartupdate/intellij.devkit.smartupdate.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.devkit.stacktrace/intellij.devkit.stacktrace.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.devkit.stacktrace/intellij.devkit.stacktrace.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit-tests/intellij.devkit.testFramework.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit-tests/intellij.devkit.testFramework.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.devkit.themes/intellij.devkit.themes.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.devkit.themes/intellij.devkit.themes.iml" />
|
||||
|
||||
@@ -6,6 +6,5 @@
|
||||
<module name="intellij.platform.vcs.impl.lang.actions"/>
|
||||
<module name="intellij.platform.vcs.log.impl"/>
|
||||
<module name="intellij.platform.vcs.dvcs.impl"/>
|
||||
<module name="intellij.smart.update"/>
|
||||
</content>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,3 @@
|
||||
- name: lib/smart-update.jar
|
||||
modules:
|
||||
- name: intellij.smart.update
|
||||
+16
-7
@@ -1,10 +1,17 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<idea-plugin package="com.intellij.smartUpdate">
|
||||
<id>com.intellij.smartUpdate</id>
|
||||
<name>Smart Update</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
<description><![CDATA[
|
||||
Enables <b>Auto Update…</b> action that schedules automatic IDE and plugin updates.
|
||||
]]></description>
|
||||
|
||||
<dependencies>
|
||||
<module name="intellij.platform.vcs.impl"/>
|
||||
</dependencies>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="smartUpdateStep" interface="com.intellij.smartUpdate.SmartUpdateStep" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.intellij.smartUpdateStep" interface="com.intellij.smartUpdate.SmartUpdateStep" dynamic="true"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
@@ -12,16 +19,18 @@
|
||||
<smartUpdateStep id="plugins.update" implementation="com.intellij.smartUpdate.PluginsUpdateStep"/>
|
||||
<smartUpdateStep id="vcs.update" implementation="com.intellij.smartUpdate.VcsUpdateStep"/>
|
||||
<smartUpdateStep id="build.project" implementation="com.intellij.smartUpdate.BuildProjectStep"/>
|
||||
|
||||
<backgroundPostStartupActivity implementation="com.intellij.smartUpdate.IdeRestartedActivity"/>
|
||||
<statistics.counterUsagesCollector implementationClass="com.intellij.smartUpdate.SmartUpdateUsagesCollector"/>
|
||||
<registryKey key="ide.smart.update" defaultValue="false"
|
||||
|
||||
<registryKey key="ide.smart.update" defaultValue="true"
|
||||
description="Enables the 'Update and Build' action which allows to upgrade the IDE installation,
|
||||
and to update and build the sources" />
|
||||
and to update and build the sources"/>
|
||||
</extensions>
|
||||
|
||||
<actions resource-bundle="messages.SmartUpdateBundle">
|
||||
<action id="smart.update" class="com.intellij.smartUpdate.SmartUpdateAction">
|
||||
<add-to-group group-id="UpdateEntryPointGroup"/>
|
||||
</action>
|
||||
<action id="smart.update" class="com.intellij.smartUpdate.SmartUpdateAction">
|
||||
<add-to-group group-id="UpdateEntryPointGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg fill="none" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="matrix(2.36 0 0 2.36 1.12 1.12)" fill="#e66d17">
|
||||
<path d="m8.5 5.21 2.65 2.65c0.195 0.195 0.512 0.195 0.707 0 0.195-0.195 0.195-0.512 0-0.707l-3.5-3.5c-0.195-0.195-0.512-0.195-0.707 0l-3.5 3.5c-0.195 0.195-0.195 0.512 0 0.707 0.195 0.195 0.512 0.195 0.707 0l2.65-2.65v6.79c0 0.276 0.224 0.5 0.5 0.5s0.5-0.224 0.5-0.5z"/>
|
||||
<path d="m8 16c4.42 0 8-3.58 8-8 0-4.42-3.58-8-8-8-4.42 0-8 3.58-8 8 0 4.42 3.58 8 8 8zm0-1c3.87 0 7-3.13 7-7 0-3.87-3.13-7-7-7-3.87 0-7 3.13-7 7 0 3.87 3.13 7 7 7z" clip-rule="evenodd" fill-rule="evenodd"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 662 B |
@@ -0,0 +1,6 @@
|
||||
<svg fill="none" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="matrix(2.36 0 0 2.36 1.12 1.12)" fill="#E08855">
|
||||
<path d="m8.5 5.21 2.65 2.65c0.195 0.195 0.512 0.195 0.707 0 0.195-0.195 0.195-0.512 0-0.707l-3.5-3.5c-0.195-0.195-0.512-0.195-0.707 0l-3.5 3.5c-0.195 0.195-0.195 0.512 0 0.707 0.195 0.195 0.512 0.195 0.707 0l2.65-2.65v6.79c0 0.276 0.224 0.5 0.5 0.5s0.5-0.224 0.5-0.5z"/>
|
||||
<path d="m8 16c4.42 0 8-3.58 8-8 0-4.42-3.58-8-8-8-4.42 0-8 3.58-8 8 0 4.42 3.58 8 8 8zm0-1c3.87 0 7-3.13 7-7 0-3.87-3.13-7-7-7-3.87 0-7 3.13-7 7 0 3.87 3.13 7 7 7z" clip-rule="evenodd" fill-rule="evenodd"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 662 B |
@@ -5,9 +5,9 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.task.ProjectTaskManager
|
||||
import com.intellij.task.impl.ProjectTaskManagerImpl
|
||||
|
||||
const val BUILD_PROJECT = "build.project"
|
||||
private const val BUILD_PROJECT = "build.project"
|
||||
|
||||
class BuildProjectStep: SmartUpdateStep {
|
||||
internal class BuildProjectStep: SmartUpdateStep {
|
||||
override val id = BUILD_PROJECT
|
||||
override val stepName = SmartUpdateBundle.message("checkbox.build.project")
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.JComponent
|
||||
|
||||
private val LOG = logger<IdeUpdateStep>()
|
||||
|
||||
class IdeUpdateStep : StepOption {
|
||||
internal class IdeUpdateStep : StepOption {
|
||||
override val id = "ide.update"
|
||||
override val stepName: String = SmartUpdateBundle.message("checkbox.update.ide")
|
||||
override val optionName: String = SmartUpdateBundle.message("update.ide.option.toolbox")
|
||||
@@ -65,7 +65,7 @@ fun beforeRestart() {
|
||||
|
||||
private const val IDE_RESTARTED_KEY = "smart.update.ide.restarted"
|
||||
|
||||
class IdeRestartedActivity: ProjectActivity {
|
||||
internal class IdeRestartedActivity: ProjectActivity {
|
||||
override suspend fun execute(project: Project) {
|
||||
val service = project.service<SmartUpdate>()
|
||||
if (PropertiesComponent.getInstance().isTrueValue(IDE_RESTARTED_KEY)) {
|
||||
|
||||
@@ -12,9 +12,9 @@ import org.jetbrains.annotations.Nls
|
||||
import java.util.function.Consumer
|
||||
import javax.swing.JComponent
|
||||
|
||||
const val PLUGINS_UPDATE = "plugins.update"
|
||||
private const val PLUGINS_UPDATE = "plugins.update"
|
||||
|
||||
class PluginsUpdateStep: SmartUpdateStep {
|
||||
internal class PluginsUpdateStep: SmartUpdateStep {
|
||||
override val id = PLUGINS_UPDATE
|
||||
override val stepName = SmartUpdateBundle.message("update.plugins")
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.time.format.DateTimeFormatter
|
||||
import javax.swing.JFormattedTextField
|
||||
import javax.swing.text.MaskFormatter
|
||||
|
||||
|
||||
class SmartUpdateDialog(private val project: Project) : DialogWrapper(project) {
|
||||
init {
|
||||
title = SmartUpdateBundle.message("dialog.title.smart.update")
|
||||
|
||||
@@ -8,17 +8,17 @@ import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import javax.swing.JComponent
|
||||
|
||||
val EP_NAME = ExtensionPointName.create<SmartUpdateStep>("com.intellij.smartUpdateStep")
|
||||
internal val EP_NAME = ExtensionPointName.create<SmartUpdateStep>("com.intellij.smartUpdateStep")
|
||||
|
||||
interface SmartUpdateStep {
|
||||
val id: @NonNls String
|
||||
val stepName: @Nls String
|
||||
|
||||
/**
|
||||
* Perform update step and proceed by invoking onSuccess()
|
||||
* Perform an update step and proceed by invoking onSuccess()
|
||||
*
|
||||
* @param e null if task is invoked after restart or by scheduler, otherwise user-initiated
|
||||
* @param onSuccess must be called to proceed to next step
|
||||
* @param e null if a task is invoked after restart or by scheduler, otherwise user-initiated
|
||||
* @param onSuccess must be called to proceed to the next step
|
||||
*/
|
||||
fun performUpdateStep(project: Project, e: AnActionEvent? = null, onSuccess: () -> Unit)
|
||||
fun isAvailable(project: Project): Boolean = true
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
|
||||
object SmartUpdateUsagesCollector : CounterUsagesCollector() {
|
||||
internal object SmartUpdateUsagesCollector : CounterUsagesCollector() {
|
||||
private val GROUP = EventLogGroup("smart.update", 2)
|
||||
private val updatedEvent = GROUP.registerEvent("vcs.update", EventFields.DurationMs)
|
||||
private val buildEvent = GROUP.registerEvent("build.project", EventFields.DurationMs, EventFields.Boolean("success"))
|
||||
@@ -22,7 +22,5 @@ object SmartUpdateUsagesCollector : CounterUsagesCollector() {
|
||||
scheduledEvent.log()
|
||||
}
|
||||
|
||||
override fun getGroup(): EventLogGroup {
|
||||
return GROUP
|
||||
}
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
}
|
||||
@@ -13,9 +13,9 @@ import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.ui.layout.ComponentPredicate
|
||||
import javax.swing.JComponent
|
||||
|
||||
const val VCS_UPDATE = "vcs.update"
|
||||
private const val VCS_UPDATE = "vcs.update"
|
||||
|
||||
class VcsUpdateStep : SmartUpdateStep {
|
||||
internal class VcsUpdateStep : SmartUpdateStep {
|
||||
private lateinit var showOptionsListener: (Boolean) -> Unit
|
||||
override val id: String = VCS_UPDATE
|
||||
override val stepName = SmartUpdateBundle.message("checkbox.update.project")
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.boot" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.text.matching" />
|
||||
<orderEntry type="module" module-name="intellij.java.impl.refactorings" />
|
||||
<orderEntry type="module" module-name="intellij.smart.update" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.backend.workspace" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
|
||||
|
||||
@@ -639,7 +639,6 @@
|
||||
<registryKey key="devkit.inlay.threading" defaultValue="false"
|
||||
description="Experimental inlays for Threading Annotations"/>
|
||||
|
||||
<smartUpdateStep implementation="org.jetbrains.idea.devkit.actions.updateFromSources.UpdateFromSourcesStep" order="first"/>
|
||||
<registryKey key="intellij.commit.message.validation.enabled" defaultValue="false"
|
||||
description="Enables commit messages validation for intellij project"/>
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.task.ProjectTaskManager
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import com.intellij.util.Restarter
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
@@ -46,7 +47,8 @@ import kotlin.io.path.*
|
||||
|
||||
private val LOG = Logger.getInstance("org.jetbrains.idea.devkit.actions.updateFromSources.UpdateFromSourcesKt")
|
||||
|
||||
internal fun updateFromSources(project: Project, beforeRestart: () -> Unit, restartAutomatically: Boolean) {
|
||||
@ApiStatus.Internal
|
||||
fun updateFromSources(project: Project, beforeRestart: () -> Unit, restartAutomatically: Boolean) {
|
||||
LOG.debug("Update from sources requested")
|
||||
|
||||
val state = UpdateFromSourcesSettings.getState()
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.intellij.ui.UIBundle
|
||||
import com.intellij.ui.components.textFieldWithHistoryWithBrowseButton
|
||||
import com.intellij.ui.dsl.builder.*
|
||||
import com.intellij.ui.layout.enteredTextSatisfies
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import java.awt.event.ActionEvent
|
||||
import java.nio.file.Path
|
||||
@@ -88,7 +89,8 @@ class UpdateFromSourcesDialog(private val project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Panel.optionsPanel(project: Project, state: UpdateFromSourcesSettingsState): TextFieldWithHistoryWithBrowseButton {
|
||||
@ApiStatus.Internal
|
||||
fun Panel.optionsPanel(project: Project, state: UpdateFromSourcesSettingsState): TextFieldWithHistoryWithBrowseButton {
|
||||
val pathField = textFieldWithHistoryWithBrowseButton(
|
||||
project,
|
||||
FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(DevKitBundle.message("action.UpdateIdeFromSourcesAction.settings.installation.choose.ide.directory.title")),
|
||||
|
||||
+10
-7
@@ -4,20 +4,23 @@ package org.jetbrains.idea.devkit.actions.updateFromSources
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.util.xmlb.annotations.XCollection
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@State(name = "UpdateFromSourcesSettings", storages = [Storage("update.from.sources.xml", roamingType = RoamingType.DISABLED)])
|
||||
internal class UpdateFromSourcesSettings : SimplePersistentStateComponent<UpdateFromSourcesSettingsState>(UpdateFromSourcesSettingsState()) {
|
||||
@ApiStatus.Internal
|
||||
class UpdateFromSourcesSettings : SimplePersistentStateComponent<UpdateFromSourcesSettingsState>(UpdateFromSourcesSettingsState()) {
|
||||
companion object {
|
||||
fun getState() = service<UpdateFromSourcesSettings>().state
|
||||
fun getState(): UpdateFromSourcesSettingsState = service<UpdateFromSourcesSettings>().state
|
||||
}
|
||||
}
|
||||
|
||||
internal class UpdateFromSourcesSettingsState : BaseState() {
|
||||
var showSettings by property(true)
|
||||
@ApiStatus.Internal
|
||||
class UpdateFromSourcesSettingsState : BaseState() {
|
||||
var showSettings: Boolean by property(true)
|
||||
var workIdePath: String? by string()
|
||||
var buildDisabledPlugins by property(false)
|
||||
var pluginDirectoriesForDisabledPlugins by list<String>()
|
||||
var restartAutomatically by property(false)
|
||||
var buildDisabledPlugins: Boolean by property(false)
|
||||
var pluginDirectoriesForDisabledPlugins: MutableList<String> by list<String>()
|
||||
var restartAutomatically: Boolean by property(false)
|
||||
@get:XCollection(style = XCollection.Style.v2)
|
||||
val workIdePathsHistory: MutableList<String> by list()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.smart.update" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,9 @@
|
||||
<idea-plugin package="org.jetbrains.idea.devkit.smartupdate">
|
||||
<dependencies>
|
||||
<plugin id="com.intellij.smartUpdate"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<smartUpdateStep implementation="org.jetbrains.idea.devkit.smartupdate.UpdateFromSourcesStep"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+6
-3
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.devkit.actions.updateFromSources
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.devkit.smartupdate
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.IntelliJProjectUtil
|
||||
@@ -10,6 +10,9 @@ import com.intellij.smartUpdate.beforeRestart
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import org.jetbrains.idea.devkit.actions.updateFromSources.UpdateFromSourcesSettings
|
||||
import org.jetbrains.idea.devkit.actions.updateFromSources.optionsPanel
|
||||
import org.jetbrains.idea.devkit.actions.updateFromSources.updateFromSources
|
||||
import javax.swing.JComponent
|
||||
|
||||
internal class UpdateFromSourcesStep: StepOption {
|
||||
@@ -31,4 +34,4 @@ internal class UpdateFromSourcesStep: StepOption {
|
||||
override fun getDetailsComponent(project: Project): JComponent = panel {
|
||||
optionsPanel(project, UpdateFromSourcesSettings.getState()).apply { childComponent.setMinimumAndPreferredWidth(-1) }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user